-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
130 lines (117 loc) · 3.12 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
cmake_minimum_required(VERSION 3.17.0)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
project(yams LANGUAGES CXX)
#
# c++ conf
#
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# #
include(GNUInstallDirs)
message("-- CMake install prefix: " ${CMAKE_INSTALL_PREFIX})
message(" -> binaries: " ${CMAKE_INSTALL_BINDIR})
message(" -> libs: " ${CMAKE_INSTALL_LIBDIR})
message(" -> includes: " ${CMAKE_INSTALL_INCLUDEDIR})
#
# set output dirs (vs is a pain)
#
function(SET_OUT_DIR REQUIRED_ARG)
list(GET ARGV 0 TARGET_NAME)
list(GET ARGV 1 OUT_DIR)
message(${TARGET_NAME})
message(${OUT_DIR})
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
set_property(TARGET ${TARGET_NAME} PROPERTY RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUT_DIR} )
set_property(TARGET ${TARGET_NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUT_DIR} )
set_property(TARGET ${TARGET_NAME} PROPERTY ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUT_DIR} )
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
endfunction()
# Paths
file(TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} lib_dir)
file(TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} bin_dir)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
include_directories(${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/gbs)
link_directories(${lib_dir})
link_directories(${bin_dir})
# Eigen
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
include_directories(${EIGEN3_INCLUDE_DIR})
# libIGES
include_directories(${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/iges/)
#
# xtensors
#
set(XTENSOR_USE_XSIMD BOOL:ON)
find_package(xtl REQUIRED)
find_package(xtensor REQUIRED)
find_package(xsimd REQUIRED)
add_definitions(-DXTENSOR_USE_XSIMD)
# # Python Dev
# find_package (
# Python3 COMPONENTS
# Interpreter
# # Development
# )
# message("Python3_SITELIB:" ${Python3_SITELIB})
#
# VTK
#
find_package(
VTK REQUIRED
COMPONENTS
CommonCore
CommonColor
CommonDataModel
FiltersSources
InteractionStyle
RenderingCore
RenderingAnnotation
RenderingFreeType
IOXML
ChartsCore
InteractionStyle
RenderingContext2D
RenderingContextOpenGL2
RenderingCore
RenderingFreeType
ViewsContext2D
RenderingOpenGL2
Python
WrappingPythonCore
)
# NLopt
find_package(NLopt REQUIRED)
if(LINUX)
# add_definitions(-D__TBB_show_deprecation_message_task_H))
find_package(TBB REQUIRED)
endif()
if(${BUILD_TESTS})
add_subdirectory(tests)
endif()
if(${BUILD_PYTHON_BINDING})
add_subdirectory(python)
endif()
add_executable(
yams MACOSX_BUNDLE
yams.cpp
)
target_link_libraries(
yams
NLopt::nlopt
${VTK_LIBRARIES}
xtensor
xtensor::optimize
xtensor::use_xsimd
gbs-render
iges
TBB::tbb
)
vtk_module_autoinit(
TARGETS yams
MODULES ${VTK_LIBRARIES}
)
install(TARGETS yams)