GTA_SA_cheat/CMakeLists.txt

66 lines
1.7 KiB
CMake

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
-march=native # change to native or your architecture.
-mtune=native # same as above
-mrdseed # be careful about this, this is linked to the x86 architecture.
-mrdrnd # same as above
-stdlib=libc++
-Wpedantic
-pedantic
-Wall
-Wextra
-Wmove
-Wopenmp
-ffunction-sections
-fdata-sections
-funroll-loops
-flto=thin
-fwhole-program-vtables
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
)
set(LINKER_OPTIONS
-Wl,--sort-common,--as-needed,--gc-sections,--strip-all
-s
-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})
target_link_libraries(frozen INTERFACE ${Boost_LIBRARIES} jemalloc)
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})
target_link_libraries(GTA_SA_cheat ${LINKER_FLAGS} ${Boost_LIBRARIES} frozen)