Skip to content

Commit 31c187c

Browse files
committed
CMake: don't set build type / install prefix unless LSL_COMFY_DEFAULTS is set
1 parent 35820e8 commit 31c187c

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Changes for liblsl 1.14
22

3+
* **change**: CMake doesn't set `CMAKE_INSTALL_PREFIX`and `CMAKE_BUILD_TYPE` by default unless `LSL_COMFY_DEFAULTS` is set (Tristan Stenner)
34
* fix: prevent race condition when two threads modify an overflowing buffer (https://github.com/sccn/liblsl/pull/71, Jérémy Frey)
45
* fix: improve latency and CPU usage (https://github.com/sccn/liblsl/pull/71, Jérémy Frey)
56
* fix: various build system fixces and improvments (Chadwick Boulay, Tristan Stenner)

cmake/LSLCMake.cmake

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# Common functions and settings for LSL
22

3-
# Dummy function that should be called after find_package(LSL)
4-
# Does nothing at the moment, but the entire code below should be within this
5-
# function so it's not executed by accident
3+
option(LSL_DEPLOYAPPLIBS "Copy library dependencies (at the moment Qt + liblsl) to the installation dir" ON)
4+
option(LSL_COMFY_DEFAULTS "Set some quality of life options, e.g. a sensible 'install' directory" OFF)
5+
66
macro(LSLAPP_Setup_Boilerplate)
7+
message(WARNING "This function is deprecated, set LSL_COMFY_DEFAULTS instead")
8+
set(LSL_COMFY_DEFAULTS ON)
79
endmacro()
810

11+
# helper script to determine the target architecture for package naming
12+
# The code below is compiled with the target compiler so it should work even
13+
# when cross compiling and doesn't require the executable to be run
914
function(LSL_get_target_arch)
1015
if(LSL_ARCH)
1116
return()
@@ -40,28 +45,25 @@ function(LSL_get_target_arch)
4045
set(LSL_ARCH "${ARCH}" CACHE INTERNAL "target architecture")
4146
endfunction()
4247

43-
message(STATUS "Included LSL CMake helpers, rev. 14, ${CMAKE_CURRENT_LIST_DIR}")
44-
option(LSL_DEPLOYAPPLIBS "Copy library dependencies (at the moment Qt + liblsl) to the installation dir" ON)
48+
message(STATUS "Included LSL CMake helpers, rev. 15, ${CMAKE_CURRENT_LIST_DIR}")
4549

4650
# set build type and default install dir if not done already or undesired
47-
if(NOT CMAKE_BUILD_TYPE)
51+
if(LSL_COMFY_DEFAULTS AND NOT CMAKE_BUILD_TYPE)
4852
message(STATUS "CMAKE_BUILD_TYPE was default initialized to Release")
4953
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
5054
endif()
51-
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND NOT LSL_PRESERVE_INSTALL_PREFIX)
55+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND COMFY_DEFAULTS)
5256
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH
5357
"Where to put redistributable binaries" FORCE)
54-
message(WARNING "CMAKE_INSTALL_PREFIX default initialized to ${CMAKE_INSTALL_PREFIX}. Set LSL_PRESERVE_INSTALL_PREFIX or CMAKE_INSTALL_PREFIX to skip this.")
5558
endif()
5659

57-
# Generate folders for IDE targets (e.g., VisualStudio solutions)
58-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
60+
if(LSL_COMFY_DEFAULTS)
61+
# Generate folders for IDE targets (e.g., VisualStudio solutions)
62+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
5963

60-
61-
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE)
62-
63-
# Qt5
64-
set(CMAKE_INCLUDE_CURRENT_DIR ON) # Because the ui_mainwindow.h file.
64+
# Qt5, include e.g. "mainwindow.h"
65+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
66+
endif()
6567

6668
# LSL functions, mostly for Apps
6769

examples/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ find_package(LSL REQUIRED
99
PATH_SUFFIXES share/LSL)
1010
get_filename_component(LSL_PATH ${LSL_CONFIG} DIRECTORY)
1111
message(STATUS "Found LSL lib in ${LSL_PATH}")
12-
LSLAPP_Setup_Boilerplate()
1312
message(STATUS "LSL BIN DIR: ${liblsl_BINARY_DIR} & ${LIBLSL_BINARY_DIR}")
1413

1514
# convenience function to add an example file

lslboost/serialization_objects.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
#include "libs/serialization/src/extended_type_info_typeid.cpp"
1010
#include "libs/serialization/src/void_cast.cpp"
1111
#ifdef _WIN32
12-
#include "lslboost/libs/serialization/src/codecvt_null.cpp"
12+
#include "libs/serialization/src/codecvt_null.cpp"
1313
#endif

testing/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ target_compile_definitions(catch_main PRIVATE LSL_VERSION_INFO="${LSL_VERSION_IN
1515
if(LSL_BENCHMARKS)
1616
target_compile_definitions(catch_main PUBLIC CATCH_CONFIG_ENABLE_BENCHMARKING)
1717
endif()
18+
target_include_directories(catch_main PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
1819

1920
add_executable(lsl_test_exported
2021
test_ext_DataType.cpp

testing/internal/serialization_v100.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "catch.hpp"
1+
#include <catch.hpp>
22
#include "portable_archive/portable_iarchive.hpp"
33
#include "portable_archive/portable_oarchive.hpp"
44
#include "sample.h"

0 commit comments

Comments
 (0)