Skip to content

Commit

Permalink
Organize native, build all script
Browse files Browse the repository at this point in the history
  • Loading branch information
jim3692 committed Apr 1, 2023
1 parent 958f75b commit 1754881
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 29 deletions.
2 changes: 2 additions & 0 deletions native/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
out
32 changes: 4 additions & 28 deletions native/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
cmake_minimum_required(VERSION 3.1)
project(link-app-to-mic-example LANGUAGES CXX VERSION 1.0)
cmake_minimum_required(VERSION 3.2.2)
project(globalProject)

# --------------------------------------------------------------------------------------------------------
# Create library
# --------------------------------------------------------------------------------------------------------

file(GLOB src "main.cpp")

add_executable(${PROJECT_NAME} ${src})
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Werror -Wextra -pedantic)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON)

# --------------------------------------------------------------------------------------------------------
# Supply rohrkabel if example is built stand-alone
# --------------------------------------------------------------------------------------------------------

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
include(FetchContent)
FetchContent_Declare(rohrkabel GIT_REPOSITORY "https://github.com/Soundux/rohrkabel")
FetchContent_MakeAvailable(rohrkabel)
endif()

# --------------------------------------------------------------------------------------------------------
# Link required libraries
# --------------------------------------------------------------------------------------------------------

target_link_libraries(${PROJECT_NAME} PRIVATE rohrkabel)
add_subdirectory(message-parser)
add_subdirectory(screenaudio-mic)
10 changes: 10 additions & 0 deletions native/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -e

cmake -B build -S .
cmake --build build

mkdir -p out
cp build/message-parser/message-parser out/
cp build/screenaudio-mic/screenaudio-mic out/
6 changes: 6 additions & 0 deletions native/message-parser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.2.2)
project(message-parser LANGUAGES CXX VERSION 1.0)

file(GLOB src "message-parser.c")

add_executable(${PROJECT_NAME} ${src})
File renamed without changes.
27 changes: 27 additions & 0 deletions native/screenaudio-mic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.2.2)
project(screenaudio-mic LANGUAGES CXX VERSION 1.0)

# --------------------------------------------------------------------------------------------------------
# Create library
# --------------------------------------------------------------------------------------------------------

file(GLOB src "main.cpp")

add_executable(${PROJECT_NAME} ${src})
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Werror -Wextra -pedantic)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON)

# --------------------------------------------------------------------------------------------------------
# Supply rohrkabel if example is built stand-alone
# --------------------------------------------------------------------------------------------------------

include(FetchContent)
FetchContent_Declare(rohrkabel GIT_REPOSITORY "https://github.com/Soundux/rohrkabel")
FetchContent_MakeAvailable(rohrkabel)

# --------------------------------------------------------------------------------------------------------
# Link required libraries
# --------------------------------------------------------------------------------------------------------

target_link_libraries(${PROJECT_NAME} PRIVATE rohrkabel)
2 changes: 1 addition & 1 deletion native/main.cpp → native/screenaudio-mic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main()

auto virtual_mic = core.create("adapter",
{
{"node.name", "Rohrkabel Virtual Mic"}, //
{"node.name", "screenaudio-mic"}, //
{"media.class", "Audio/Source/Virtual"}, //
{"factory.name", "support.null-audio-sink"}, //
{"audio.channels", "2"}, //
Expand Down

0 comments on commit 1754881

Please sign in to comment.