-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
52 lines (44 loc) · 2.08 KB
/
Copy pathCMakeLists.txt
File metadata and controls
52 lines (44 loc) · 2.08 KB
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
# ----- Requirements -------------------------------------------------------- #
# If it's not being called by the umbrella, we need to
# look for the system-installed libraries.
if (NOT hasParent)
# Blocks
find_package(SMS++)
# Solvers
find_package(BundleSolver)
find_package(MILPSolver)
endif ()
# Skip the suite if some module its labels declare is not in the build
smspp_require_labelled_modules()
# ----- Tests --------------------------------------------------------------- #
add_executable(PolyhedralFunctionBlock_test test.cpp ../common_utils.cpp)
target_include_directories(PolyhedralFunctionBlock_test PRIVATE ..)
target_link_libraries(PolyhedralFunctionBlock_test PRIVATE SMS++::SMS++)
if (TARGET SMS++::BundleSolver)
target_link_libraries(PolyhedralFunctionBlock_test PRIVATE SMS++::BundleSolver)
endif ()
if (TARGET SMS++::MILPSolver)
target_link_libraries(PolyhedralFunctionBlock_test PRIVATE SMS++::MILPSolver)
endif ()
smspp_install(PolyhedralFunctionBlock_test)
# Add a test for each batch file
file(GLOB BATCH_FILES "${CMAKE_CURRENT_SOURCE_DIR}/batch")
foreach (BATCH_FILE ${BATCH_FILES})
# Remove the source directory prefix to get the batch name
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" BATCH_NAME ${BATCH_FILE})
if (UNIX)
add_test(NAME PolyhedralFunctionBlock_test/${BATCH_NAME}
COMMAND bash ${BATCH_FILE} ${CMAKE_CURRENT_BINARY_DIR}/PolyhedralFunctionBlock_test
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
elseif (WIN32)
add_test(NAME PolyhedralFunctionBlock_test/${BATCH_NAME}
# using Git for Windows that includes Git Bash
COMMAND "C:/Program Files/Git/bin/bash.exe"
"${BATCH_FILE}" "$<TARGET_FILE:PolyhedralFunctionBlock_test>"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif ()
endforeach ()
# Tag this directory's tests with their per-module CI labels
# (the label map lives in cmake/TestLabels.cmake).
smspp_label_tests()
# --------------------------------------------------------------------------- #