1 | option(BUILD_SHARED_LIBS "Build shared version of the library" ON)
|
---|
2 | option(Boost_USE_STATIC_LIBS "Use static version of Boost" OFF)
|
---|
3 |
|
---|
4 | if(WIN32)
|
---|
5 | add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -D_WIN32_WINNT=0x0501)
|
---|
6 | endif()
|
---|
7 |
|
---|
8 | if(UNIX AND NOT APPLE)
|
---|
9 | if(Boost_USE_STATIC_LIBS)
|
---|
10 | set(ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
---|
11 | set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
|
---|
12 | endif()
|
---|
13 |
|
---|
14 | find_library(RT_LIBRARY rt)
|
---|
15 |
|
---|
16 | if(Boost_USE_STATIC_LIBS)
|
---|
17 | set(CMAKE_FIND_LIBRARY_SUFFIXES ${ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
---|
18 | endif()
|
---|
19 |
|
---|
20 | mark_as_advanced(RT_LIBRARY)
|
---|
21 | add_definitions(-DHAVE_LIBRT)
|
---|
22 | endif()
|
---|
23 |
|
---|
24 | find_package(Boost COMPONENTS date_time program_options serialization system thread REQUIRED)
|
---|
25 | find_package(Eigen REQUIRED)
|
---|
26 | find_package(Threads REQUIRED)
|
---|
27 |
|
---|
28 | set(Boost_INCLUDE_DIRS "${Boost_INCLUDE_DIRS}" PARENT_SCOPE)
|
---|
29 | set(Boost_LIBRARY_DIRS "${Boost_LIBRARY_DIRS}" PARENT_SCOPE)
|
---|
30 | set(Boost_USE_STATIC_LIBS "${Boost_USE_STATIC_LIBS}" PARENT_SCOPE)
|
---|
31 |
|
---|
32 | include(GenerateExportHeader)
|
---|
33 |
|
---|
34 | add_compiler_export_flags()
|
---|
35 |
|
---|
36 | add_library(3dv device.cc error.cc ipm.cc pose_utils.cc detail/device_impl.cc)
|
---|
37 |
|
---|
38 | include_directories(${Boost_INCLUDE_DIR} ${EIGEN_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})
|
---|
39 |
|
---|
40 | target_link_libraries(3dv
|
---|
41 | ${Boost_DATE_TIME_LIBRARY}
|
---|
42 | ${Boost_PROGRAM_OPTIONS_LIBRARY}
|
---|
43 | ${Boost_SERIALIZATION_LIBRARY}
|
---|
44 | ${Boost_SYSTEM_LIBRARY}
|
---|
45 | ${Boost_THREAD_LIBRARY}
|
---|
46 | ${CMAKE_THREAD_LIBS_INIT}
|
---|
47 | ${RT_LIBRARY})
|
---|
48 |
|
---|
49 | set_target_properties(3dv PROPERTIES DEFINE_SYMBOL _3dv)
|
---|
50 | generate_export_header(3dv BASE_NAME LIB3DV EXPORT_FILE_NAME 3dv_export.h)
|
---|
51 |
|
---|
52 | file(COPY
|
---|
53 | ${CMAKE_CURRENT_BINARY_DIR}/3dv_export.h
|
---|
54 | DESTINATION
|
---|
55 | ${PROJECT_SOURCE_DIR}/lib3dv)
|
---|
56 |
|
---|
57 | configure_file(version.h.in ${PROJECT_SOURCE_DIR}/lib3dv/version.h)
|
---|
58 |
|
---|
59 | export(TARGETS 3dv FILE "${PROJECT_BINARY_DIR}/Lib3DVTargets.cmake")
|
---|
60 | install(TARGETS 3dv EXPORT Lib3DVTargets DESTINATION ${LIBRARY_INSTALL_DIR})
|
---|
61 |
|
---|
62 | install(FILES
|
---|
63 | 3dv.h
|
---|
64 | calibration.h
|
---|
65 | device.h
|
---|
66 | error.h
|
---|
67 | image.h
|
---|
68 | ipm.h
|
---|
69 | obstacle.h
|
---|
70 | point.h
|
---|
71 | stixel.h
|
---|
72 | terrain.h
|
---|
73 | motion.h
|
---|
74 | pose.h
|
---|
75 | pose_utils.h
|
---|
76 | candidate.h
|
---|
77 | classification.h
|
---|
78 | version.h
|
---|
79 | ${PROJECT_BINARY_DIR}/lib3dv/3dv_export.h
|
---|
80 | DESTINATION ${INCLUDE_INSTALL_DIR})
|
---|