-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
62 lines (52 loc) · 2.48 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
# NOTE:
# To build any numpyeigen project you need a Python interpreter installed as well as numpy and scipy
# To determine the paths to build against, numpyeigen will run `python` in the terminal, to build
# against different versions of Python/Numpy than the system default, we recommend building inside a
# virtualenv or Conda environment.
cmake_minimum_required(VERSION 3.2)
project(libtemplate)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE "Release")
set(NPE_PYTHON_VERSION 3.7)
# set(NPE_PYTHON_EXECUTABLE /Applications/Blender.app/Contents/Resources/2.83/python/bin/python3.7m)
# set(PYTHON_LIBRARY /Applications/Blender.app/Contents/Resources/2.83/python/lib/python3.7)
# Pointers to important directories
set(EXTERNAL_DEP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external) # Directory for external modules
set(CMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # Directory for cmake scripts
# Download NumpyEigen if we haven't already
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(DownloadProject)
# Include numpyeigen's cmake directory
download_project(
PROJ numpyeigen
SOURCE_DIR ${EXTERNAL_DEP_DIR}/numpyeigen
DOWNLOAD_DIR ${EXTERNAL_DEP_DIR}/.cache/numpyeigen
QUIET
GIT_REPOSITORY https://github.com/fwilliams/numpyeigen.git
GIT_TAG master
)
list(APPEND CMAKE_MODULE_PATH ${EXTERNAL_DEP_DIR}/numpyeigen/cmake)
include(numpyeigen)
download_project(
PROJ libigl
SOURCE_DIR ${EXTERNAL_DEP_DIR}/libigl
DOWNLOAD_DIR ${EXTERNAL_DEP_DIR}/.cache/libigl
QUIET
GIT_REPOSITORY https://github.com/libigl/libigl
GIT_TAG main
)
list(APPEND CMAKE_MODULE_PATH ${EXTERNAL_DEP_DIR}/libigl/cmake)
include(libigl)
# This creates a CMake target representing an importable python module.
# The first argument is the name of the target (in this case `npe_example`).
# It is also the name of the Python module (i.e. `import npe_example` in Python)
# The files specified after BINDING_SOURCES are the source files containing numpyeigen bindings
npe_add_module(libtemplate
BINDING_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/example.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/igl_example.cpp)
# Use SSE2 instructions
set_target_properties(libtemplate PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -msse2")
# The target generated by `npe_add_module` is like any other CMake target. You can add include files and link libraries.
# target_include_directories(libtemplate PUBLIC example/path/to/include)
target_link_libraries(libtemplate PRIVATE igl::core)