Skip to content

try a windows build#33

Merged
vthiery merged 42 commits into
vthiery:masterfrom
kevinkreiser:kk_windows
Jul 13, 2021
Merged

try a windows build#33
vthiery merged 42 commits into
vthiery:masterfrom
kevinkreiser:kk_windows

Conversation

@kevinkreiser

@kevinkreiser kevinkreiser commented Jun 25, 2021

Copy link
Copy Markdown
Collaborator

this is a work in progress. i'm trying to add CI step that builds the library and tests it on windows. with @rbsheth 's help we've updated the library to have the right ifdefs for windows but im still messing around with getting the build to work on CI.

@rbsheth

rbsheth commented Jun 25, 2021

Copy link
Copy Markdown
Contributor

@kevinkreiser You might like #34 😄

@kevinkreiser

Copy link
Copy Markdown
Collaborator Author

@rbsheth looks like you are further along than i. i was starting with the CI bits while you seem to be starting off with the actual code/build changes. do you plan on adding a github action to CI?

@rbsheth

rbsheth commented Jun 25, 2021

Copy link
Copy Markdown
Contributor

@kevinkreiser No, these are changes we use internally that have been tested to work cross-platform. You can build on my PR with a Github Action to ensure no breakage?

@kevinkreiser

Copy link
Copy Markdown
Collaborator Author

@rbsheth ive cherry picked your commits into this pr. with any luck i can get CI working for windows in the next little while

@vthiery

vthiery commented Jul 2, 2021

Copy link
Copy Markdown
Owner

If you don't mind, I'd prefer to first add the support for Windows and then revisit the topic of Hunter (I have no idea how this manager works neither how it should be configured)

@rbsheth

rbsheth commented Jul 2, 2021

Copy link
Copy Markdown
Contributor

@vthiery The impact on non-Hunter users is zero since I've disabled it by default. https://github.com/vthiery/cpp-statsd-client/pull/33/files#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR10

The argument is only needed since Hunter manages the C++ standard/other flags across all compile units.

@rbsheth rbsheth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing you can get away with using only CMake here.

Comment thread .github/workflows/win.yml Outdated
Comment thread .github/workflows/win.yml Outdated
Comment thread .github/workflows/win.yml Outdated
@vthiery

vthiery commented Jul 2, 2021

Copy link
Copy Markdown
Owner

@vthiery The impact on non-Hunter users is zero since I've disabled it by default. https://github.com/vthiery/cpp-statsd-client/pull/33/files#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR10

The argument is only needed since Hunter manages the C++ standard/other flags across all compile units.

It doesn't harm indeed but I'm skeptical about having to change a library (or its build config) to have a package manager working. Actually, shouldn't we avoid setting these

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)

and let the lib consumer set them?

kevinkreiser and others added 3 commits July 2, 2021 11:43
Co-authored-by: Rahul Sheth <rbsheth@cs.stanford.edu>
Co-authored-by: Rahul Sheth <rbsheth@cs.stanford.edu>
Co-authored-by: Rahul Sheth <rbsheth@cs.stanford.edu>
@rbsheth

rbsheth commented Jul 2, 2021

Copy link
Copy Markdown
Contributor

@vthiery Yes, that would be ideal. But setting those is one way to communicate to consumers that the library needs C++11 support. Another way is to set per-target requirements https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD. I would suggest setting these on test/other executables and refraining from setting on the library.

Comment thread .github/workflows/win.yml Outdated
Co-authored-by: Rahul Sheth <rbsheth@cs.stanford.edu>
Comment thread .github/workflows/win.yml Outdated
@kevinkreiser

Copy link
Copy Markdown
Collaborator Author

haha i had to get a windows vm and install visual studio to actually get this working but it seems to pass now. ill clean it up and ping back for review

Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt

StatsdClient(const StatsdClient&) = delete;
StatsdClient& operator=(const StatsdClient&) = delete;
StatsdClient(StatsdClient&&) = default;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes a warning in windows builds

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why default and not delete?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out that was only a warning when i turned on /Wall which was way too far of a level to turn on anyway so i can just remove it

Comment thread include/cpp-statsd-client/UDPSender.hpp
Comment thread include/cpp-statsd-client/UDPSender.hpp Outdated
Comment thread include/cpp-statsd-client/UDPSender.hpp Outdated
Comment thread include/cpp-statsd-client/UDPSender.hpp
Comment thread include/cpp-statsd-client/UDPSender.hpp Outdated
Comment thread tests/StatsdServer.hpp
Comment thread tests/testStatsdClient.cpp
Comment thread tests/testStatsdClient.cpp Outdated
@kevinkreiser

Copy link
Copy Markdown
Collaborator Author

@vthiery this is ready for review! windows CI is up and running (though much slower than linux) and the tests are passing on both platforms with maximal (but still sane) warnings turned on.

Comment thread include/cpp-statsd-client/UDPSender.hpp
Comment thread include/cpp-statsd-client/UDPSender.hpp
Comment thread CMakeLists.txt
@kevinkreiser

Copy link
Copy Markdown
Collaborator Author

@vthiery this is ready for review, let me know if i can make that easier in any way, i know its a lot

@vthiery

vthiery commented Jul 9, 2021

Copy link
Copy Markdown
Owner

@vthiery this is ready for review, let me know if i can make that easier in any way, i know its a lot

Thanks for the work and the many comments @kevinkreiser ! I'll try to review this one asap

Comment thread include/cpp-statsd-client/UDPSender.hpp
@vthiery

vthiery commented Jul 12, 2021

Copy link
Copy Markdown
Owner

haha i had to get a windows vm and install visual studio to actually get this working

What's the most straightforward setup to test this (when you run on linux)? we could add this to the README

@kevinkreiser

Copy link
Copy Markdown
Collaborator Author

@vthiery im not exactly sure what you mean by: "when you run on linux". do you mean how to check windows builds work on linux? for me i created a virtual box vm of windows and downloaded visual studio and basically ran it on windows natively that way. it will be the same for any windows developer. you simply open the project directory as a cmake project in visual studio and run the test target and it just works. do you want me to document that in the readme?

the comment that you quoted was me laughing at myself for thinking i could debug the windows build via github actions CI logs. in the end it was just too slow to do it that way. so instead of taking forever i just installed a vm and worked in windows directly.

does that make sense?

@vthiery

vthiery commented Jul 13, 2021

Copy link
Copy Markdown
Owner

i created a virtual box vm of windows and downloaded visual studio and basically ran it on windows natively

👍

@vthiery
vthiery merged commit ce5cae6 into vthiery:master Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants