-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
72 lines (59 loc) · 2.25 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
67
68
69
70
71
72
cmake_minimum_required (VERSION 3.0 FATAL_ERROR)
# Script directory.
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Scripts)
# Include necessary utility scripts.
include(CheckCXX11)
include(Utils)
# Enable LTO
set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE 1)
set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO 1)
# Find Boost library.
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED COMPONENTS
program_options
)
# Find glog library.
find_non_standard_package(Folly REQUIRED)
# Find glog library.
find_non_standard_package(Glog REQUIRED)
# Find gtest library.
find_package(GTest REQUIRED)
# Add common include directories.
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
include_directories(${Folly_INCLUDE_DIRS})
include_directories(${Glog_INCLUDE_DIRS})
include_directories(${GTEST_INCLUDE_DIRS})
# Link to those common libraries.
macro(add_solver_executable NAME)
# invoke built-in add_executable
add_executable(${ARGV})
if (TARGET ${NAME})
get_target_property(__tmp_IS_TARGET_IMPORTED ${NAME} IMPORTED)
if (NOT ${__tmp_IS_TARGET_IMPORTED})
# Make the executable name shorter.
split_string(${NAME} "-" __tmp_SPLITTED_NAME)
list(GET __tmp_SPLITTED_NAME -1 __tmp_EXECUTABLE_NAME)
set_target_properties(${NAME} PROPERTIES OUTPUT_NAME ${__tmp_EXECUTABLE_NAME})
# Link to necessary libraries.
target_link_libraries(${NAME} Runner)
target_link_libraries(${NAME} Runner-Main)
endif()
endif()
endmacro()
# Test by running and comparing results.
macro(add_solver_test TARGET NAME INPUT OUTPUT SPECS)
add_test(NAME Test-${TARGET}-${NAME}-Run
COMMAND $<TARGET_FILE:${TARGET}> --input ${CMAKE_CURRENT_SOURCE_DIR}/${INPUT} --output ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT})
add_test(NAME Test-${TARGET}-${NAME}-Compare
COMMAND $<TARGET_FILE:OutputCompareTest> --expected ${CMAKE_CURRENT_SOURCE_DIR}/${OUTPUT} --actual ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT} --specs ${SPECS})
endmacro()
# Add the top of source tree as the include path.
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR})
enable_testing()
add_subdirectory(Common)
add_subdirectory(Runner)
add_subdirectory(Testing)
add_subdirectory(2008)
add_subdirectory(2013)
add_subdirectory(2014)