-
Notifications
You must be signed in to change notification settings - Fork 17
/
CMakeLists.txt
166 lines (148 loc) · 5.62 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
cmake_minimum_required(VERSION 3.6)
project(LibQPEP)
include(LibQPEP-basics.cmake)
set(srcs
generateProjectedPoints.cpp
pnp_WQD.cpp
solver_WQ_1_2_3_4_5_9_13_17_33_49_approx.cpp
QPEP_grobner.cpp
misc_pnp_funcs.cpp
QPEP_lm_single.cpp
misc_pTop_funcs.cpp
misc_hand_eye_funcs.cpp
pTop_WQD.cpp
hand_eye_WQD.cpp
hand_eye_small_rotation.cpp
pTop_small_rotation.cpp
solver_WQ_approx_helper.cpp
solver_WQ_1_2_3_4_5_9_13_17_33_49_approx_helper.cpp
solver_WQ_approx.cpp
solver_WQ.cpp
solver_WQ_helper.cpp
CVLib.cpp
./csdp/lib/Fnorm.c
./csdp/lib/chol.c
./csdp/lib/linesearch.c
./csdp/lib/norms.c
./csdp/lib/qreig.c
./csdp/lib/sym_mat.c
./csdp/lib/zero_mat.c
./csdp/lib/add_mat.c
./csdp/lib/copy_mat.c
./csdp/lib/make_i.c
./csdp/lib/op_a.c
./csdp/lib/readprob.c
./csdp/lib/trace_prod.c
./csdp/lib/addscaledmat.c
./csdp/lib/easysdp.c
./csdp/lib/makefill.c
./csdp/lib/op_at.c
./csdp/lib/readsol.c
./csdp/lib/tweakgap.c
./csdp/lib/allocmat.c
./csdp/lib/freeprob.c
./csdp/lib/mat_mult.c
./csdp/lib/op_o.c
./csdp/lib/sdp.c
./csdp/lib/user_exit.c
./csdp/lib/calc_dobj.c
./csdp/lib/initparams.c
./csdp/lib/mat_multsp.c
./csdp/lib/packed.c
./csdp/lib/solvesys.c
./csdp/lib/writeprob.c
./csdp/lib/calc_pobj.c
./csdp/lib/initsoln.c
./csdp/lib/matvec.c
./csdp/lib/psd_feas.c
./csdp/lib/sortentries.c
./csdp/lib/writesol.c
CovEstimation.cpp
utils.cpp
)
set(incs
generateProjectedPoints.h
pnp_WQD.h
solver_WQ_1_2_3_4_5_9_13_17_33_49_approx.h
solver_WQ_1_2_3_4_5_9_13_17_33_49_approx_helper.h
QPEP_grobner.h
utils.h
misc_pnp_funcs.h
QPEP_lm_single.h
pTop_WQD.h
hand_eye_WQD.h
hand_eye_small_rotation.h
pTop_small_rotation.h
misc_pTop_funcs.h
misc_hand_eye_funcs.h
solver_WQ_approx_helper.h
solver_WQ_approx.h
QPEP.h
solver_WQ.h
solver_WQ_helper.h
CVLib.h
CovEstimation.h)
include_directories(fsolve_wrapper)
add_executable(LibQPEP-test main.cpp)
add_library (LibQPEP SHARED ${srcs})
if(LINUX_OS)
if(NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armhf" AND NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l" AND NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64" AND NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
target_compile_options(LibQPEP PRIVATE -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armhf" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
target_compile_options(LibQPEP PRIVATE -mfpu=neon -mfloat-abi=hard)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
target_compile_options(LibQPEP PRIVATE -march=native)
endif()
endif()
if(NOT LINUX_OS)
find_library(CORE_GRAPHICS CoreGraphics QUIET)
target_link_libraries(LibQPEP ${OpenCV_LIBS} ${LAPACK_LIBRARIES} ${X11_LIBRARIES} ${BLAS_LIBRARIES} ${CORE_GRAPHICS})
target_link_libraries(LibQPEP-test LibQPEP ${OpenCV_LIBS} ${LAPACK_LIBRARIES} ${X11_LIBRARIES} ${BLAS_LIBRARIES})
else()
if(NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armhf" AND NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64" AND NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
target_link_libraries(LibQPEP ${OpenCV_LIBS} ${LAPACK_LIBRARIES} ${X11_LIBRARIES} ${BLAS_LIBRARIES} ${MKL_LIBS} -lX11)
target_link_libraries(LibQPEP-test LibQPEP ${OpenCV_LIBS} ${LAPACK_LIBRARIES} ${X11_LIBRARIES} ${BLAS_LIBRARIES} ${MKL_LIBS} -lX11)
else()
target_link_libraries(LibQPEP ${OpenCV_LIBS} ${LAPACK_LIBRARIES} ${X11_LIBRARIES} ${BLAS_LIBRARIES} ${OPENCL_LIBRARY} ${CUDA_CUBLAS_LIBRARIES} -lX11)
target_link_libraries(LibQPEP-test LibQPEP ${OpenCV_LIBS} ${LAPACK_LIBRARIES} ${X11_LIBRARIES} ${BLAS_LIBRARIES} ${OPENCL_LIBRARY} ${CUDA_CUBLAS_LIBRARIES} -lX11)
endif()
endif()
include(GNUInstallDirs)
install(TARGETS LibQPEP
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/../lib/
)
if(LINUX_OS)
INSTALL(CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
${CMAKE_INSTALL_PREFIX}/lib/libLibQPEP.so \
${CMAKE_INSTALL_PREFIX}/lib/libLibQPEP.a \
)"
)
endif()
install(FILES ${incs} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
export(
TARGETS LibQPEP
FILE ${PROJECT_NAME}-config.cmake
)
install(
EXPORT ${PROJECT_NAME}-config
DESTINATION share/${PROJECT_NAME}/cmake
)
# Create variable for the local build tree
get_property(CONF_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
# Create variable with the library location
set(QPEP_LIB ${PROJECT_NAME})
# Configure config file for local build tree
configure_file(${PROJECT_NAME}Config.cmake.in
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @ONLY)
# 2- installation build #
# Change the include location for the case of an install location
set(CONF_INCLUDE_DIRS ${INSTALL_INCLUDE_DIR} ${CONF_INCLUDE_DIRS} )
configure_file(${PROJECT_NAME}Config.cmake.in
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake" @ONLY)
install (
FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${PROJECT_NAME}Config.cmake"
DESTINATION "share/${PROJECT_NAME}/cmake/"
)