-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·75 lines (59 loc) · 2.4 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
cmake_minimum_required (VERSION 2.8.8)
set(INCLUDES /usr/include/)
set(INCLUDES ${INCLUDES} /usr/include/ni/)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(AVG_PATH $ENV{AVG_PATH})
if(NOT EXISTS "${AVG_PATH}/libavg/src/api.h")
message(FATAL_ERROR "Please define the environment variable AVG_PATH to the directory containing the main libavg dir.")
endif()
if(WIN32)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${AVG_PATH}")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "../deps")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:\\gtkmm")
endif()
project (onicam)
set(PYTHON_LIBRARY "/usr/lib/libpython2.7.so")
set(PYTHON_INCLUDE_DIR "/home/richy/.virtualenvs/Archimedes/include/python2.7")
find_package(PythonLibs REQUIRED)
set(INCLUDES ${INCLUDES} ${PYTHON_INCLUDE_DIRS})
set(LIBS ${LIBS} ${PYTHON_LIBRARIES})
find_package(Boost REQUIRED COMPONENTS python thread)
set(INCLUDES ${INCLUDES} ${Boost_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Boost_LIBRARIES})
find_package(LibXml2 REQUIRED)
set(INCLUDES ${INCLUDES} ${LIBXML2_INCLUDE_DIR})
set(LIBS ${LIBS} ${LIBXML2_LIBRARIES})
find_package(OpenNI REQUIRED)
set(INCLUDES ${INCLUDES} ${OpenNI_INCLUDE_DIR})
set(LIBS ${LIBS} ${OPENNI_LIBRARY})
set(INCLUDES ${INCLUDES} ${AVG_PATH}/libavg/src)
include_directories (${INCLUDES})
set(ONITOUCH_SRC src/OniDeviceManager src/OpenNIPlugin src/OniStreamNode
src/OniStreamThread)
add_library (openni MODULE ${ONITOUCH_SRC})
set_target_properties(openni PROPERTIES PREFIX "")
if(APPLE)
set(CMAKE_MODULE_LINKER_FLAGS "-bundle -flat_namespace -undefined suppress")
target_link_libraries (openni ${LIBS})
endif()
if(UNIX AND NOT APPLE)
target_link_libraries (openni ${LIBS} ${AVG_PATH}/libavg/src/wrapper/.libs/avg.so /usr/lib/libOpenNI2.so)
endif()
if(WIN32)
set_target_properties(openni PROPERTIES COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB;AVG_PLUGIN")
target_link_libraries (openni ${LIBS} ${AVG_PATH}/libavg/win/Release/avg.lib)
endif()
add_custom_command(
TARGET openni
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${CMAKE_CFG_INTDIR}/openni${CMAKE_SHARED_LIBRARY_SUFFIX} ..
)
execute_process(COMMAND python -c "import os,libavg; print os.path.dirname(libavg.__file__)"
OUTPUT_VARIABLE AVG_LIB_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
install(TARGETS openni
DESTINATION ${AVG_LIB_PATH}/plugin/
)
set_target_properties(PROPERTIES PREFIX "")