Skip to content

Commit c617db6

Browse files
committed
2 parents f353750 + 3b63e28 commit c617db6

5 files changed

Lines changed: 83 additions & 25 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ ui_*.h
55
/CMakeSettings.json
66
.vs/
77
out/
8+
.DS_Store
9+
LSL/
10+
liblsl.tar.bz2
11+

CMakeLists.txt

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,50 @@
1-
cmake_minimum_required(VERSION 3.5)
1+
cmake_minimum_required(VERSION 3.12)
2+
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum MacOS deployment version")
23

34
project(AudioCapture
4-
LANGUAGES CXX
5+
DESCRIPTION "Capture audio and stream it over LabStreamingLayer"
6+
HOMEPAGE_URL "https://github.com/labstreaminglayer/App-AudioCapture/"
7+
LANGUAGES CXX C
58
VERSION 0.1)
69

7-
# Find an installed liblsl in paths set by the user (LSL_INSTALL_ROOT)
8-
# and some default paths
10+
# Needed for customized MacOSXBundleInfo.plist.in
11+
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" ${CMAKE_MODULE_PATH})
12+
13+
set(CMAKE_CXX_STANDARD 17)
14+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
15+
16+
17+
## Qt
18+
set(CMAKE_AUTOMOC ON) # The later version of this in LSLCMake is somehow not enough.
19+
set(CMAKE_AUTORCC ON)
20+
set(CMAKE_AUTOUIC ON)
21+
find_package(Qt6 COMPONENTS Core Widgets Network DBus Multimedia) # Multimedia requires Qt6.2
22+
if(NOT Qt6_FOUND)
23+
if(APPLE)
24+
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt@5")
25+
endif()
26+
# If we require 5.15 then we can use version-agnostic linking, but 5.15 not easily available on Ubuntu.
27+
find_package(Qt5 COMPONENTS Core Widgets Network DBus Multimedia REQUIRED)
28+
add_executable(${PROJECT_NAME} MACOSX_BUNDLE)
29+
set(LSLAPP_QT_VER Qt5)
30+
else()
31+
qt_add_executable(${PROJECT_NAME} MACOSX_BUNDLE MANUAL_FINALIZATION)
32+
set(LSLAPP_QT_VER Qt)
33+
endif()
34+
35+
# LSL
936
find_package(LSL REQUIRED
1037
HINTS ${LSL_INSTALL_ROOT}
38+
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/build/"
1139
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/build/install"
40+
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/out/build/x64-Release"
1241
"${CMAKE_CURRENT_LIST_DIR}/../../LSL/liblsl/out/install/x64-Release"
1342
PATH_SUFFIXES share/LSL)
1443
get_filename_component(LSL_PATH ${LSL_CONFIG} DIRECTORY)
15-
message(STATUS "Found LSL lib in ${LSL_PATH}")
16-
LSLAPP_Setup_Boilerplate()
1744

18-
set(CMAKE_INCLUDE_CURRENT_DIR ON)
19-
set(CMAKE_AUTOMOC ON)
20-
set(CMAKE_AUTOUIC ON)
21-
set(CMAKE_AUTORCC ON)
22-
find_package(Qt5 REQUIRED COMPONENTS Widgets Multimedia)
2345
find_package(Threads REQUIRED)
2446

25-
add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32
47+
target_sources(${PROJECT_NAME} PRIVATE
2648
main.cpp
2749
mainwindow.cpp
2850
mainwindow.h
@@ -33,35 +55,38 @@ add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32
3355

3456
target_link_libraries(${PROJECT_NAME}
3557
PRIVATE
36-
Qt5::Widgets
37-
Qt5::Multimedia
58+
${LSLAPP_QT_VER}::Widgets
59+
${LSLAPP_QT_VER}::Multimedia
3860
Threads::Threads
3961
LSL::lsl
4062
)
41-
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
42-
# target_compile_features(${PROJECT_NAME} PRIVATE cxx_auto_type cxx_lambda_init_captures)
43-
4463

64+
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
4565
set_target_properties(${PROJECT_NAME} PROPERTIES
46-
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/MacOSXBundleInfo.plist"
47-
MACOSX_BUNDLE_GUI_IDENTIFIER "LabStreamingLayer.AudioCapture")
66+
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
67+
)
4868

4969
# Copy the required dll's into the build folder --> useful for debugging from IDE
5070
# create a list of files to copy
5171
set(THIRD_PARTY_DLLS
5272
LSL::lsl
53-
Qt5::Core
54-
Qt5::Gui
55-
Qt5::Widgets
56-
Qt5::Multimedia
57-
Qt5::Network
73+
${LSLAPP_QT_VER}::Core
74+
${LSLAPP_QT_VER}::Gui
75+
${LSLAPP_QT_VER}::Widgets
76+
${LSLAPP_QT_VER}::Multimedia
77+
${LSLAPP_QT_VER}::Network
5878
)
79+
5980
foreach(_lib ${THIRD_PARTY_DLLS})
6081
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
6182
COMMAND ${CMAKE_COMMAND} -E copy_if_different
6283
$<TARGET_FILE:${_lib}>
6384
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
6485
endforeach()
6586

87+
if(Qt6_FOUND)
88+
qt_finalize_executable(${PROJECT_NAME})
89+
endif()
90+
6691
installLSLApp(${PROJECT_NAME})
6792
LSLGenerateCPackConfig()

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Christian Kothe, Tristan Stenner
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ Using this app is very simple:
2323
# Build
2424

2525
The build instructions for this app are mostly the same as the [generic LSL App build instructions](https://labstreaminglayer.readthedocs.io/dev/app_build.html).
26-
Qt5 Multimedia module is required. On Ubuntu this does not come with qt5 by default. Install it with `sudo apt-get install qtmultimedia5-dev`.
26+
Qt Multimedia module is required. On Ubuntu this does not come with qt5 by default. Install it with `sudo apt-get install qtmultimedia5-dev`. On Mac, with homebrew, it is only included in qt6 >= 6.2, which isn't out yet, so qt5 is required.
27+
On Mac, it appears to be necessary to use the Xcode generator: `cmake -B build -S . -DCMAKE_INSTALL_PREFIX="build/install" -G Xcode`
2728

29+
Note that code-signing has been disabled.
2830

2931
# Further Notes
3032

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@
2828
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
2929
<key>CSResourcesFileMapped</key>
3030
<true/>
31+
<key>LSRequiresCarbon</key>
32+
<true/>
3133
<key>NSHumanReadableCopyright</key>
3234
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
35+
<key>NSHighResolutionCapable</key>
36+
<true/>
3337
<key>NSMicrophoneUsageDescription</key>
3438
<string>Copy audio to LSL stream.</string>
39+
<key>NSPrincipalClass</key>
40+
<string>NSApplication</string>
3541
</dict>
3642
</plist>

0 commit comments

Comments
 (0)