Created
September 2, 2012 18:37
-
-
Save hasufell/3602799 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From: Julian Ospald <[email protected]> | |
| Date: Thu Aug 2 08:38:32 UTC 2012 | |
| Subject: build system | |
| remove arch suffixes for binaries to avoid trouble within the ebuild | |
| respect flags | |
| --- CMakeLists.txt | |
| +++ CMakeLists.txt | |
| @@ -21,7 +21,6 @@ | |
| if( MSVC ) | |
| set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /arch:SSE /fp:precise /Oy" ) | |
| else() | |
| - set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -pipe" ) | |
| set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g" ) | |
| set( CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -DNDEBUG -Os" ) | |
| set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG -O3 -ffast-math -fomit-frame-pointer -fno-strict-aliasing" ) | |
| @@ -231,138 +230,6 @@ | |
| set( CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cpack/OS_X/x86_64/info.plist" ) | |
| endif() | |
| -################# | |
| -# Compile flags # | |
| -################# | |
| - | |
| -macro( try_compiler_flag_internal PROP FLAG CC SUFFIX LABEL ) | |
| - set( SAVED_FLAGS "${CMAKE_${CC}_FLAGS}" ) | |
| - set( CMAKE_${CC}_FLAGS "${CMAKE_${CC}_FLAGS} ${FLAG}" ) | |
| - # test it on an executable | |
| - if( NOT ${PROP}_${CC}_CACHED ) | |
| - try_compile( ${PROP}_${CC} ${MOUNT_DIR}/tests ${MOUNT_DIR}/tests/test.${SUFFIX} | |
| - CMAKE_FLAGS "-DCMAKE_${CC}_FLAGS=${CMAKE_${CC}_FLAGS}" ) | |
| - endif() | |
| - if( ${PROP}_${CC} ) | |
| - if( NOT ${PROP}_${CC}_CACHED ) | |
| - message( STATUS "Using ${LABEL} flag ${FLAG}" ) | |
| - endif() | |
| - else() | |
| - if( NOT ${PROP}_${CC}_CACHED ) | |
| - message( STATUS "${LABEL} flag ${FLAG} is not available" ) | |
| - endif() | |
| - set( CMAKE_${CC}_FLAGS "${SAVED_FLAGS}" ) | |
| - endif() | |
| - set( ${PROP}_${CC}_CACHED TRUE CACHE INTERNAL "Set if ${LABEL} option ${FLAG} has been checked for." ) | |
| -endmacro() | |
| - | |
| -macro( try_c_flag PROP FLAG ) | |
| - try_compiler_flag_internal( ${PROP} ${FLAG} C c C ) | |
| -endmacro() | |
| - | |
| -macro( try_cxx_flag PROP FLAG ) | |
| - try_compiler_flag_internal( ${PROP} ${FLAG} CXX cxx C++ ) | |
| -endmacro() | |
| - | |
| -macro( try_llvm_flag PROP FLAG ) | |
| - try_compiler_flag_internal( ${PROP} ${FLAG} LLVM cc C/LLVM ) | |
| -endmacro() | |
| - | |
| -macro( try_c_llvm_flag PROP FLAG ) | |
| - try_c_flag( ${PROP} ${FLAG} ) | |
| - if( GAME_LIB_LLVM ) | |
| - try_llvm_flag( ${PROP} ${FLAG} ) | |
| - endif() | |
| -endmacro() | |
| - | |
| -macro( try_c_cxx_flag PROP FLAG ) | |
| - try_c_flag( ${PROP} ${FLAG} ) | |
| - try_cxx_flag( ${PROP} ${FLAG} ) | |
| -endmacro() | |
| - | |
| -macro( try_c_cxx_llvm_flag PROP FLAG ) | |
| - try_c_flag( ${PROP} ${FLAG} ) | |
| - try_cxx_flag( ${PROP} ${FLAG} ) | |
| - if( GAME_LIB_LLVM ) | |
| - try_llvm_flag( ${PROP} ${FLAG} ) | |
| - endif() | |
| -endmacro() | |
| - | |
| -# Various warnings | |
| -if( ENABLE_W_ALL ) | |
| - try_c_cxx_llvm_flag( HAVE_W_ALL -Wall ) | |
| -endif() | |
| -if( ENABLE_W_EXTRA ) | |
| - try_c_cxx_llvm_flag( HAVE_W_ALL -Wall ) | |
| -endif() | |
| -if( ENABLE_WARNINGS ) | |
| - try_c_cxx_llvm_flag( HAVE_W_FORMAT2 -Wformat=2 ) | |
| - if( NOT HAVE_W_FORMAT2_C ) | |
| - try_c_cxx_llvm_flag( HAVE_W_FORMAT -Wformat ) | |
| - endif() | |
| - try_c_llvm_flag ( HAVE_W_0LEN_FMT -Wno-format-zero-length ) | |
| - try_c_cxx_llvm_flag( HAVE_W_FORMAT_SECURITY -Wformat-security ) | |
| - try_c_cxx_llvm_flag( HAVE_W_STRICT_ALIAS_2 -Wstrict-aliasing=2 ) | |
| - try_c_cxx_llvm_flag( HAVE_W_MISSING_FMT_ATTR -Wmissing-format-attribute ) | |
| - try_c_cxx_llvm_flag( HAVE_W_MISSING_NORETURN -Wmissing-noreturn ) | |
| - try_c_llvm_flag ( HAVE_W_IMPLICIT_FN -Wimplicit-function-declaration ) | |
| - if( HAVE_W_IMPLICIT_FN_C ) | |
| - try_c_cxx_llvm_flag( HAVE_W_ERR_IMPLICIT_FN -Werror=implicit-function-declaration ) | |
| - endif() | |
| - try_c_cxx_llvm_flag( HAVE_W_FMT_SECURITY -Wformat-security ) | |
| - if( HAVE_W_FMT_SECURITY_C ) | |
| - try_c_cxx_llvm_flag( HAVE_W_ERR_FMT_SECURITY -Werror=format-security ) | |
| - endif() | |
| -endif() | |
| - | |
| -# Hardening | |
| -if( ENABLE_HARDENING ) | |
| - try_c_cxx_flag( HAVE_F_STACK_PROTECTOR -fstack-protector ) | |
| -endif() | |
| - | |
| -############## | |
| -# Link flags # | |
| -############## | |
| - | |
| -macro( try_linker_flag PROP FLAG ) | |
| - set( SAVED_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" ) | |
| - set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLAG}" ) | |
| - # test it on an executable | |
| - if( NOT ${PROP}_CACHED ) | |
| - try_compile( ${PROP} ${MOUNT_DIR}/tests ${MOUNT_DIR}/tests/test.c | |
| - CMAKE_FLAGS -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS} ) | |
| - endif() | |
| - if( ${PROP} ) | |
| - if( NOT ${PROP}_CACHED ) | |
| - message( STATUS "Using linker flag ${FLAG}" ) | |
| - endif() | |
| - # assume that it works for shared & static libs too | |
| - set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FLAG}" ) | |
| - set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FLAG}" ) | |
| - else() | |
| - if( NOT ${PROP}_CACHED ) | |
| - message( STATUS "Linker flag ${FLAG} is not available" ) | |
| - endif() | |
| - set( CMAKE_EXE_LINKER_FLAGS "${SAVED_FLAGS}" ) | |
| - endif() | |
| - set( ${PROP}_CACHED TRUE CACHE INTERNAL "Set if linker option ${FLAG} has been checked for." ) | |
| -endmacro() | |
| - | |
| -if( NOT MSVC ) | |
| - # Can we get rid of unneeded external libraries? | |
| - try_linker_flag( HAVE_AS_NEEDED -Wl,--as-needed ) | |
| - | |
| - # If we can, fail if there are unresolved symbols | |
| - try_linker_flag( HAVE_Z_DEFS -Wl,-z,defs ) | |
| -endif() | |
| - | |
| -if( ENABLE_FSTACKPROT ) | |
| - try_linker_flag( HAVE_FSTACKPROT "-fstack-protector --param=ssp-buffer-size=4" ) | |
| -endif() | |
| -if( ENABLE_RELRO ) | |
| - try_linker_flag( HAVE_Z_RELRO_Z_NOW -Wl,-z,relro,-z,now ) | |
| -endif() | |
| - | |
| ###################### | |
| # Define Build Files # | |
| ###################### | |
| @@ -1419,7 +1286,7 @@ | |
| include_directories( ${MOUNT_DIR}/libs/cpuinfo ${NEWTON_INCLUDES} ) | |
| target_link_libraries( client ${OS_LIBRARIES} ${NEWTON_LIBRARY} ) | |
| set_property( TARGET client APPEND PROPERTY COMPILE_DEFINITIONS USE_XREAL_RENDERER COMPAT_ET USE_REFENTITY_ANIMATIONSYSTEM HAVE_SDL ) | |
| - set_target_properties( client PROPERTIES OUTPUT_NAME "daemon.${BUILD_ARCH}" PREFIX "" LINKER_LANGUAGE CXX ) | |
| + set_target_properties( client PROPERTIES OUTPUT_NAME "daemon" PREFIX "" LINKER_LANGUAGE CXX ) | |
| # Setup CPack for target client | |
| install( TARGETS client DESTINATION "Unvanquished" ) | |
| @@ -1570,7 +1437,7 @@ | |
| include_directories( ${MOUNT_DIR}/libs/cpuinfo ${NEWTON_INCLUDES} ) | |
| target_link_libraries( server ${OS_LIBRARIES} ${NEWTON_LIBRARY} ) | |
| set_property( TARGET server APPEND PROPERTY COMPILE_DEFINITIONS DEDICATED COMPAT_ET ) | |
| - set_target_properties( server PROPERTIES OUTPUT_NAME "daemonded.${BUILD_ARCH}" PREFIX "" LINKER_LANGUAGE CXX ) | |
| + set_target_properties( server PROPERTIES OUTPUT_NAME "daemonded" PREFIX "" LINKER_LANGUAGE CXX ) | |
| # Setup CPack for target server | |
| install( TARGETS server DESTINATION "Unvanquished" ) | |
| @@ -1652,7 +1519,7 @@ | |
| include_directories( ${LIB_DIR}/picomodel ${MOUNT_DIR}/tools/common ) | |
| target_link_libraries( daemonMap ${OS_LIBRARIES} ) | |
| set_property( TARGET daemonMap APPEND PROPERTY COMPILE_DEFINITIONS USE_OPENGL ) | |
| - set_target_properties( daemonMap PROPERTIES OUTPUT_NAME "daemonmap.${BUILD_ARCH}" PREFIX "" ) | |
| + set_target_properties( daemonMap PROPERTIES OUTPUT_NAME "daemonmap" PREFIX "" ) | |
| # Setup CPack for target daemonmap | |
| install( TARGETS daemonMap DESTINATION "Unvanquished" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment