CplusplusCourse - outdated merge requestshttps://gitlab.cern.ch/sponce/cpluspluscourse/-/merge_requests2020-10-10T12:53:05+02:00https://gitlab.cern.ch/sponce/cpluspluscourse/-/merge_requests/4Add CMake configuration files for the exercises, master branch (2020.10.09.)2020-10-10T12:53:05+02:00Attila KrasznahorkayAdd CMake configuration files for the exercises, master branch (2020.10.09.)After some pondering I thought it could be beneficial to the example code if it could be compiled natively on as many platforms as possible. To do this, I opted to add `CMakeLists.txt` files to all of the example projects.
This should h...After some pondering I thought it could be beneficial to the example code if it could be compiled natively on as many platforms as possible. To do this, I opted to add `CMakeLists.txt` files to all of the example projects.
This should have a positive effect on not just the macOS and Windows builds, but even the Linux ones. Since for instance for the Python example the CMake configuration allows for a lot more robust build. (Not having to hardcode where Python is supposed to come from.)
The one controversial part of this is how I opted to implement the examples that build shared libraries, and can technically run on Windows. (The Python example I didn't even bother with...) I didn't want to fall back to static libraries with the build, so I had to update the C\+\+ code to explicitly export the symbols of the shared library. This way the code can be built into DLLs on Windows successfully. However this also means that the existing `Makefile`-s of those projects don't work anymore. :frowning: (For most projects the `CMakeLists.txt` file can work in addition to the existing `Makefile`.)
And just to show some pretty screenshots. :stuck_out_tongue:
![Screen_Shot_2020-10-09_at_11.50.57_AM](/uploads/0274914f8f4bcb911e1a79a37bb443de/Screen_Shot_2020-10-09_at_11.50.57_AM.png)
![Screenshot_2020-10-09_095326](/uploads/87963bf63acb3a282d633417e14bfe0d/Screenshot_2020-10-09_095326.png)
Pinging @sponce and @graemes.