2024-03-17 12:25:29 +00:00
|
|
|
if (NOT NO_ISA_EXTENSIONS)
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-mcpu=native" COMPILER_SUPPORTS_MCPU_NATIVE)
|
|
|
|
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=native")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=native")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
|
|
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
|
|
|
|
endif()
|
|
|
|
endif()
|
2024-03-22 21:07:43 +00:00
|
|
|
if(WIN32)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:AVX2")
|
|
|
|
endif()
|
2024-03-17 12:25:29 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT LEGACY)
|
|
|
|
set(USE_WAYLAND ON)
|
|
|
|
else()
|
|
|
|
set(USE_WAYLAND OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
|
2024-05-18 12:01:43 +00:00
|
|
|
add_compile_options(/MP)
|
2024-05-04 11:30:53 +00:00
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
|
2024-03-17 12:25:29 +00:00
|
|
|
endif()
|
2024-03-17 12:50:39 +00:00
|
|
|
|
2024-09-18 16:41:29 +00:00
|
|
|
if(EMSCRIPTEN)
|
|
|
|
add_compile_options(-sUSE_FREETYPE=1 -pthread -DIMGUI_IMPL_OPENGL_ES2)
|
|
|
|
endif()
|
|
|
|
|
2024-03-20 21:25:24 +00:00
|
|
|
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT EMSCRIPTEN)
|
2024-03-17 12:50:39 +00:00
|
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
|
|
|
endif()
|
2024-03-21 00:08:50 +00:00
|
|
|
|
2024-07-17 20:54:07 +00:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT EMSCRIPTEN)
|
2024-05-12 17:44:58 +00:00
|
|
|
find_program(MOLD_LINKER mold)
|
|
|
|
if(MOLD_LINKER)
|
|
|
|
set(CMAKE_LINKER_TYPE "MOLD")
|
|
|
|
endif()
|
2024-05-23 23:16:06 +00:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-eliminate-unused-debug-types")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-eliminate-unused-debug-types")
|
|
|
|
endif()
|
2024-03-23 01:08:00 +00:00
|
|
|
endif()
|
2024-07-12 15:11:27 +00:00
|
|
|
|
|
|
|
file(GENERATE OUTPUT .gitignore CONTENT "*")
|