Skip to content
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

QUESTION: Does the CMake build system allow overrides of things like version numbers? #221

Closed
mhjacks opened this issue May 8, 2016 · 4 comments

Comments

@mhjacks
Copy link

mhjacks commented May 8, 2016

Hello,

I'm working on Linux packaging for Empty Epsilon. I've worked with build systems before, but CMake is new to me.

I assumed that "cmake .. -DSERIOUS_PROTON_DIR=$PWD/../../SeriousProton/ -DCPACK_PACKAGE_VERSION="2016.05.07" -DCPACK_PACKAGE_VERISON_MAJOR=2016 -DCPACK_PACKAGE_VERSION_MINOR=05 -DCPACK_PACKAGE_VERSION_PATCH=07 -DVERSION_NUMBER=20160507" would be enough to force the variable versions to the right values for interoperation with the official downloads. It worked yesterday, but yesterday was, exactly, 201600507.

My builds today are coming out with 20160508 as the version, which leads me to believe the variables I'm passing are not being honored. I can get the desired results by hand-editing the intermediate files with sed or something. Am I using CMake wrong?

I should note: These builds are on Raspbian 8 (Jessie) on a Raspberry Pi 2.

@daid
Copy link
Owner

daid commented May 9, 2016

That is the proper way to set the variables in CMake, however, the CMake script overrules them with these lines:

string(TIMESTAMP CPACK_PACKAGE_VERSION_MAJOR "%Y")
string(TIMESTAMP CPACK_PACKAGE_VERSION_MINOR "%m")
string(TIMESTAMP CPACK_PACKAGE_VERSION_PATCH "%d")

So you could comment out those lines.

You could also comment out this line:

add_definitions(-DVERSION_NUMBER=${CPACK_PACKAGE_VERSION_MAJOR}${CPACK_PACKAGE_VERSION_MINOR}${CPACK_PACKAGE_VERSION_PATCH})

Which will remove the version number from the build, and make it version 0. Version 0 is accepted by any other version. For debugging.

Finally, I tried it on the Pi2 with the new open source OpenGL driver, I had crashes every few minutes, and the performance was just below acceptable.

@daid daid closed this as completed May 9, 2016
@kwadroke
Copy link

kwadroke commented May 9, 2016

I had it running on a Pi 2 & 3 back in March. I too had some problems with crashes. Haven't dug into why as of yet. I did run it with disable_shaders=1. If I remember correctly, it seemed to help. I'll test it again and bring up the FPS.

@mhjacks
Copy link
Author

mhjacks commented Jul 9, 2016

I've done this in the latest version of my build script:

sed -i "s/string(TIMESTAMP CPACK_PACKAGE_VERSION_MAJOR \"%Y\")/set(CPACK_PACKAGE_VERSION_MAJOR \"$MAJOR\")/i" CMakeLists.txt

sed -i "s/string(TIMESTAMP CPACK_PACKAGE_VERSION_MINOR \"%m\")/set(CPACK_PACKAGE_VERSION_MINOR \"$MINOR\")/i" CMakeLists.txt

sed -i "s/string(TIMESTAMP CPACK_PACKAGE_VERSION_PATCH \"%d\")/set(CPACK_PACKAGE_VERSION_PATCH \"$PATCH\")/i" CMakeLists.txt

with $MAJOR, $MINOR and $PATCH set elsewhere.

@r-barnes
Copy link
Contributor

#941 shows the version number as part of cmake's output, to provide early warning signs of misconfiguration.

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

No branches or pull requests

4 participants