-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[CR] CMake: update rules; add Linux install targets; add support for dev-builds; #11970
[CR] CMake: update rules; add Linux install targets; add support for dev-builds; #11970
Conversation
Hi. Thanks for updating cmake build! |
ADD_CUSTOM_TARGET( | ||
lua_bindings | ||
COMMAND ${LUA_BINARY} generate_bindings.lua | ||
BYPRODUCTS ${CMAKE_SOURCE_DIR}/src/lua/catabindings.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BYPRODUCTS argument in ADD_CUSTOM_TARGET command requires CMake 3.2 but required version of CMake is set to 2.8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quoting the documentation:
The target has no output file and is ALWAYS CONSIDERED OUT OF DATE even if the commands try to create a file with the name of the target. Use ADD_CUSTOM_COMMAND to generate a file with dependencies.
And indeed, every time I run make
, it recreates catabindings.cpp and recompiles and relinks it, which is at least a waste of time.
The standard Makefile has "$(LUA_DIR)/class_definitions.lua" and "$(LUASRC_DIR)/generate_bindings.lua" as explicit dependencies for regenerating the bindings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah. ADD_CUSTOM_COMMAND seems to work just fine. thanks!
|
||
# Required library linkage | ||
if(TILES) | ||
IF(TILES) | ||
target_include_directories(cataclysm PUBLIC ${SDL2_INCLUDE_DIR}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not your fault, but maybe it's time to increase the required cmake version? target_include_directories
was added in cmake 2.8.11, required version is "only" 2.8.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heah. We need to do something with this :) Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the build was broken before and nobody noticed in 15 days its probably safe to upgrade.
INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/chkjson ) | ||
|
||
# Add the actual executable | ||
ADD_EXECUTABLE(chkjson ${CHKJSON_SOURCES} ${CHKJSON_HEADERS}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds the chkjson file to the "all" target and it's therefor made every time somebody runs make all
. It's not a big thing (only 2 source files + linking), but the original Makefile has this as a separate target that has to be invoked explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. It seems like it is used only for debug/test purposes.
I'll move it to 'test' chain when will start it's implementation :)
|
Fixed in: https://github.com/brezerk/Cataclysm-DDA/commit/b21dd954dd414bdac793e6d0dc50dd4443513695 :P Btw: it seems like current source code does not able to run binary from arbitrary PREFIX_PATH directory? Or am I missing something? |
ah. I see:
|
There is another thing, cmake installs the content of the data folder to "./share/cataclysm-dda/data/", but it belongs into "./share/cataclysm-dda/" (there should be no data folder at all). |
I have Edit: and now it works with the parameter, just |
Good catch, thanks! Updating build rules... |
OK. It seems I will need to modify the source to be able to run binary from the cmake build directory:
However trying to run it:
strace output:
So it tries to look into 'share/cataclysm-dda'. |
… binary from cmake build directory;
Ok. I was able to test both MSYS2: MinGW32 and MinGW64 bit using: For MinGW32:
For MinGW64:
Compiles ok. ncurses version works as expected. The tiles one fails as expected :D Small investigation showes that it do segfault on:
Not sure if my KVM has any hw accel... :D |
I can test this out again when I get home for you. |
@KrazyTheFox It will be helpfull. thanks. |
Oh that, yes it's supposed to fall back to sw rendering if hw fails, but on
some systems it crashes if you even try, hence the sw rendering option.
|
In case, if some one wish to test Cataclysm-DDA cmake build scripts, here is doc COMPILING-CMAKE.md |
Using a fresh install of msys and a clean copy of Cataclysm, I was unable to compile a working version on Windows. I still needed to specify the libraries as in my previous compilation post when using cmake. It would successfully generate the makefile and when running make, it would build without errors. Upon trying to run either cataclysm.exe or cataclysm-tiles.exe, nothing would happen and I was unable to get either of the exes to generate any error messages. |
Did you install the deps with msys or manually?
|
With msys. |
That's strange, I was able to build with cmake and it detected the On 5/7/15, Mitchell Matthews notifications@github.com wrote:
|
Msys 2 shell. I'll spin up a clean Windows vm today and try it in there to make sure I don't have something external messing it up. |
@KrazyTheFox If I understand it correctly, default "MSYS2 Shell" is used for pacman stuff. Can you try to build using "MinGW Win64 Shell" or "MinGW Win32 Shell" please? |
Using the MinGW32 shell did make it easier to build, but the problem wasn't that. I was building (or attempting to build) release versions with "-DRELEASE=1". When I switched that to "-DRELEASE=0" to build a debug build, it succeeded in building a working tiles build. Edit: I'm able to build a release build that launches, however, when opened I get only a blank, black screen. |
@KrazyTheFox Yes, Does ncurses version works? afik: the first CataclysmDDA start can take some time, while it read game data and create an cache? Not sure, but can you try to build with |
@brezerk |
I've figured out the problems with the release builds. The .exe itself can be in any folder, but it expects the The exact cmake command run:
I will say thanks for helping me out with all this and getting a simpler build system up on Windows. It'll be very nice to not have to run Cataclysm in a VM! |
@KrazyTheFox thank you for your feedback.
Fixed in: https://github.com/brezerk/Cataclysm-DDA/commit/6d0678c184c1793389e5a16fca5bc7af7eb48116 |
@brezerk |
Hi there.
I'd like to use QtCreator as dev env. But It seems like cmake scripts are outdated and require some updates.
However, currently cmake build is not upstream build system for the project...
So. Do you guys have any plans for build system migration? Does this activity will be helpful for you?