GTA_SA_cheat/CMakeLists.txt
2021-03-04 22:14:31 +01:00

57 lines
1.3 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=skylake # change to native or your architecture.
-mtune=skylake # same as above
-mrdseed # be careful about this, this is linked to the x86 architecture.
-mrdrnd # same as above
-stdlib=libc++
-Wpedantic
-Wall
-Wextra
-Wmove
-Wopenmp
-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
-stdlib=libc++
-flto=thin
-fwhole-program-vtables
-fuse-ld=gold
)
set(LINKER_FLAGS
jemalloc
${Boost_LIBRARIES}
OpenMP::OpenMP_CXX
)
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 ${Boost_LIBRARIES})