Skip to content

Commit 886fff7

Browse files
committed
cmake: Make streamer-recorder build in-tree.
- [streamer][recorder][cmake] adjust for refactorings and comments - [streamer][recorder][cmake] the main executable does not exist sometimes
1 parent 00d3a23 commit 886fff7

File tree

2 files changed

+36
-13
lines changed

2 files changed

+36
-13
lines changed

CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,14 @@ IF(BUILD_OPENNI2_DRIVER)
477477
ENDIF()
478478
ENDIF()
479479

480+
OPTION(BUILD_STREAMER_RECORDER "Build streamer_recorder" OFF)
481+
SET(HAVE_streamer_recorder disabled)
482+
IF(BUILD_STREAMER_RECORDER)
483+
SET(HAVE_streamer_recorder yes)
484+
MESSAGE(STATUS "Configurating streamer_recorder")
485+
ADD_SUBDIRECTORY(${MY_DIR}/tools/streamer_recorder)
486+
ENDIF()
487+
480488
GET_CMAKE_PROPERTY(vars VARIABLES)
481489
MESSAGE(STATUS "Feature list:")
482490
FOREACH(var ${vars})

tools/streamer_recorder/CMakeLists.txt

+28-13
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ ENDIF()
1414
PROJECT(libfreenect2_tools_SR)
1515

1616
SET(MY_DIR ${libfreenect2_tools_SR_SOURCE_DIR})
17-
SET(DEPENDS_DIR "${MY_DIR}/../../depends" CACHE STRING "Dependency directory")
17+
SET(DEPENDS_DIR "${MY_DIR}/../../../depends" CACHE STRING "Dependency directory")
1818

1919
OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)
2020

21-
# The example build system is standalone and will work out-of-tree with these files copied
21+
# The build system could be standalone if these files are copied instead of being referenced here.
2222
SET(freenect2_ROOT_DIR ${MY_DIR}/../..)
2323
SET(flextGL_SOURCES ${freenect2_ROOT_DIR}/src/flextGL.cpp)
2424
SET(flextGL_INCLUDE_DIRS ${freenect2_ROOT_DIR}/src) # for flextGL.h
25-
SET(tools_SR_INCLUDE_DIRS ${MY_DIR}/include) # for local include
2625
SET(example_INCLUDE_DIRS ${freenect2_ROOT_DIR}/examples) # for protonect viewer
2726

28-
2927
FIND_PACKAGE(PkgConfig) # try find PKGConfig as it will be used if found
3028
LIST(APPEND CMAKE_MODULE_PATH ${freenect2_ROOT_DIR}/cmake_modules) # FindGLFW3.cmake
3129

@@ -40,10 +38,15 @@ ENDIF()
4038

4139
INCLUDE_DIRECTORIES(
4240
${freenect2_INCLUDE_DIR}
41+
${example_INCLUDE_DIRS}
42+
${MY_DIR}/include
4343
)
4444

4545
SET(ProtonectSR_src
4646
ProtonectSR.cpp
47+
PracticalSocket.cpp
48+
streamer.cpp
49+
recorder.cpp
4750
)
4851

4952
SET(ProtonectSR_LIBRARIES
@@ -54,23 +57,29 @@ SET(ProtonectSR_DLLS
5457
${freenect2_DLLS}
5558
)
5659

60+
# Add OpenCV package dependency for udp-image-streaming
61+
FIND_PACKAGE(OpenCV REQUIRED)
62+
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
63+
LIST(APPEND ProtonectSR_LIBRARIES
64+
${OpenCV_LIBS}
65+
)
66+
# OpenCV requires exception.
67+
IF(UNIX AND NOT APPLE)
68+
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
69+
ENDIF()
70+
5771
IF(ENABLE_OPENGL)
5872
FIND_PACKAGE(GLFW3)
5973
FIND_PACKAGE(OpenGL)
6074
IF(GLFW3_FOUND AND OPENGL_FOUND)
6175
INCLUDE_DIRECTORIES(
6276
${GLFW3_INCLUDE_DIRS}
6377
${flextGL_INCLUDE_DIRS}
64-
${tools_SR_INCLUDE_DIRS}
65-
${example_INCLUDE_DIRS}
6678
)
6779

6880
LIST(APPEND ProtonectSR_DLLS ${GLFW3_DLL})
6981
LIST(APPEND ProtonectSR_src
7082
${example_INCLUDE_DIRS}/viewer.cpp
71-
${tools_SR_INCLUDE_DIRS}/PracticalSocket.cpp
72-
${tools_SR_INCLUDE_DIRS}/streamer.cpp
73-
${tools_SR_INCLUDE_DIRS}/recorder.cpp
7483
${flextGL_SOURCES}
7584
)
7685
LIST(APPEND ProtonectSR_LIBRARIES
@@ -89,6 +98,16 @@ TARGET_LINK_LIBRARIES(ProtonectSR
8998
${ProtonectSR_LIBRARIES}
9099
)
91100

101+
if(EXISTS ProtonectSR)
102+
configure_file(build/ProtonectSR freenect2-record COPYONLY)
103+
configure_file(build/ProtonectSR freenect2-replay COPYONLY)
104+
configure_file(build/ProtonectSR freenect2-stream COPYONLY)
105+
endif()
106+
107+
file(MAKE_DIRECTORY build/recordings)
108+
file(MAKE_DIRECTORY build/recordings/depth)
109+
file(MAKE_DIRECTORY build/recordings/regist)
110+
92111
IF(WIN32)
93112
INSTALL(TARGETS ProtonectSR DESTINATION bin)
94113
LIST(REMOVE_DUPLICATES ProtonectSR_DLLS)
@@ -99,7 +118,3 @@ IF(WIN32)
99118
ENDFOREACH(FILEI)
100119
INSTALL(FILES ${ProtonectSR_DLLS} DESTINATION bin)
101120
ENDIF()
102-
103-
# Add OpenCV package dependency for udp-image-streaming
104-
find_package( OpenCV REQUIRED )
105-
target_link_libraries( ProtonectSR ${OpenCV_LIBS} )

0 commit comments

Comments
 (0)