-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·111 lines (93 loc) · 3.6 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
101
102
103
104
105
106
107
108
109
110
111
CMAKE_MINIMUM_REQUIRED(VERSION 3.1.3)
PROJECT(go-ipopt C CXX)
# Set build type
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
OPTION(FLYWAVE_ENABLE_SOLUTION_FOLDERS "Build with UBSAN" ON)
if(FLYWAVE_ENABLE_SOLUTION_FOLDERS)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
SET_PROPERTY(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
endif()
# Unix specific options
IF(UNIX OR APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall")
ENDIF()
# CXX_STANDARD
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
IF(UNIX)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
ENDIF()
ENDIF()
Set(FLYWAVE_BASE_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)
IF(APPLE)
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
SET(FLYWAVE_LIBRARY_OUTPUT_PATH "${FLYWAVE_BASE_INSTALL_DIR}/darwin_arm")
else()
SET(FLYWAVE_LIBRARY_OUTPUT_PATH "${FLYWAVE_BASE_INSTALL_DIR}/darwin")
endif()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14")
ELSEIF(WIN32)
SET(FLYWAVE_LIBRARY_OUTPUT_PATH "${FLYWAVE_BASE_INSTALL_DIR}/windows")
ELSE()
SET(FLYWAVE_LIBRARY_OUTPUT_PATH "${FLYWAVE_BASE_INSTALL_DIR}/linux")
ENDIF()
MAKE_DIRECTORY(${FLYWAVE_LIBRARY_OUTPUT_PATH})
SET(FLYWAVE_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}")
SET(FLYWAVE_LIBRARY_DIRS "")
# Ipopt
IF(NOT IPOPT_INCLUDE)
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/external/Ipopt")
LIST(APPEND FLYWAVE_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/external/Ipopt/src/Interfaces/")
LIST(APPEND FLYWAVE_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/Ipopt/src/Interfaces/")
LIST(APPEND FLYWAVE_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/Ipopt/src/Common/")
LIST(APPEND FLYWAVE_LIBRARY_DIRS "${CMAKE_CURRENT_BINARY_DIR}/external/Ipopt/src/")
LIST(APPEND FLYWAVE_LIBRARY_DEPES "ipopt")
SET(IPOPT_INCLUDE YES)
ENDIF()
# LAPACK
IF(NOT LAPACK_INCLUDE)
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/external/lapack/")
LIST(APPEND FLYWAVE_LIBRARY_DIRS "${CMAKE_CURRENT_BINARY_DIR}/external/lapack/BLAS/SRC/")
LIST(APPEND FLYWAVE_LIBRARY_DIRS "${CMAKE_CURRENT_BINARY_DIR}/external/lapack/SRC/")
LIST(APPEND FLYWAVE_LIBRARY_DEPES "lapack" "blas" "gfortran")
SET(LAPACK_INCLUDE YES)
ENDIF()
# Ma27
IF(NOT MA27_INCLUDE)
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/external/ma27")
LIST(APPEND FLYWAVE_LIBRARY_DIRS "${CMAKE_CURRENT_BINARY_DIR}/external/ma27/")
LIST(APPEND FLYWAVE_LIBRARY_DEPES "ma27")
SET(MA27_INCLUDE YES)
ENDIF()
# Metis
IF(NOT METIS_INCLUDE)
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/external/metis")
LIST(APPEND FLYWAVE_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/metis/include/")
LIST(APPEND FLYWAVE_LIBRARY_DIRS "${CMAKE_CURRENT_BINARY_DIR}/external/metis/libmetis/")
LIST(APPEND FLYWAVE_LIBRARY_DEPES "metis")
SET(METIS_INCLUDE YES)
ENDIF()
LIST(APPEND FLYWAVE_LIBRARY_DIRS "${CMAKE_CURRENT_BINARY_DIR}/src/")
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/src")
foreach(LIBDIR ${FLYWAVE_LIBRARY_DIRS})
INSTALL(
DIRECTORY ${LIBDIR}
DESTINATION ${FLYWAVE_LIBRARY_OUTPUT_PATH}
USE_SOURCE_PERMISSIONS FILE_PERMISSIONS
FILES_MATCHING PATTERN "*.a"
)
endforeach()
INSTALL(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/"
DESTINATION ${FLYWAVE_BASE_INSTALL_DIR}
USE_SOURCE_PERMISSIONS FILE_PERMISSIONS
FILES_MATCHING PATTERN "*.h"
)