GTA_SA_cheat/CMakeLists.txt

66 lines
1.7 KiB
CMake
Raw Permalink Normal View History

2021-03-04 22:14:31 +01:00
cmake_minimum_required(VERSION 3.19)
project(GTA_SA_cheat)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
find_package(OpenMP REQUIRED)
# see https://cmake.org/cmake/help/latest/module/FindBoost.html
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
set(COMPILE_DEFINITIONS
$<$<CONFIG:DEBUG>:_LIBCPP_DEBUG>
#[[_FORTIFY_SOURCE=2]]
)
set(COMPILE_FLAGS
-pipe
2021-03-13 11:56:40 +01:00
-march=native # change to native or your architecture.
-mtune=native # same as above
2021-03-04 22:14:31 +01:00
-mrdseed # be careful about this, this is linked to the x86 architecture.
-mrdrnd # same as above
-stdlib=libc++
-Wpedantic
2021-03-13 11:56:40 +01:00
-pedantic
2021-03-04 22:14:31 +01:00
-Wall
-Wextra
-Wmove
-Wopenmp
2021-03-13 11:56:40 +01:00
-ffunction-sections
-fdata-sections
2021-03-04 22:14:31 +01:00
-funroll-loops
-flto=thin
-fwhole-program-vtables
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
)
set(LINKER_OPTIONS
2021-03-13 11:56:40 +01:00
-Wl,--sort-common,--as-needed,--gc-sections,--strip-all
-s
2021-03-04 22:14:31 +01:00
-stdlib=libc++
-flto=thin
-fwhole-program-vtables
-fuse-ld=gold
)
set(LINKER_FLAGS
jemalloc
OpenMP::OpenMP_CXX
)
add_subdirectory(external/frozen EXCLUDE_FROM_ALL)
target_compile_definitions(frozen INTERFACE ${COMPILE_DEFINITIONS})
target_compile_options(frozen INTERFACE ${COMPILE_FLAGS})
target_link_options(frozen INTERFACE ${LINKER_OPTIONS})
2021-03-11 17:41:48 +01:00
target_link_libraries(frozen INTERFACE ${Boost_LIBRARIES} jemalloc)
2021-03-04 22:14:31 +01:00
add_executable(GTA_SA_cheat main.cpp)
target_compile_definitions(GTA_SA_cheat PRIVATE ${COMPILE_DEFINITIONS})
target_compile_options(GTA_SA_cheat PRIVATE ${COMPILE_FLAGS})
target_link_options(GTA_SA_cheat PRIVATE ${LINKER_OPTIONS})
2021-03-11 17:41:48 +01:00
target_link_libraries(GTA_SA_cheat ${LINKER_FLAGS} ${Boost_LIBRARIES} frozen)