-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
41 lines (40 loc) · 1.51 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.11)
project(ortools-rte)
include(FetchContent)
function(set_if_not_defined var default_value)
if(NOT DEFINED ${var})
set(${var} ${default_value} CACHE INTERNAL "")
endif()
endfunction()
if (NOT DEFINED ortools_REPO)
message(FATAL_ERROR "ortools_REPO is not defined")
endif ()
if (NOT DEFINED ortools_REF)
message(FATAL_ERROR "ortools_REF is not defined")
endif ()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
message("found PYTHON interpreter ${Python_EXECUTABLE} = " ${Python_EXECUTABLE})
FetchContent_Declare(ortools
GIT_REPOSITORY ${ortools_REPO}
GIT_TAG ${ortools_REF}
PATCH_COMMAND cp -rf
${CMAKE_CURRENT_SOURCE_DIR}/patch.py
${CMAKE_CURRENT_SOURCE_DIR}/patch_utils.py
${CMAKE_CURRENT_SOURCE_DIR}/ortools
${CMAKE_CURRENT_SOURCE_DIR}/cmake_patches
. && ${Python3_EXECUTABLE} patch.py
OVERRIDE_FIND_PACKAGE ON
)
message("BUILD_DEPS: " ${BUILD_DEPS})
set_if_not_defined(BUILD_DEPS "ON" CACHE INTERNAL "")
set_if_not_defined(BUILD_SAMPLES "OFF" CACHE INTERNAL "")
set_if_not_defined(BUILD_FLATZINC "OFF" CACHE INTERNAL "")
set_if_not_defined(BUILD_EXAMPLES "OFF" CACHE INTERNAL "")
set_if_not_defined(USE_SCIP "ON" CACHE INTERNAL "")
set_if_not_defined(USE_GLPK "ON" CACHE INTERNAL "")
set_if_not_defined(USE_SIRIUS "OFF" CACHE INTERNAL "")
FetchContent_MakeAvailable(ortools)
find_package(ortools REQUIRED)
add_custom_target(ortools-rte
DEPENDS ortools
)