Implement CMake build scripts and github actions.#114
Implement CMake build scripts and github actions.#114iSLC wants to merge 3 commits intoproject-valhalla:mainfrom
Conversation
Only Windows and Linux for now. Builds dependencies and links statically against them. Minimally intrusive approach. Only adds a few files and submodules.
|
Appreciate it, I'll look into this in a while as I'm working on multiple things 👍 |
Fix some compiler flags not being applied on Linux.
|
Just wanted to leave my opinion here: I think if the devs will want to switch away from the current makefile to your cmake setup exclusively, it would be nice to also have an option to dynamically link libraries (at least on Linux). Statically linking them means the library version is fixed with the game version, so you won't be able to update it in case that library version has a bug. It's especially beneficial for SDL libraries, which constantly receive improvements on Linux. For example, many Linux distros now ship sdl2-compat instead of SDL2 which runs on top of SDL3 that is constantly receiving improvements in areas like native Wayland integration (the modern Linux windowing system). Also, the makefile sets the following buildflags: |
|
@user1-github makes perfect sense. I'll see if I can work on something like that as soon as I get some time. Also, I don't think anyone needs to give up on the make file build script. This can be just an alternative since it integrates well with the github actions and code editors like VS Code through extensions. Which is the main reason I made it. I just open the folder with VS Code, the extension picks up the build scripts, I select the compiler I want to build with, and what I want to build from the script. And that's it. You're set to build for release or start to add breakpoints and debug code. Also, the flags are added. See: Line 333 in CMakeLists.txt file. # GNU compatible options
if (MSYS OR MINGW OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(Client PRIVATE -Wimplicit-fallthrough -fsigned-char -fno-exceptions -fno-rtti)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options(Client PRIVATE -fomit-frame-pointer -ffast-math)
endif()
endif()Line 466 (identic but for server) And the warnings are handled by a separate helper script from # CMake scripts extensions
# Helper that can set default warning flags for you
if(NOT MSVC)
target_set_warnings(Client ENABLE ALL DISABLE Annoying extra pedantic unused ignored-qualifiers cast-function-type)
else()
target_set_warnings(Client DISABLE ALL) # MSVC has a lot to say about this code. let's ignore it
endif()Repeat for server,master etc. |
|
Yeah, I probably just missed the flags while looking at CMakeLists.txt. If you'll decide to add a dynamic linking setup, Blue Nebula (a Cube 2 engine based game) already has a setup for detecting the SDL2 libraries, so it might help you. |
Only Windows and Linux for now.
Builds dependencies and links statically against them.
Minimally intrusive approach. Only adds a few files and submodules.
Uploads resulted binaries of each run so they can be downloaded by anyone. Like nightly builds (without the data).