Skip to content

Commit dd16aa0

Browse files
committed
moved from home-made makefiles to CMake build scripts
1 parent af6bc04 commit dd16aa0

File tree

6 files changed

+53
-250
lines changed

6 files changed

+53
-250
lines changed

install.rkt

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,29 +40,25 @@
4040
(define login_cmd (string-append "source " login_script))
4141
(define (system-env arg) (system (string-append login_cmd " && " arg)))
4242

43-
(define (libfreenect-installed?)
44-
(display "Searching for libfreenect: ")
45-
#t)
46-
4743
;; 7. For windows, we need to find out, which architecture DrRacket is built
4844
(require (only-in ffi/unsafe ctype-sizeof _pointer))
4945
(define racket-bits (* 8 (ctype-sizeof _pointer)))
46+
(define cmake_flags (if (= racket-bits 32)
47+
"-DCMAKE_CXX_FLAGS=-m32 -DCMAKE_C_FLAGS=-m32"
48+
""))
5049

5150
; 8. The compilation routine (at least for macosx and unix)
5251
(if (or (equal? (system-type 'os) 'macosx)
5352
(equal? (system-type 'os) 'unix))
54-
(if (libfreenect-installed?)
55-
;;LIBFREENECT is found!
56-
(begin
57-
(display "-------------- BUILDING LIBFREENECT-C-WRAPPER FOR KINECT GRABBING --------------")
58-
(newline)
59-
(current-directory kinect-grab_c-path)
60-
(if (system-env (string-append " make " (symbol->string (system-type 'os)) (number->string racket-bits))) ; "make macosx32", "make macosx64", "make unix32" or "make unix64"
61-
(begin
62-
(copy-file (build-path (current-directory) "bin" dylib-file) dylib-path #t)
63-
#t)
64-
(error "making the kinect-grab_c lib failed, although libFreenect seems to be installed")))
65-
(error "LibFreenect is not found. Please check if the prefix path is set correctly in /.profile file!"))
53+
(begin
54+
(display "-------------- BUILDING LIBFREENECT-C-WRAPPER FOR KINECT GRABBING --------------")
55+
(newline)
56+
(current-directory kinect-grab_c-path)
57+
(if (system-env (string-append "mkdir build && cd build && cmake " cmake_flags " .. && make && cd .."))
58+
(begin
59+
(copy-file (build-path (current-directory) "bin" dylib-file) dylib-path #t)
60+
#t)
61+
(error "Making the kinect-grab_c lib failed")))
6662
;;For windows
6763
(if (equal? (system-type 'os) 'windows)
6864
(let ((bindir (build-path kinect-grab_c-path "bin" (string-append "win"(number->string racket-bits)))))

kinect-grab_c/CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cmake_minimum_required(VERSION 2.8.11)
2+
3+
project(kinect-grab_c)
4+
5+
set(KINECT_GRAB_C_BIN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/bin)
6+
7+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${KINECT_GRAB_C_BIN_DIR})
8+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${KINECT_GRAB_C_BIN_DIR})
9+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${KINECT_GRAB_C_BIN_DIR})
10+
11+
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
12+
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
13+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${KINECT_GRAB_C_BIN_DIR})
14+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${KINECT_GRAB_C_BIN_DIR})
15+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${KINECT_GRAB_C_BIN_DIR})
16+
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPE)
17+
18+
set(CMAKE_MACOSX_RPATH FALSE)
19+
20+
#Find libfreenect
21+
find_library(FREENECT_LIBRARY freenect_sync)
22+
find_path(FREENECT_INCLUDE_DIR libfreenect)
23+
include_directories(${FREENECT_INCLUDE_DIR})
24+
25+
add_subdirectory(src)

kinect-grab_c/Makefile

Lines changed: 0 additions & 32 deletions
This file was deleted.

kinect-grab_c/msvc2012/kinect-grab_c.sln

Lines changed: 0 additions & 26 deletions
This file was deleted.

kinect-grab_c/msvc2012/kinect-grab_c.vcxproj

Lines changed: 0 additions & 176 deletions
This file was deleted.

kinect-grab_c/src/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
cmake_minimum_required(VERSION 2.8.11)
2+
3+
project(kinect-grab_c)
4+
5+
#find . -type f -name \*.cxx | sed 's,^\./,,'
6+
set(SOURCES
7+
kinect-grab_c.cxx)
8+
9+
#find . -type f -name \*.hxx | sed 's,^\./,,'
10+
set(HEADERS
11+
kinect-grab_c.hxx
12+
os_settings.hxx)
13+
14+
# Tell CMake to create the library
15+
add_library(kinect-grab_c SHARED ${SOURCES} ${HEADERS})
16+
target_link_libraries(kinect-grab_c ${FREENECT_LIBRARY})

0 commit comments

Comments
 (0)