This repository has been archived by the owner on Jun 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
53 lines (44 loc) · 1.98 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
cmake_minimum_required(VERSION 3.16)
project(software-challenge-2022)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 20)
if(WIN32)
set(CMAKE_CXX_FLAGS_RELEASE "/DNDEBUG /O2 /D_WIN32_WINNT=0x0A00")
set(CMAKE_CXX_FLAGS_DEBUG "/Zi /Od /D_WIN32_WINNT=0x0A00")
add_subdirectory(pugixml)
set(BOOST_ROOT "C:\\local\\boost_1_74_0")
set(Boost_LIBRARY_DIR "C:\\local\\boost_1_74_0\\lib64-msvc-14.2")
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIR})
else()
set(RELEASE_FLAGS "-DNDEBUG -O2 -march=broadwell")
set(DEBUG_FLAGS "-g3 -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE-GEN "${RELEASE_FLAGS} -fprofile-generate")
set(CMAKE_CXX_FLAGS_RELEASE-USE "${RELEASE_FLAGS} -fprofile-use")
set(CMAKE_CXX_FLAGS_DEBUG "${DEBUG_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG-COVERAGE "${DEBUG_FLAGS} --coverage")
if(CMAKE_BUILD_TYPE EQUAL "DEBUG")
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE include-what-you-use)
endif()
find_library(pugixmlpath NAMES libpugixml.a libpugixml.so)
add_library(pugixml STATIC IMPORTED)
set_target_properties(pugixml PROPERTIES IMPORTED_LOCATION ${pugixmlpath})
endif()
add_executable(main src/main.cpp src/alphabeta.cpp src/evaluation.cpp src/gamestate.cpp src/network.cpp src/parser.cpp src/transpositiontable.cpp)
target_link_libraries(main pugixml)
if(NOT WIN32)
target_link_libraries(main pthread)
endif()
if(NOT WIN32)
add_executable(bench utils/bench.cpp src/alphabeta.cpp src/evaluation.cpp src/gamestate.cpp src/transpositiontable.cpp)
target_link_libraries(bench benchmark)
set_target_properties(bench PROPERTIES COMPILE_FLAGS -fno-access-control)
endif()
add_executable(tune utils/tune.cpp src/gamestate.cpp)
target_link_libraries(tune cblas gsl)
if(NOT WIN32)
set_target_properties(tune PROPERTIES COMPILE_FLAGS -fopenmp)
set_target_properties(tune PROPERTIES LINK_FLAGS -fopenmp)
endif()