forked from sccn/lsl_archived
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
54 lines (44 loc) · 2.06 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
cmake_minimum_required(VERSION 3.5)
project(LabStreamingLayer)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/build/install/lsl_${CMAKE_BUILD_TYPE}" CACHE PATH
"Where to put redistributable binaries" FORCE)
message(WARNING "CMAKE_INSTALL_PREFIX default initialized to ${CMAKE_INSTALL_PREFIX}")
endif()
# add the liblsl build directory
add_subdirectory(LSL/liblsl)
# When building the whole tree, we define LSL_INSTALL_ROOT as the current directory.
# In this case we have liblsl as an actual target, so we don't need to find it.
# In all other cases, LSL_INSTALL_ROOT must be set to an actual **installed** lsl root.
set(LSL_INSTALL_ROOT ${CMAKE_CURRENT_LIST_DIR} CACHE STRING
"LSL root directory, LSL_INSTALL_ROOT/cmake contains modules to set everything up / find liblsl" FORCE)
# When using a precompiled lsl, liblsl is installed as an exported target with
# an autogenerated FindLSL.cmake in LSL_INSTALL_ROOT/cmake so the apps and
# LSLAppBoilerplate don't care where LSL_INSTALL_ROOT was defined
# load settings for all LSL Apps
list(APPEND CMAKE_MODULE_PATH "${LSL_INSTALL_ROOT}/cmake/")
include(LSLAppBoilerplate)
# include the Apps directory which defines options, which Apps will be built
# and includes their build configurations
add_subdirectory(Apps)
install(FILES
cmake/LSLAppBoilerplate.cmake
COMPONENT "liblsl-dev"
DESTINATION LSL/cmake)
# add a target that zips up a built installation tree
# Example: cmake --build path/to/build_dir --target LSLPACKAGE
set(LSLPACKAGENAME "LSL_${CMAKE_SYSTEM_NAME}.7z")
add_custom_target(LSLPACKAGE
COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "install"
COMMAND ${CMAKE_COMMAND} "-E" "tar" "cvf" "${LSLPACKAGENAME}" "--format=7zip" "${CMAKE_INSTALL_PREFIX}"
BYPRODUCTS ${LSLPACKAGENAME}
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}/../")
# Generate packages for LSL and all built apps
if(UNIX)
include(LslCPackCommon)
include(LslCPackDeb)
include(CPack)
endif()