-
Notifications
You must be signed in to change notification settings - Fork 252
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
Set C++ to 17, and a few CMake fixes for Linux #20
Conversation
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.
Overall, there need to CMake project get updated, as there some old tricks made in 2.x era. I'd suggest to rewrite CMakeLists.txt to 3.11 compatibility level to get rid some of these quirks.
CMakeLists.txt
Outdated
SET(CMAKE_CXX_COMPILER "g++") | ||
SET(CMAKE_CXX_FLAGS "-O0 -g -Wno-write-strings -Wno-multichar -Wno-address-of-temporary") | ||
SET(CMAKE_C_FLAGS "-O0 -g") | ||
SET(CMAKE_CXX_FLAGS "-O0 -g -std=c++14 -Wno-write-strings -Wno-multichar ${BITS} ${EXTRA_CXX_FLAGS}") |
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.
You need this done like this
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
But there some issues in with CMake compatibility level. Also, as agreed in #4, there should be C++17 standard support.
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.
Done, plus a few lines of code adapted. And indeed, that is just functional cmake to get the code to compile.
@@ -14,14 +14,19 @@ PROJECT(Descent3) | |||
IF (UNIX) | |||
SET (D3_GAMEDIR "~/Descent3/") | |||
|
|||
IF (APPLE) |
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.
I doubt that in Apple there may 64bit code generated. Also, -m32 should be added via compiler toolchain, not directly in CMake project file.
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.
Yes, -m32
did not quite work, removed entirely.
I'd actually wait to see the outcome of #9 before merging this and similar PRs, given that Ryan Gordon had a much more "modern" port for Linux and macOS, just my 2c. |
`LIST(APPEND ..)` adds a `;` to the gcc command line, replaced with string interpolation. Only use "-Wno-address-of-temporary" on macOS (=clang), on Linux/gcc use "-fpermissive" which still shows the compiler warning so it can be fixed later.
remove register keyword, add cstdint include
Merging, thanks for your contribution ! |
Set C++ to 17, and a few CMake fixes for Linux
No description provided.