source: pacpussensors/trunk/Vislab/lib3dv/CMakeLists.txt@ 141

Last change on this file since 141 was 136, checked in by ldecherf, 8 years ago

Doc

File size: 2.3 KB
Line 
1option(BUILD_SHARED_LIBS "Build shared version of the library" ON)
2option(Boost_USE_STATIC_LIBS "Use static version of Boost" OFF)
3
4if(WIN32)
5 add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -D_WIN32_WINNT=0x0501)
6endif()
7
8if(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)
22endif()
23
24find_package(Boost COMPONENTS date_time program_options serialization system thread REQUIRED)
25find_package(Eigen REQUIRED)
26find_package(Threads REQUIRED)
27
28set(Boost_INCLUDE_DIRS "${Boost_INCLUDE_DIRS}" PARENT_SCOPE)
29set(Boost_LIBRARY_DIRS "${Boost_LIBRARY_DIRS}" PARENT_SCOPE)
30set(Boost_USE_STATIC_LIBS "${Boost_USE_STATIC_LIBS}" PARENT_SCOPE)
31
32include(GenerateExportHeader)
33
34add_compiler_export_flags()
35
36add_library(3dv device.cc error.cc ipm.cc pose_utils.cc detail/device_impl.cc)
37
38include_directories(${Boost_INCLUDE_DIR} ${EIGEN_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})
39
40target_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
49set_target_properties(3dv PROPERTIES DEFINE_SYMBOL _3dv)
50generate_export_header(3dv BASE_NAME LIB3DV EXPORT_FILE_NAME 3dv_export.h)
51
52file(COPY
53 ${CMAKE_CURRENT_BINARY_DIR}/3dv_export.h
54 DESTINATION
55 ${PROJECT_SOURCE_DIR}/lib3dv)
56
57configure_file(version.h.in ${PROJECT_SOURCE_DIR}/lib3dv/version.h)
58
59export(TARGETS 3dv FILE "${PROJECT_BINARY_DIR}/Lib3DVTargets.cmake")
60install(TARGETS 3dv EXPORT Lib3DVTargets DESTINATION ${LIBRARY_INSTALL_DIR})
61
62install(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})
Note: See TracBrowser for help on using the repository browser.