progress towards cpp20

develop
Myk Taylor 2023-03-23 17:29:39 -07:00
parent 538103b90f
commit ca9a0fb7d1
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
2 changed files with 20 additions and 9 deletions

@ -35,9 +35,10 @@ option(REMOVE_SYMBOLS_FROM_DF_STUBS "Remove debug symbols from DF stubs. (Reduce
macro(CHECK_GCC compiler_path)
execute_process(COMMAND ${compiler_path} -dumpversion OUTPUT_VARIABLE GCC_VERSION_OUT)
string(STRIP "${GCC_VERSION_OUT}" GCC_VERSION_OUT)
if(${GCC_VERSION_OUT} VERSION_LESS "4.8")
message(SEND_ERROR "${compiler_path} version ${GCC_VERSION_OUT} cannot be used - use GCC 4.8 or later")
elseif(${GCC_VERSION_OUT} VERSION_GREATER "4.9.9")
if(${GCC_VERSION_OUT} VERSION_LESS "10")
message(SEND_ERROR "${compiler_path} version ${GCC_VERSION_OUT} cannot be used - use GCC 10 or later")
# TODO: this may need to be removed when DF linux actually comes out
# TODO: and we can test
# GCC 5 changes ABI name mangling to enable C++11 changes.
# This must be disabled to enable linking against DF.
# http://developerblog.redhat.com/2015/02/05/gcc5-and-the-c11-abi/
@ -66,8 +67,8 @@ if(WIN32)
endif()
endif()
# Ask for C++11 standard from compilers
set(CMAKE_CXX_STANDARD 11)
# Ask for C++-20 standard from compilers
set(CMAKE_CXX_STANDARD 20)
# Require the standard support from compilers.
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Use only standard c++ to keep code portable
@ -226,9 +227,7 @@ if(UNIX)
## flags for GCC
# default to hidden symbols
# ensure compatibility with older CPUs
# enable C++11 features
add_definitions(-DLINUX_BUILD)
add_definitions(-D_GLIBCXX_USE_C99)
set(GCC_COMMON_FLAGS "-fvisibility=hidden -mtune=generic -Wall -Werror")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COMMON_FLAGS}")

@ -1,14 +1,26 @@
# list depends here.
add_subdirectory(lodepng)
add_subdirectory(lua)
add_subdirectory(md5)
add_subdirectory(lua)
add_subdirectory(protobuf)
if(UNIX)
set_target_properties(lua PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations -Wno-deprecated-enum-enum-conversion")
target_compile_options(protoc
PUBLIC -Wno-deprecated-declarations -Wno-restrict)
target_compile_options(protoc-bin
PUBLIC -Wno-deprecated-declarations -Wno-restrict)
target_compile_options(protobuf-lite
PUBLIC -Wno-deprecated-declarations -Wno-restrict)
target_compile_options(protobuf
PUBLIC -Wno-deprecated-declarations -Wno-restrict)
endif()
if(UNIX AND NOT APPLE) # remove this once our MSVC build env has been updated
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" OFF)
add_subdirectory(googletest)
if(UNIX)
set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-Wno-maybe-uninitialized -Wno-sign-compare")
set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-Wno-maybe-uninitialized -Wno-sign-compare -Wno-restrict")
endif()
endif()