-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
100 lines (80 loc) · 2.87 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cmake_minimum_required(VERSION 3.11.0)
# set the project name and version
set(VIPR_VERSION_MAJOR 1)
set(VIPR_VERSION_MINOR 1)
project(VIPR VERSION ${VIPR_VERSION_MAJOR}.${VIPR_VERSION_MINOR})
# specify the C++ standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# set function visibility default to hidden
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
# path to find modules
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
# find GMP
find_package(GMP REQUIRED)
include_directories(${GMP_INCLUDE_DIRS})
include_directories(${PROJECT_BINARY_DIR})
set(libs ${libs} ${GMP_LIBRARIES})
# add executables
add_executable(viprttn viprttn.cpp)
add_executable(vipr2html vipr2html.cpp)
add_executable(viprchk viprchk.cpp)
add_executable(viprchk_parallel viprchk_parallel.cpp)
# find TBB
if(WIN32)
find_package(TBB 2021 COMPONENTS tbb tbbmalloc REQUIRED)
else()
# Utilities to automatically download missing dependencies
include(cmake/Dependencies.cmake)
find_or_download_package(
NAME TBB
VERSION 2021
URL https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.7.0.tar.gz
COMPONENTS tbb tbbmalloc
URL_HASH SHA256=2cae2a80cda7d45dc7c072e4295c675fff5ad8316691f26f40539f7e7e54c0cc
CONFIGURE_ARGS -DTBB_TEST=OFF -DTBB_EXAMPLES=OFF -DTBB4PY_BUILD=OFF)
set(libs ${libs} ${TBB_LIBRARIES})
endif()
# option to install viprcomp
option(VIPRCOMP "Use viprcomp" ON)
target_link_libraries(viprchk ${libs})
target_link_libraries(viprchk_parallel ${libs})
target_link_libraries(viprchk_parallel TBB::tbb)
set(BOOST_MIN_VERION 1.71)
if(VIPRCOMP)
find_package(Boost ${BOOST_MIN_VERION} REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()
# Only install viprcomp if working SoPlex is found
find_package(ZLIB)
if(ZLIB_FOUND)
find_package(SOPLEX)
if(SOPLEX_FOUND)
set(VIPR_HAVE_SOPLEX 1)
# include ZLIB
include_directories(${ZLIB_INCLUDE_DIRS})
set(libs ${libs} ${ZLIB_LIBRARIES})
# include SoPlex
include_directories(${SOPLEX_INCLUDE_DIRS})
set(libs ${libs} ${SOPLEX_LIBRARIES})
# add viprcomp target and link
add_executable(viprcomp viprcomp.cpp)
add_executable(viprincomp incompletify.cpp)
add_definitions(-DSOPLEX_WITH_GMP)
target_link_libraries(viprcomp ${libs})
target_link_libraries(viprincomp ${libs})
target_link_libraries(viprcomp ${libs})
target_link_libraries(viprcomp TBB::tbb)
message(STATUS "Soplex found.")
else()
message(STATUS "viprcomp not installed, because SoPlex could not be found.")
set(VIPR_HAVE_SOPLEX 0)
endif()
else()
message(STATUS "viprcomp not installed, because ZLIB could not be found (required by SoPlex).")
endif()
endif()
configure_file("${PROJECT_SOURCE_DIR}/CMakeConfig.hpp.in"
"${PROJECT_BINARY_DIR}/CMakeConfig.hpp")