From ca9a0fb7d1f4713cfa3ab6e552ddcbc84439a5fa Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Thu, 23 Mar 2023 17:29:39 -0700 Subject: [PATCH] progress towards cpp20 --- CMakeLists.txt | 13 ++++++------- depends/CMakeLists.txt | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed92b1eca..d031c8784 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/depends/CMakeLists.txt b/depends/CMakeLists.txt index 15ff52488..566965f8a 100644 --- a/depends/CMakeLists.txt +++ b/depends/CMakeLists.txt @@ -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()