-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (53 loc) · 2.02 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
54
55
56
57
58
59
60
61
62
63
64
65
66
cmake_policy(SET CMP0048 NEW)
cmake_minimum_required( VERSION 3.18 )
project( Moinsen VERSION 0.1.0 LANGUAGES CXX )
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/libchess/src/" )
add_library(libchess STATIC IMPORTED)
if (MSVC)
set_target_properties(libchess PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/libchess/build/static/Release/chess.lib"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/libchess/src/")
else()
set_target_properties(libchess PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/libchess/build/static/libchess.a"
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/libchess/src/")
endif()
find_package (Threads)
include(CMakeBaseFiles.txt)
if (UNIX)
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wshadow -pedantic -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wnull-dereference -Wuseless-cast -Wdouble-promotion -Wformat=2 -Werror")
endif()
add_executable(
${PROJECT_NAME}
src/moinsen.cpp
src/benchmark.cpp
${SRC_FILES}
)
target_link_libraries( ${PROJECT_NAME} libchess Threads::Threads)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_SEARCH_START_STATIC ON)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_SEARCH_END_STATIC ON)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
target_link_options(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++ -static)
add_executable(
test-${PROJECT_NAME}
tests/koth.cpp
tests/main.cpp
tests/movetime.cpp
tests/phasedScore.cpp
tests/position.cpp
tests/search.cpp
tests/threecheck.cpp
${SRC_FILES}
)
target_link_libraries( test-${PROJECT_NAME} PRIVATE libchess Threads::Threads)
add_executable(
tune-${PROJECT_NAME}
src/tune.cpp
${SRC_FILES}
)
target_link_libraries( tune-${PROJECT_NAME} PRIVATE libchess Threads::Threads "-ltbb")
include(CTest)
add_test(NAME Tests
COMMAND $<TARGET_FILE:test-${PROJECT_NAME}>
WORKING_DIRECTORY ${BUILD_RPATH}
)