-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
90 lines (73 loc) · 2.59 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Copyright (c) 2012, Julian Straub <jstraub@csail.mit.edu>
# Licensed under the MIT license. See LICENSE.txt or
# http://www.opensource.org/licenses/mit-license.php
project(dirichlet)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_COLOR_MAKEFILE ON)
IF(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release) # Release; debug; ...
set(CMAKE_BUILD_TYPE Debug) # Release; debug; ...
ENDIF()
FIND_PACKAGE(PythonLibs REQUIRED)
message("Found python library: ${PYTHON_LIBRARY}")
message("Found python include: ${PYTHON_INCLUDE_DIRS}")
IF( "${PYTHON_INCLUDE_DIRS}" STREQUAL "/usr/include/python2.6" )
message(" Found python version 2.6")
SET(PYTHON_V "PYTHON_2_6")
SET(PYTHON_LIB "python2.6")
ENDIF()
IF( "${PYTHON_INCLUDE_DIRS}" STREQUAL "/usr/include/python2.7" )
message(" Found python version 2.7")
SET(PYTHON_V "PYTHON_2_7")
SET(PYTHON_LIB "python2.7")
ENDIF()
# add flags depending on build type
set(CMAKE_CXX_FLAGS_RELEASE "-g -Wall -O2 -finline-functions -DNDEBUG -fopenmp -D${PYTHON_V}")
set(CMAKE_CXX_FLAGS_DEBUG "-g -D${PYTHON_V}")
# add flags in general
set(CMAKE_C_FLAGS "")
set(CMAKE_CXX_FLAGS "")
set(CMAKE_EXE_LINKER_FLAGS "")
IF(DEFINED ENV{WORKSPACE_HOME})
message("--- using WORKSPACE_HOME found in $ENV{WORKSPACE_HOME}")
ELSE()
message("WORKSPACE_HOME is not defined. You must tell CMake where to find WORKSPACE_HOME")
# exit early
return()
ENDIF()
# Include directories (.h .hpp files)
include_directories(
./include
$ENV{WORKSPACE_HOME}/research/3rdparty/include
/usr/share/pyshared/numpy/core/include
${PYTHON_INCLUDE_DIRS}
/usr/include
)
# Include library directories
link_directories(
$ENV{WORKSPACE_HOME}/research/3rdparty/lib
/usr/lib/
)
# define the sources
set(SRC
src/probabilityHelpers.cpp
)
set(LIBS
armadillo
boost_random
)
# add executable that should be compiled
add_executable(testHdp ./src/testHdp.cpp ${SRC})
target_link_libraries(testHdp ${LIBS} stdc++)
#add_executable(hdpCluster ./src/hdpCluster.cpp ${SRC})
#target_link_libraries(hdpCluster ${LIBS} stdc++)
add_executable(testRandom ./src/testRandom.cpp)
target_link_libraries(testRandom ${LIBS} stdc++)
add_executable(testArmadillo ./src/testArmadillo.cpp)
target_link_libraries(testArmadillo ${LIBS} stdc++)
ADD_LIBRARY(bnp SHARED src/hdp_py.cpp ${SRC})
TARGET_LINK_LIBRARIES(bnp ${LIBS} boost_python ${PYTHON_LIB})
INSTALL(TARGETS bnp LIBRARY DESTINATION $ENV{WORKSPACE_HOME}/research/bnp/python)
# unit tests
add_executable(unitTestProbHelpers ./src/unitTestProbHelpers.cpp ./src/probabilityHelpers.cpp)
target_link_libraries(unitTestProbHelpers ${LIBS} boost_unit_test_framework stdc++)