-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for CMake builds #36
Conversation
Nice, thanks a lot! I'll will try out the CMake script on my system. Is your PR complete because you have set the status to "work in progress"? Also thanks for pointing out and fixing the mentioned bug! I've now rewritten EngineWorker.cpp a bit so that it ensures that the image resource is registered to cuda after cuda is initialized. It could explain why some people had a crash at the first start (on the 2nd or 3rd run it apparently worked). See df41fa2. |
Can't wait to see this fully functional! |
With these changes you can build and run
Depending on how you feel about these details, the PR could be merged in. |
In principle, I like the idea of using external libraries in this way. Probably it's better to require a specific version in case there are compatibility issues? I'd like to get your script working in Windows as well. But so far I have not been successful. After installing the external libraries via vcpkg and running cmake I get the error message Regardless of this, the CUDA part/engine was previously compiled to a separate dynamic library, as I originally had another executable target with automated tests in addition to the GUI (these are currently not contained here in this branch) where both used the engine. I'd like to add the automatic tests back soon and it would be more practical to build the engine part as a library.
That is a pity. Maybe it has to do with the size and byte order of integers?
Yes I agree, I also get some warnings with MSVC. A few have come in through include of |
Adding explicit version requirements sounds like a good idea.
Have you installed the libraries with I haven't got a chance to try in on Windows with MSVC yet, but I'm planning to do it shortly and I'll keep an eye for the issues you mentioned.
This sounds great - I was about to ask about this. The CMake scripts could be updated to factor out the components that way.
Understood. If I can carve the time, I may take a stab at cleaning some of the warnings (in a separate PR) |
Yes. The includes for Boost and the other libraries are actually in
Thanks, that would be great. |
I managed to run the script. It was some x86 vs. x64 issue. I had to install the libraries via EDIT: After removing the decorators, it worked! :-) |
Good catch. This is a bit of a trap on Windows (and one of the cons of using a package manager - you have an external build and have to deal with ABIs instead of building everything part of the project) My solution is to set
Yay! Thanks for giving it a try! |
I made a few refinements & tested the CMake build on Windows:
NOTE: Because of the submodule usage, alien clones must use the
|
That's great. It works for me right away! There are a few minor things I noticed:
Regarding the serialization problem: For testing purposes I've serialized the startup example as text format. You can find it here: https://alien-project.org/files/autosave.zip |
You're right. While header files are not technically required for builds, adding them should provide a better IDE experience - I'll add them.
Will do.
I'll give it a try and report back. Thanks for the suggestions. I started making the changes, when I hit something that looks like a vcpkg bug, so I need to take a short detour to understand what's going on. |
Ok, thanks.
If I can help somehow please let me know. |
- Individual CMakeLists.txt per subdirectory - Add the header files (better IDE integration)
I added the headers and Since I see an interest in using this, I went ahead and did a proper refactor of the CMake scripts to follow the hierarchical project organization (one Please take a look and let me know what you think. PS. I tried the text-serialized PPS. Here's the vcpkg issue I mentioned. Hopefully, the vcpkg would accept the fix, but in the meantime there are easy workarounds if anyone else hits it. |
When I build the project via
then I encounter the error message:
I could solved it by adding the following line in
I don't know if this is the right way. I found it here (https://gitlab.kitware.com/cmake/cmake/-/issues/17520) |
After adding this line, everything seems fine to me and we can merge the PR. I will convert the simulation examples to the new format afterwards and also update the build instruction for Windows. Thanks again for your contribution! I'm happy that it now runs in Linux just like it does in Windows. |
The |
Great, it's merged now. |
The build instructions look good to me. One thing that may be worth noting in there is that submodules may change and by default I noticed that you removed the MSVC project files too - it looks like a nice cleanup, it should be easier to maintain a single build system going forward. PS. thanks for fixing the CMake comment! |
Good point! |
This is an experimental set of changes which add cross-platform build support using CMake (README.md has been updated to include CMake build instructions on Linux)
In addition to the CMake build files, there are a few bug fixes and C++ portability changes.
Hopefully, these changes may help a bit advance this nice project, at least as a starting point for cross-platform support.
Cheers!