-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
172 lines (144 loc) · 3.93 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
cmake_minimum_required(VERSION 3.1)
project(ARAP)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pthread -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS}")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG}")
set(Ceres_DIR "/home/maxjiang/Codes/ShapeDeform/3rd_party/ceres-solver/cmake/Ceres")
find_package(Ceres REQUIRED)
set(CERES_INCLUDE_PATH "3rd_party/ceres-solver/include")
set(IGL_INCLUDE_PATH "3rd_party/libigl/include")
set(EIGEN_INCLUDE_PATH "3rd_party/eigen")
set(CGAL_DIR "3rd_party/cgal")
IF (NOT CGAL_INCLUDE_PATH)
find_package(CGAL)
include(${CGAL_USE_FILE})
ELSE()
include_directories(${CGAL_INCLUDE_PATH})
endif()
include_directories(${CERES_INCLUDE_PATH})
include_directories(${IGL_INCLUDE_PATH})
include_directories(${EIGEN_INCLUDE_PATH})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/lib)
add_library(
deform_mesh
src/lib/delaunay.cc
src/lib/delaunay.h
src/lib/mesh.cc
src/lib/mesh.h
src/lib/subdivision.cc
src/lib/subdivision.h
src/lib/uniformgrid.cc
src/lib/uniformgrid.h
src/lib/types.h
)
target_link_libraries(
deform_mesh
${CGAL_LIBRARIES}
)
add_library(
deform_optim
src/lib/callback.h
src/lib/linear.cc
src/lib/linear.h
src/lib/deformer.cc
src/lib/deformer.h
src/lib/edgeloss.h
)
target_link_libraries(
deform_optim
${CERES_LIBRARIES}
)
add_executable(
rigid_deform
src/app/rigid_deform.cc
)
target_link_libraries(
rigid_deform
deform_mesh
deform_optim
)
add_executable(
rigid_rot_deform
src/app/rigid_rot_deform.cc
)
target_link_libraries(
rigid_rot_deform
deform_mesh
deform_optim
)
add_executable(
cad_deform
src/app/cad_deform.cc
)
target_link_libraries(
cad_deform
deform_mesh
deform_optim
)
add_executable(
coverage_deform
src/app/coverage_deform.cc
)
target_link_libraries(
coverage_deform
deform_mesh
deform_optim
)
execute_process (
COMMAND python -c "import sys; print('.'.join(sys.version.split(' (')[0].split('.')[:2]))"
OUTPUT_VARIABLE PY_VERSION
)
execute_process (
COMMAND python -c "import subprocess; print('/'.join(subprocess.check_output(['which', 'python']).decode('utf-8').split('/')[:-2]))"
OUTPUT_VARIABLE PY_BASEDIR
)
string(STRIP ${PY_VERSION} PY_VERSION)
string(STRIP ${PY_BASEDIR} PY_BASEDIR)
if(NOT TORCH_PATH)
set(TORCH_PATH "${PY_BASEDIR}/lib/python${PY_VERSION}/site-packages/torch")
message("TORCH_PATH is set default to ${TORCH_PATH}")
message('Consider to use -DTORCH_PATH your_path to specialize your path instead.')
endif()
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1››)
add_subdirectory("3rd_party/pybind11")
include_directories(${TORCH_PATH}/include)
link_directories(${TORCH_PATH}/lib)
include_directories(${TORCH_PATH}/include/torch/csrc/api/include)
add_library(
pyDeform SHARED
src/interface/deform_params.h
src/interface/deform_params.cc
src/interface/cad_layer.h
src/interface/cad_layer.cc
src/interface/distance_layer.h
src/interface/distance_layer.cc
src/interface/graph_layer.h
src/interface/graph_layer.cc
src/interface/linear_layer.h
src/interface/linear_layer.cc
src/interface/mesh_tensor.h
src/interface/mesh_tensor.cc
src/interface/normalize.h
src/interface/normalize.cc
src/interface/rigid_layer.h
src/interface/rigid_layer.cc
src/interface/pydeform.cc
)
target_link_libraries(
pyDeform
deform_mesh
deform_optim
pybind11::module
torch
)
set_target_properties(pyDeform PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}")