Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes some minor installation and c++0x standard compatibility issues #355

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ cmake_minimum_required(VERSION 2.6)

PROJECT(libfreenect)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")

# Find the host operating system and architecture
include (FindOS)
# Set up installation directories
include (SetupDirectories)

set (PROJECT_VER_MAJOR 0)
set (PROJECT_VER_MINOR 2)
set (PROJECT_VER_PATCH 0)
Expand All @@ -58,20 +65,15 @@ OPTION(BUILD_CV "Build OpenCV wrapper" OFF)
OPTION(BUILD_AS3_SERVER "Build the Actionscript 3 Server Example" OFF)
OPTION(BUILD_PYTHON "Build Python extension" OFF)
IF(PROJECT_OS_LINUX)
OPTION(BUILD_CPACK "Build an RPM or DEB using CPack" OFF)
OPTION(BUILD_CPACK_DEB "Build an DEB using CPack" ON)
OPTION(BUILD_CPACK_RPM "Build an RPM using CPack" ON)
OPTION(BUILD_CPACK_TGZ "Build an TGZ using CPack" OFF)
ENDIF(PROJECT_OS_LINUX)

######################################################################################
# CMake Modules
######################################################################################

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")

# Find the host operating system and architecture
include (FindOS)
# Set up installation directories
include (SetupDirectories)

# Find packages needed to build library
find_package(libusb-1.0 REQUIRED)

Expand Down Expand Up @@ -162,14 +164,18 @@ configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/UninstallTarget.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/UninstallTarget.cmake"
IMMEDIATE @ONLY)

# --- cmake config file ---
CONFIGURE_FILE(libfreenectConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libfreenectConfig.cmake @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libfreenectConfig.cmake DESTINATION share/${PROJECT_NAME})

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/UninstallTarget.cmake)

# Create Debian/RPM Packages
# after make, use "fakeroot cpack" in the build Dir to complete

IF ( BUILD_CPACK )
IF ( BUILD_CPACK_TGZ OR BUILD_CPACK_DEB OR BUILD_CPACK_RPM )
set(CPACK_PACKAGE_DESCRIPTION "libfreenect for kinect")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libfreenect library for using kinect")
set(CPACK_PACKAGE_NAME "libfreenect-dev")
Expand All @@ -182,7 +188,16 @@ IF ( BUILD_CPACK )
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VER_PATCH})
set(VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

set(CPACK_GENERATOR "DEB;RPM;")
set(CPACK_GENERATOR "")
if (BUILD_CPACK_TGZ)
list(APPEND CPACK_GENERATOR "TGZ")
endif()
if (BUILD_CPACK_RPM)
list(APPEND CPACK_GENERATOR "RPM")
endif()
if (BUILD_CPACK_DEB)
list(APPEND CPACK_GENERATOR "DEB")
endif()
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CMAKE_SYSTEM_PROCESSOR}")

include(CPack)
Expand All @@ -197,5 +212,5 @@ IF ( BUILD_CPACK )
INSTALL(FILES "GPL2" DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")
INSTALL(FILES "README.asciidoc" DESTINATION "share/doc/${CPACK_PACKAGE_NAME}")

ENDIF ( BUILD_CPACK )
ENDIF ( )

8 changes: 8 additions & 0 deletions libfreenectConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
get_filename_component(CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

set(FREENECT_INCLUDE_DIRS "${CONFIG_DIR}/../../@PROJECT_INCLUDE_INSTALL_DIR@")
set(FREENECT_RUNTIME_LIBRARY_DIRS "${CONFIG_DIR}/../../bin")
set(FREENECT_LIBRARY_DIRS "${CONFIG_DIR}/../../@PROJECT_LIBRARY_INSTALL_DIR@")
#/libfreenect.so.@PROJECT_VER@
set(FREENECT_LIBRARIES "freenect")
set(FREENECT_VERSION "@PROJECT_VER@")
2 changes: 1 addition & 1 deletion wrappers/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
INSTALL(FILES libfreenect.hpp
DESTINATION include)
DESTINATION ${PROJECT_INCLUDE_INSTALL_DIR})

IF(BUILD_EXAMPLES)

Expand Down
2 changes: 1 addition & 1 deletion wrappers/cpp/libfreenect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ namespace Freenect {
DeviceMap::iterator it = m_devices.find(_index);
if (it != m_devices.end()) delete it->second;
ConcreteDevice * device = new ConcreteDevice(m_ctx, _index);
m_devices.insert(std::make_pair<int, FreenectDevice*>(_index, device));
m_devices.insert(std::make_pair<int, FreenectDevice*>((int)_index, device));
return *device;
}
void deleteDevice(int _index) {
Expand Down