Skip to content

Commit

Permalink
Lots of cmake scrubbing
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Machulis <[email protected]>
  • Loading branch information
qdot committed Nov 23, 2010
1 parent dd9ad07 commit 1913bf7
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 15 deletions.
45 changes: 36 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
######################################################################################
# License
######################################################################################

# This file is part of the OpenKinect Project. http://www.openkinect.org
#
# Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
Expand All @@ -22,7 +26,20 @@
# Binary distributions must follow the binary distribution requirements of
# either License.

######################################################################################
# CMake directives
######################################################################################

#Require 2.6 or higher.

cmake_minimum_required(VERSION 2.6)

######################################################################################
# Project declaration and options
######################################################################################

PROJECT(libfreenect)

set (PROJECT_VER_MAJOR 0)
set (PROJECT_VER_MINOR 0)
set (PROJECT_VER_PATCH 1)
Expand All @@ -31,25 +48,37 @@ set (PROJECT_VER
set (PROJECT_APIVER
"${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}")

cmake_minimum_required(VERSION 2.6)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/Modules/")
######################################################################################
# CMake Modules
######################################################################################

set(CMAKE_C_FLAGS "-Wall -O3 -g")
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)

# Add source directories
add_subdirectory (lib)
######################################################################################
# CMake
######################################################################################

# Pretty much everyone is going to need the main includes
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)

# Add library project
add_subdirectory (src)

# Add examples
add_subdirectory (examples)

######################################################################################
# Extras
######################################################################################

# Create an uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/Modules/UninstallTarget.cmake.in"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/UninstallTarget.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/UninstallTarget.cmake"
IMMEDIATE @ONLY)

Expand All @@ -60,8 +89,6 @@ add_custom_target(uninstall
# after make, use "fakeroot cpack" in the build Dir to complete

IF ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")


set(CPACK_PACKAGE_DESCRIPTION "libfreenect for kinect")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libfreenect library for using kinect")
set(CPACK_PACKAGE_NAME "libfreenect-dev")
Expand Down
22 changes: 16 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
include_directories (${CMAKE_SOURCE_DIR}/include)
include_directories (${CMAKE_SOURCE_DIR}/lib)
######################################################################################
# Build for main library
######################################################################################

find_package(Threads REQUIRED)
find_package(USB REQUIRED)
include_directories(${USB_INCLUDE_DIRS})
include_directories (${CMAKE_CURRENT_SOURCE_DIR})

SET(SRC core.c tilt.c cameras.c usb_libusb10.c)
# Catch all for OS X or Linux
IF(UNIX)
set(CMAKE_C_FLAGS "-Wall")
find_package(Threads REQUIRED)
find_package(USB REQUIRED)
include_directories(${USB_INCLUDE_DIRS})
LIST(APPEND SRC usb_libusb10.c)
ELSE()
MESSAGE(FATAL_ERROR "libfreenect is not currently supported on this platform")
ENDIF()

LIST(APPEND SRC core.c tilt.c cameras.c usb_libusb10.c)

if (NOT PROJECT_OS_WIN)
add_library (freenect SHARED ${SRC})
Expand Down

0 comments on commit 1913bf7

Please sign in to comment.