-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
91 lines (73 loc) · 2.3 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
project(PyMongeAmpere)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
set(CMAKE_CXX_STANDARD 14)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "RELWITHDEBINFO") # RELEASE
ENDIF()
# find required python packages
## Python 2
# set (PYBIND11_PYTHON_VERSION 2.7)
## Python 3
set(PYTHON_EXECUTABLE "python3")
set(PYBIND11_PYTHON_VERSION 3.6)
set(PYBIND11_CPP_STANDARD -std=c++11)
add_subdirectory("${PROJECT_SOURCE_DIR}/thirdparty/pybind11")
# find boost
#
# set(Boost_USE_STATIC_LIBS ON)
# set(Boost_USE_MULTITHREADED ON)
# set(Boost_USE_STATIC_RUNTIME ON)
# FIND_PACKAGE(Boost COMPONENTS python REQUIRED)
# message( STATUS "found boost:"
# "\nINCLUDE: ${Boost_INCLUDE_DIRS}"
# "\nLIB: ${Boost_LIBRARIES}"
# )
# enable C++11
ADD_DEFINITIONS(-std=c++11 -pg)
# monge-ampere
# TODO: better way of detecting MongeAmpere
LIST(APPEND MONGE_AMPERE_CHECK_INCLUDE_DIRS
$ENV{MA_DIR}
${PyMongeAmpere_SOURCE_DIR}/../MongeAmpere
)
find_path(MONGE_AMPERE_DIR NAMES include/MA/quadrature.hpp
PATHS ${MONGE_AMPERE_CHECK_INCLUDE_DIRS})
IF (EXISTS ${MONGE_AMPERE_DIR})
MESSAGE(STATUS "Found MongeAmpere++ header in: ${MONGE_AMPERE_DIR}")
ELSE()
MESSAGE(FATAL_ERROR "MongeAmpere++ not found (MA_DIR=${MA_DIR}).")
ENDIF()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MONGE_AMPERE_DIR}/cmake)
INCLUDE_DIRECTORIES(${MONGE_AMPERE_DIR}/include)
# Eigen3
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
# CGAL and its components
find_package( CGAL REQUIRED)
include( ${CGAL_USE_FILE} )
LINK_LIBRARIES(${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# Update if necessary
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
FIND_PACKAGE ( X11 REQUIRED )
INCLUDE_DIRECTORIES ( ${X11_INCLUDE_DIR} )
# # SuiteSparse (optional)
# find_package(SuiteSparse)
# include_directories(${SUITESPARSE_INCLUDE_DIRS})
# link_libraries(${SUITESPARSE_LIBRARIES})
# if(SUITESPARSE_FOUND)
# add_definitions(-DMA_USE_SUITESPARSE)
# endif()
# if(SUITESPARSEQR_FOUND)
# add_definitions(-DMA_USE_SUITESPARSE_QR)
# endif()
# Intel TBB (optional)
# find_package(TBB)
# if(TBB_FOUND)
# include_directories(${TBB_INCLUDE_DIRS})
# link_libraries(${TBB_LIBRARIES})
# endif()
pybind11_add_module(MongeAmperePP SHARED MongeAmpere.cpp)
ADD_SUBDIRECTORY(examples)
ADD_SUBDIRECTORY(MongeAmpere)