mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of ssh+git://git.axiodl.com/AxioDL/urde
This commit is contained in:
commit
f46648f1ec
|
@ -104,7 +104,10 @@ else()
|
|||
#add_compile_definitions(_GLIBCXX_DEBUG=1)
|
||||
endif()
|
||||
|
||||
if(${URDE_VECTOR_ISA} STREQUAL "avx2")
|
||||
if(${URDE_VECTOR_ISA} STREQUAL "native")
|
||||
add_compile_options(-march=native)
|
||||
message(STATUS "Building with native ISA")
|
||||
elseif(${URDE_VECTOR_ISA} STREQUAL "avx2")
|
||||
add_compile_options(-mavx2)
|
||||
message(STATUS "Building with AVX2 Vector ISA")
|
||||
elseif(${URDE_VECTOR_ISA} STREQUAL "avx")
|
||||
|
@ -156,20 +159,56 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|||
link_directories(/usr/local/lib)
|
||||
endif()
|
||||
|
||||
if(("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||
AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
option(USE_LD_GOLD "Link with GNU Gold and enable LTO" ON)
|
||||
else()
|
||||
option(USE_LD_GOLD "Link with GNU Gold and enable LTO" OFF)
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
option(USE_LD_LLD "Link with LLD" ON)
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
option(USE_LD_GOLD "Link with GNU Gold" ON)
|
||||
endif()
|
||||
if(USE_LD_GOLD AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"))
|
||||
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT LTO_SUPPORTED)
|
||||
if(LTO_SUPPORTED AND ("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"))
|
||||
option(USE_LTO "Enable LTO" ON)
|
||||
else()
|
||||
option(USE_LTO "Enable LTO" OFF)
|
||||
endif()
|
||||
else()
|
||||
option(USE_LD_LLD "Link with LLD" OFF)
|
||||
option(USE_LD_GOLD "Link with GNU Gold" OFF)
|
||||
option(USE_LTO "Enable LTO" OFF)
|
||||
endif()
|
||||
if(USE_LD_LLD)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=lld -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||
if("${LD_VERSION}" MATCHES "LLD")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
|
||||
if(USE_LTO)
|
||||
add_compile_options(-flto=thin)
|
||||
add_link_options(-flto=thin)
|
||||
message(STATUS "LLD linker enabled with LTO.")
|
||||
else()
|
||||
message(STATUS "LLD linker enabled.")
|
||||
endif()
|
||||
set(USE_LD_GOLD OFF)
|
||||
else()
|
||||
message(WARNING "LLD linker isn't available, using the default system linker.")
|
||||
set(USE_LD_LLD OFF)
|
||||
endif()
|
||||
endif()
|
||||
if(USE_LD_GOLD)
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||
if("${LD_VERSION}" MATCHES "GNU gold")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
|
||||
if(USE_LTO)
|
||||
add_compile_options(-flto=thin)
|
||||
add_link_options(-flto=thin)
|
||||
message(STATUS "GNU gold linker enabled with LTO.")
|
||||
else()
|
||||
message(STATUS "GNU gold linker enabled.")
|
||||
endif()
|
||||
set(USE_LD_LLD OFF)
|
||||
else()
|
||||
message(WARNING "GNU gold linker isn't available, using the default system linker.")
|
||||
set(USE_LD_GOLD OFF)
|
||||
|
|
|
@ -41,9 +41,14 @@ cd urde-build
|
|||
|
||||
```sh
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ../urde
|
||||
make
|
||||
make -j$(nproc)
|
||||
```
|
||||
|
||||
CMake options:
|
||||
- Build release optimized (better runtime performance): `-DCMAKE_BUILD_TYPE=Release`
|
||||
- Use clang+lld (faster linking): `-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++`
|
||||
- Optimize for current CPU (resulting binaries are not portable): `-DURDE_VECTOR_ISA=native`
|
||||
|
||||
#### Qt Creator
|
||||
*(main development / debugging IDE)*
|
||||
|
||||
|
|
Loading…
Reference in New Issue