-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
77 lines (60 loc) · 2.84 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
73
74
75
76
77
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 11)
project(Timetabler LANGUAGES CXX)
include(TimetablerVersion.cmake)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-parentheses -Wno-misleading-indentation -Wpedantic")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTIMETABLERDEBUG")
set(OPEN_WBO_PATH "${CMAKE_SOURCE_DIR}/dependencies/open-wbo" CACHE PATH "Open-WBO path")
set(YAML_CPP_PATH "${CMAKE_SOURCE_DIR}/dependencies/yaml-cpp" CACHE PATH "YAML CPP path")
set(CSVPARSER_PATH "${CMAKE_SOURCE_DIR}/dependencies/CSVparser" CACHE PATH "CSVParser path")
set(PEGTL_PATH "${CMAKE_SOURCE_DIR}/dependencies/PEGTL" CACHE PATH "PEGTL path")
set(ENABLE_TESTS "OFF" CACHE BOOL "Enable Google tests")
set(GTEST_PATH "${CMAKE_SOURCE_DIR}/dependencies/googletest-release-1.8.1" CACHE PATH "GTest path")
if (EXISTS ${GTEST_PATH})
set(ENABLE_TESTS "ON")
endif ()
include_directories(include)
include_directories(${OPEN_WBO_PATH})
include_directories(${OPEN_WBO_PATH}/solvers/glucose4.1)
include_directories(${YAML_CPP_PATH}/include)
include_directories(${CSVPARSER_PATH})
include_directories(${PEGTL_PATH}/include)
if (${ENABLE_TESTS})
include_directories(${GTEST_PATH}/googletest/include)
endif ()
file(GLOB_RECURSE SOURCES "src/*.cpp")
list(APPEND SOURCES ${CSVPARSER_PATH}/CSVparser.cpp)
if (${ENABLE_TESTS})
include(GoogleTest)
enable_testing()
file(GLOB_RECURSE TEST_SOURCES "tests/*.cpp")
list(APPEND TEST_SOURCES ${SOURCES})
get_filename_component(full_path_main_cpp ${CMAKE_SOURCE_DIR}/src/main.cpp ABSOLUTE)
list(REMOVE_ITEM TEST_SOURCES "${full_path_main_cpp}")
endif ()
add_definitions(-DNSPACE=Glucose)
add_executable(timetabler ${SOURCES})
if (${ENABLE_TESTS})
add_executable(tests ${TEST_SOURCES})
endif ()
target_link_libraries(timetabler -L${OPEN_WBO_PATH} -L${YAML_CPP_PATH}/build)
target_link_libraries(timetabler -lopen-wbo -lyaml-cpp)
if (${ENABLE_TESTS})
target_link_libraries(tests -L${OPEN_WBO_PATH} -L${YAML_CPP_PATH}/build -L${GTEST_PATH}/build/googlemock/gtest)
target_link_libraries(tests -lopen-wbo -lyaml-cpp -lgtest -pthread)
endif ()
install(TARGETS timetabler DESTINATION bin)
if (${ENABLE_TESTS})
gtest_discover_tests(tests)
endif ()
set(CPACK_PACKAGE_VERSION ${Timetabler_VERSION})
SET(CPACK_GENERATOR "DEB")
SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "A highly customizable timetabling software for educational institutions that encodes timetabling constraints as a SAT formula and solves them using a MaxSAT solver")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Prateek Kumar <[email protected]>")
SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/sukrutrao/Timetabler")
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE)
set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.md)
INCLUDE(CPack)