-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
66 lines (52 loc) · 1.92 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
# CHECK CMAKE VERSION
cmake_minimum_required(VERSION 2.8)
# SPECIFY PROJECT NAME
project(K_ADAPTABILITY)
# SPECIFY SOURCE FILES (.CPP, .C)
set(SOURCE_FILES
./src/uncertainty.cpp
./src/problemInfo.cpp
./src/problemInfo_knp.cpp
./src/problemInfo_spp.cpp
./src/problemInfo_psp.cpp
./src/indexingTools.cpp
./src/robustSolver.cpp
./src/test.cpp
)
# SPECIFY CUSTOM HEADER FILE DIRECTORIES (OR SET "DEFAULT" IF NONE)
set(HDRDIR ./inc)
# SPECIFY NAME OF EXECUTABLE
set(EXEC kadaptability)
# SET COMPILER DIRECTORY (OR SET "DEFAULT")
set(COMPILER_DIR /usr/local/bin/g++)
# SET CPLEX DIRECTORY
set(CPLEX_DIR /opt/ibm/ILOG/CPLEX_Studio127)
# CHECK OS
if(APPLE)
set(mySystem "osx")
elseif(UNIX)
set(mySystem "linux")
else()
message(FATAL_ERROR "ONLY UNIX IS SUPPORTED AT THIS TIME")
endif()
# SET COMPILER DIRECTORY
if(NOT "${COMPILER_DIR}" STREQUAL "DEFAULT")
set(CMAKE_CXX_COMPILER ${COMPILER_DIR})
endif()
# SET COMPILER FLAGS
set(COMP_FLAGS_DEBUG " -g -std=c++14 -m64 -O0 -DIL_STD -pthread -D_GLIBCXX_DEBUG -Wall -Wextra -fPIC -fno-strict-aliasing -fexceptions")
set(COMP_FLAGS_RELEASE " -std=c++14 -m64 -O2 -DIL_STD -pthread -DNDEBUG -Wall -Wextra -fPIC -fno-strict-aliasing -fexceptions")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${COMP_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} ${COMP_FLAGS_RELEASE}")
# SET INCLUDE DIRECTORIES (.h .hpp)
include_directories(${EXEC} ${CPLEX_DIR}/cplex/include ${CPLEX_DIR}/concert/include)
# INCLUDE THE CUSTOM INC DIRECTORIES IF DEFINED
if(NOT "${HDRDIR}" STREQUAL "DEFAULT")
include_directories(${EXEX} ${HDRDIR})
endif()
# SET LINK DIRECTORIES
link_directories(${CPLEX_DIR}/cplex/lib/x86-64_${mySystem}/static_pic ${CPLEX_DIR}/concert/lib/x86-64_${mySystem}/static_pic)
# CREATE THE TARGET (executable or library)
add_executable(${EXEC} ${SOURCE_FILES})
# LINK THE DESIRED LIBRARIES
target_link_libraries(${EXEC} concert ilocplex cplex m pthread)