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

Set C++ to 17, and a few CMake fixes for Linux #20

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

th1000s
Copy link
Contributor

@th1000s th1000s commented Apr 16, 2024

No description provided.

Copy link
Collaborator

@winterheart winterheart left a 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}")
Copy link
Collaborator

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.

Copy link
Contributor Author

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)
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

@Arcnor
Copy link
Collaborator

Arcnor commented Apr 16, 2024

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.

th1000s added 2 commits April 17, 2024 01:38
`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
@th1000s th1000s changed the title Set C++ to 14, and a few CMake fixes for Linux Set C++ to 17, and a few CMake fixes for Linux Apr 16, 2024
@Lgt2x
Copy link
Member

Lgt2x commented Apr 17, 2024

Merging, thanks for your contribution !

@Lgt2x Lgt2x merged commit 4d181c8 into DescentDevelopers:main Apr 17, 2024
3 checks passed
JeodC pushed a commit that referenced this pull request Apr 28, 2024
Set C++ to 17, and a few CMake fixes for Linux
tophyr pushed a commit to tophyr/Descent3 that referenced this pull request Jun 28, 2024
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

Successfully merging this pull request may close these issues.

4 participants