From 117ec45fb49295f273db234a7df10a25a2ed1c33 Mon Sep 17 00:00:00 2001 From: SunderB <20426079+SunderB@users.noreply.github.com> Date: Mon, 9 May 2022 17:55:12 +0100 Subject: [PATCH 01/14] Replace `*_build_externals` and `*-pre-copy-binaries` bash scripts with CMake The overall build process is unchanged, apart from that sp_link, sp_midi and aubio are now built when running cmake --build. --- app/CMakeLists.txt | 1 + app/external/CMakeLists.txt | 42 +++++++++++++++++++++--- app/external/aubio/CMakeLists.txt | 5 +++ app/external/linux_build_externals.sh | 16 --------- app/external/mac_build_externals.sh | 16 --------- app/external/sp_link/CMakeLists.txt | 2 ++ app/external/sp_midi/CMakeLists.txt | 1 + app/external/win_x64_build_externals.bat | 9 ----- app/external/win_x86_build_externals.bat | 6 ---- app/linux-clean.sh | 3 -- app/linux-pre-copy-binaries.sh | 15 --------- app/linux-prebuild.sh | 5 --- app/mac-pre-copy-binaries.sh | 32 ------------------ app/mac-prebuild.sh | 3 -- app/win-clean.bat | 3 -- app/win-pre-copy-binaries.bat | 18 ---------- app/win-prebuild.bat | 2 -- 17 files changed, 47 insertions(+), 132 deletions(-) delete mode 100755 app/external/linux_build_externals.sh delete mode 100755 app/external/mac_build_externals.sh delete mode 100644 app/external/win_x64_build_externals.bat delete mode 100644 app/external/win_x86_build_externals.bat delete mode 100755 app/linux-pre-copy-binaries.sh delete mode 100755 app/mac-pre-copy-binaries.sh delete mode 100644 app/win-pre-copy-binaries.bat diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 9d4bc5717f..9dd8382f51 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -44,6 +44,7 @@ include(cmake/common.cmake) configure_file(${APP_ROOT}/cmake/config.h.cmake ${CMAKE_BINARY_DIR}/config.h) +add_subdirectory(external) add_subdirectory(api) add_subdirectory(api-tests) add_subdirectory(gui) diff --git a/app/external/CMakeLists.txt b/app/external/CMakeLists.txt index 44767a7915..38daaa66c6 100644 --- a/app/external/CMakeLists.txt +++ b/app/external/CMakeLists.txt @@ -3,6 +3,21 @@ cmake_minimum_required(VERSION 3.13) message(STATUS " Aubio Builder") +if(WIN32) + set(ERLANG_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/windows/headers/erlang CACHE STRING "Path to the Erlang header files") +elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin) # macOS + set(ERLANG_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/macos/headers/erlang CACHE STRING "Path to the Erlang header files") +else() + execute_process( + COMMAND erl -noshell -eval "io:format(\"~s~n\", [filename:join([lists:concat([code:root_dir(), \"/erts-\", erlang:system_info(version)]), \"include\"])]), init:stop(0)." + OUTPUT_VARIABLE FOUND_ERLANG_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE) + set(ERLANG_INCLUDE_PATH ${FOUND_ERLANG_INCLUDE_PATH} CACHE STRING "Path to the Erlang header files") +endif() +option(USE_SYSTEM_LIBS "Use system libraries instead of bundled libraries when building" OFF) + +message(STATUS "ERLANG_INCLUDE_PATH: ${ERLANG_INCLUDE_PATH}") +message(STATUS "USE_SYSTEM_LIBS: ${USE_SYSTEM_LIBS}") + project(AubioBuilder LANGUAGES CXX C VERSION 1.0.0 @@ -17,8 +32,9 @@ project(AubioBuilder ExternalProject_Add(sp_midi PREFIX sp_midi-prefix SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/sp_midi - INSTALL_COMMAND "" + INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../server/beam/tau/priv CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/../server/beam/tau/priv -DERLANG_INCLUDE_PATH=${ERLANG_INCLUDE_PATH} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -DUSE_SYSTEM_RTMIDI=${USE_SYSTEM_LIBS} @@ -28,8 +44,9 @@ ExternalProject_Add(sp_midi ExternalProject_Add(sp_link PREFIX sp_link-prefix SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/sp_link - INSTALL_COMMAND "" + INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../server/beam/tau/priv CMAKE_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/../server/beam/tau/priv -DERLANG_INCLUDE_PATH=${ERLANG_INCLUDE_PATH} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release @@ -142,11 +159,28 @@ ExternalProject_Add(aubio -DPC_VORBISENC_INCLUDE_DIRS=${CMAKE_BINARY_DIR}/vorbis-package/include -DPC_OPUS_INCLUDE_DIRS=${CMAKE_BINARY_DIR}/opus-package/include -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} - INSTALL_COMMAND "" + INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../server/native + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/../server/native ) # Kick off a generation by making a dummy/empty project add_library(AubioBuilder STATIC externals.cpp) -# Dependency ensures the externals are built +# Dependency ensures the externals are built${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/macos/ add_dependencies(AubioBuilder aubio) + +# Copy prebuilt files +if(WIN32) + add_custom_command( + TARGET AubioBuilder PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/windows/ ${CMAKE_CURRENT_SOURCE_DIR}/../server/native + ) +elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin) # macOS + add_custom_command( + TARGET AubioBuilder PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/macos/ ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/ + COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/supercollider/scsynth ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/scsynth + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/supercollider/extra-plugins/ ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/supercollider/plugins/ + COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/supercollider/extra-plugins + ) +endif() diff --git a/app/external/aubio/CMakeLists.txt b/app/external/aubio/CMakeLists.txt index 0fee2ee26d..86b93b44ff 100644 --- a/app/external/aubio/CMakeLists.txt +++ b/app/external/aubio/CMakeLists.txt @@ -250,3 +250,8 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin) # macOS else() message(FATAL_ERROR "Aubio is not supported on this platform.") endif() + +install(TARGETS ${PROJECT_NAME} +LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) +install(TARGETS aubio_onset +RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) \ No newline at end of file diff --git a/app/external/linux_build_externals.sh b/app/external/linux_build_externals.sh deleted file mode 100755 index ef13a808ec..0000000000 --- a/app/external/linux_build_externals.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -e # Quit script on error -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -echo "Building server external dependencies..." -mkdir -p "${SCRIPT_DIR}/build" -cd "${SCRIPT_DIR}/build" - -ERLANG_INCLUDE_PATH=`erl -noinput -eval 'io:format("~s~n", [filename:join([lists:concat([code:root_dir(), "/erts-", erlang:system_info(version)]), "include"])]), init:stop(0).'` - -cmake -DUSE_SYSTEM_LIBS="${USE_SYSTEM_LIBS}" -DERLANG_INCLUDE_PATH="${ERLANG_INCLUDE_PATH}" -G "Unix Makefiles" .. - -echo "Building external deps..." -cmake --build . --config Release - -cd "${SCRIPT_DIR}" diff --git a/app/external/mac_build_externals.sh b/app/external/mac_build_externals.sh deleted file mode 100755 index 7cbcbb2ee0..0000000000 --- a/app/external/mac_build_externals.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -e # Quit script on error -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -echo "Building server external dependencies..." -mkdir -p "${SCRIPT_DIR}/build" -cd "${SCRIPT_DIR}/build" - -echo "Running cmake with: ERLANG_INCLUDE_PATH=\"${SCRIPT_DIR}/../../prebuilt/macos/headers/erlang/\"" -cmake -G "Unix Makefiles" -D ERLANG_INCLUDE_PATH="${SCRIPT_DIR}/../../prebuilt/macos/headers/erlang/" .. - -echo "Building external deps..." -cmake --build . --config Release - -cd "${SCRIPT_DIR}" -echo "Completed building external deps." diff --git a/app/external/sp_link/CMakeLists.txt b/app/external/sp_link/CMakeLists.txt index 4f46350be9..67e5f84458 100644 --- a/app/external/sp_link/CMakeLists.txt +++ b/app/external/sp_link/CMakeLists.txt @@ -75,3 +75,5 @@ elseif(UNIX) include_directories(${ERLANG_INCLUDE_PATH}) target_link_libraries(libsp_link Ableton::Link) endif(MSVC) + +install(TARGETS libsp_link LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}) \ No newline at end of file diff --git a/app/external/sp_midi/CMakeLists.txt b/app/external/sp_midi/CMakeLists.txt index 3ad7c4e96a..484145436a 100644 --- a/app/external/sp_midi/CMakeLists.txt +++ b/app/external/sp_midi/CMakeLists.txt @@ -92,3 +92,4 @@ elseif(UNIX) endif(USE_SYSTEM_RTMIDI) endif(MSVC) +install(TARGETS libsp_midi LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}) diff --git a/app/external/win_x64_build_externals.bat b/app/external/win_x64_build_externals.bat deleted file mode 100644 index fd95b838bd..0000000000 --- a/app/external/win_x64_build_externals.bat +++ /dev/null @@ -1,9 +0,0 @@ -set WORKING_DIR=%CD% - -cd %~dp0 -mkdir build > nul -cd build -cmake -G "Visual Studio 16 2019" -A x64 -D ERLANG_INCLUDE_PATH=%~dp0\..\..\prebuilt\windows\headers\erlang\ ..\ -cmake --build . --config Release - -cd %WORKING_DIR% diff --git a/app/external/win_x86_build_externals.bat b/app/external/win_x86_build_externals.bat deleted file mode 100644 index dbbe180b66..0000000000 --- a/app/external/win_x86_build_externals.bat +++ /dev/null @@ -1,6 +0,0 @@ -cd %~dp0 -mkdir build_x86 > nul -cd build_x86 -cmake -G "Visual Studio 16 2019" -A Win32 -D ERLANG_INCLUDE_PATH=%~dp0\..\..\prebuilt\windows\headers\erlang\ ..\ -cmake --build . --config Release -cd %CURRENT_DIR% diff --git a/app/linux-clean.sh b/app/linux-clean.sh index fde2785d44..6a2091551f 100755 --- a/app/linux-clean.sh +++ b/app/linux-clean.sh @@ -7,9 +7,6 @@ cd "${SCRIPT_DIR}" echo "Cleaning out build dir...." rm -rf build -echo "Cleaning out external/build dir...." -rm -rf external/build - echo "Cleaning out BEAM distribution..." rm -rf server/beam/tau/_build rm -rf server/beam/tau/priv/*.{so,dylib,dll} diff --git a/app/linux-pre-copy-binaries.sh b/app/linux-pre-copy-binaries.sh deleted file mode 100755 index 5aa191ead3..0000000000 --- a/app/linux-pre-copy-binaries.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -WORKING_DIR="$(pwd)" - - -cp "${SCRIPT_DIR}"/external/build/aubio-prefix/src/aubio-build/aubio_onset "${SCRIPT_DIR}"/server/native/ - -mkdir -p "${SCRIPT_DIR}"/server/beam/tau/priv/ -cp "${SCRIPT_DIR}"/external/build/sp_midi-prefix/src/sp_midi-build/*.so "${SCRIPT_DIR}"/server/beam/tau/priv/ -cp "${SCRIPT_DIR}"/external/build/sp_link-prefix/src/sp_link-build/*.so "${SCRIPT_DIR}"/server/beam/tau/priv/ - - -# Restore working directory as it was prior to this script running... -cd "${WORKING_DIR}" diff --git a/app/linux-prebuild.sh b/app/linux-prebuild.sh index cec49767fb..ac097fff87 100755 --- a/app/linux-prebuild.sh +++ b/app/linux-prebuild.sh @@ -30,15 +30,10 @@ if [ ! "$system_libs" == true ]; then "${SCRIPT_DIR}"/linux-pre-vcpkg.sh "${args[@]}" fi -# Build external dependencies and copy to build tree -echo "Building external binary dependencies..." -USE_SYSTEM_LIBS="$([ "$system_libs" == true ] && echo ON || echo OFF)" "${SCRIPT_DIR}"/external/linux_build_externals.sh - echo "Compiling native ruby extensions..." ruby "${SCRIPT_DIR}"/server/ruby/bin/compile-extensions.rb "${SCRIPT_DIR}"/linux-pre-translations.sh "${args[@]}" -"${SCRIPT_DIR}"/linux-pre-copy-binaries.sh "${args[@]}" "${SCRIPT_DIR}"/linux-pre-tau-prod-release.sh "${args[@]}" # Restore working directory as it was prior to this script running... diff --git a/app/mac-pre-copy-binaries.sh b/app/mac-pre-copy-binaries.sh deleted file mode 100755 index b552cba8de..0000000000 --- a/app/mac-pre-copy-binaries.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -set -e # Quit script on error -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -WORKING_DIR="$(pwd)" - -cd "${SCRIPT_DIR}" - -cp "${SCRIPT_DIR}"/external/build/aubio-prefix/src/aubio-build/aubio_onset "${SCRIPT_DIR}"/server/native/ - -mkdir -p "${SCRIPT_DIR}"/server/beam/tau/priv/ -for f in "${SCRIPT_DIR}"/external/build/sp_midi-prefix/src/sp_midi-build/*.dylib; do - cp "$f" "${SCRIPT_DIR}"/server/beam/tau/priv/$(basename "$f" .dylib).so -done - -for f in "${SCRIPT_DIR}"/external/build/sp_link-prefix/src/sp_link-build/*.dylib; do - cp "$f" "${SCRIPT_DIR}"/server/beam/tau/priv/$(basename "$f" .dylib).so -done - - -# Copy prebuilt native files to server -echo "Copying prebuilt binaries to the server..." -mkdir -p "${SCRIPT_DIR}"/server/native/ - -cp -R "${SCRIPT_DIR}"/../prebuilt/macos/x64/* "${SCRIPT_DIR}"/server/native/ - -cd "${SCRIPT_DIR}"/server/native/ -ln -s supercollider/scsynth scsynth -mv supercollider/extra-plugins/* supercollider/plugins/ -rm -rf supercollider/extra-plugins - -# Restore working directory as it was prior to this script running... -cd "${WORKING_DIR}" diff --git a/app/mac-prebuild.sh b/app/mac-prebuild.sh index 46e4c2019e..b5ecbeca75 100755 --- a/app/mac-prebuild.sh +++ b/app/mac-prebuild.sh @@ -19,13 +19,10 @@ cd "${SCRIPT_DIR}" "${SCRIPT_DIR}"/mac-pre-vcpkg.sh "$@" -"${SCRIPT_DIR}"/external/mac_build_externals.sh - echo "Compiling native ruby extensions..." "$RUBY" "${SCRIPT_DIR}"/server/ruby/bin/compile-extensions.rb "${SCRIPT_DIR}"/mac-pre-translations.sh -"${SCRIPT_DIR}"/mac-pre-copy-binaries.sh "${SCRIPT_DIR}"/mac-pre-tau-prod-release.sh # Restore working directory as it was prior to this script running... diff --git a/app/win-clean.bat b/app/win-clean.bat index 93fbe876ce..7dfbc16e0d 100644 --- a/app/win-clean.bat +++ b/app/win-clean.bat @@ -5,9 +5,6 @@ cd %~dp0 @echo Cleaning out build dir.... rmdir build /s /q -@echo Cleaning out external\build dir.... -rmdir external\build /s /q - @echo Cleaning out BEAM distribution.... rmdir server\beam\tau\_build /s /q del server\beam\tau\priv\*.so server\beam\tau\priv\*.dylib server\beam\tau\priv\*.dll /s /q diff --git a/app/win-pre-copy-binaries.bat b/app/win-pre-copy-binaries.bat deleted file mode 100644 index 7cd3f0a487..0000000000 --- a/app/win-pre-copy-binaries.bat +++ /dev/null @@ -1,18 +0,0 @@ -set WORKING_DIR=%CD% - -cd %~dp0 - -REM Copy prebuilt native files to server -@echo Copying aubio to the server... -copy external\build\aubio-prefix\src\aubio-build\Release\aubio_onset.exe server\native\ - -@echo Copying all other native files to server... -xcopy /Y /I /R /E ..\prebuilt\windows\x64\*.* server\native - -@echo Copying sp_midi dll to the erlang bin directory... -xcopy /Y /I /R /E external\build\sp_midi-prefix\src\sp_midi-build\Release\*.dll server\beam\tau\priv\ - -@echo Copying sp_link dll to the erlang bin directory... -xcopy /Y /I /R /E external\build\sp_link-prefix\src\sp_link-build\Release\*.dll server\beam\tau\priv\ - -cd %WORKING_DIR% diff --git a/app/win-prebuild.bat b/app/win-prebuild.bat index 6e5193424f..88f556b9f3 100644 --- a/app/win-prebuild.bat +++ b/app/win-prebuild.bat @@ -3,9 +3,7 @@ set WORKING_DIR=%CD% cd %~dp0 call win-pre-vcpkg.bat -call external/win_x64_build_externals.bat call win-pre-translations.bat -call win-pre-copy-binaries.bat call win-pre-tau-prod-release.bat cd %WORKING_DIR% From a88f609ed06223fa258fbd13c306cf14e5c11159 Mon Sep 17 00:00:00 2001 From: SunderB <20426079+SunderB@users.noreply.github.com> Date: Mon, 9 May 2022 19:38:22 +0100 Subject: [PATCH 02/14] CMake - Fix directory paths for prebuilt binaries --- app/external/CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/external/CMakeLists.txt b/app/external/CMakeLists.txt index 38daaa66c6..1a0ca07dd9 100644 --- a/app/external/CMakeLists.txt +++ b/app/external/CMakeLists.txt @@ -171,14 +171,21 @@ add_dependencies(AubioBuilder aubio) # Copy prebuilt files if(WIN32) - add_custom_command( - TARGET AubioBuilder PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/windows/ ${CMAKE_CURRENT_SOURCE_DIR}/../server/native - ) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) # 64-bit + add_custom_command( + TARGET AubioBuilder PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/windows/x64/ ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/ + ) + elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) # 32-bit + add_custom_command( + TARGET AubioBuilder PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/windows/x86/ ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/ + ) + endif() elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin) # macOS add_custom_command( TARGET AubioBuilder PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/macos/ ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/ + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/macos/x64/ ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/ COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/supercollider/scsynth ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/scsynth COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/supercollider/extra-plugins/ ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/supercollider/plugins/ COMMAND ${CMAKE_COMMAND} -E rm -rf ${CMAKE_CURRENT_SOURCE_DIR}/../server/native/supercollider/extra-plugins From 590adaf68aa8a301f49944662b5b568753038866 Mon Sep 17 00:00:00 2001 From: SunderB <20426079+SunderB@users.noreply.github.com> Date: Mon, 9 May 2022 19:39:39 +0100 Subject: [PATCH 03/14] Fix typo in app/external/CMakeLists.txt Co-authored-by: Lily Foster --- app/external/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/external/CMakeLists.txt b/app/external/CMakeLists.txt index 1a0ca07dd9..e0c14f07d0 100644 --- a/app/external/CMakeLists.txt +++ b/app/external/CMakeLists.txt @@ -166,7 +166,7 @@ ExternalProject_Add(aubio # Kick off a generation by making a dummy/empty project add_library(AubioBuilder STATIC externals.cpp) -# Dependency ensures the externals are built${CMAKE_CURRENT_SOURCE_DIR}/../../prebuilt/macos/ +# Dependency ensures the externals are built add_dependencies(AubioBuilder aubio) # Copy prebuilt files From 9f25ebb6e35bb68cc6c676a66ff4bb7812742102 Mon Sep 17 00:00:00 2001 From: SunderB Date: Mon, 11 Jul 2022 22:50:46 +0100 Subject: [PATCH 04/14] Run pre-tau-prod-release after building so that the NIFs are present --- app/linux-build-gui.sh | 2 ++ app/linux-prebuild.sh | 1 - app/mac-prebuild.sh | 1 - app/win-build-gui.bat | 2 ++ app/win-prebuild.bat | 1 - 5 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/linux-build-gui.sh b/app/linux-build-gui.sh index a2f5f4a869..09248cdc08 100755 --- a/app/linux-build-gui.sh +++ b/app/linux-build-gui.sh @@ -6,5 +6,7 @@ WORKING_DIR="$(pwd)" cd "${SCRIPT_DIR}"/build cmake --build . --config Release +"${SCRIPT_DIR}"/linux-pre-tau-prod-release.sh "${args[@]}" + # Restore working directory as it was prior to this script running... cd "${WORKING_DIR}" diff --git a/app/linux-prebuild.sh b/app/linux-prebuild.sh index ac097fff87..58286b2388 100755 --- a/app/linux-prebuild.sh +++ b/app/linux-prebuild.sh @@ -34,7 +34,6 @@ echo "Compiling native ruby extensions..." ruby "${SCRIPT_DIR}"/server/ruby/bin/compile-extensions.rb "${SCRIPT_DIR}"/linux-pre-translations.sh "${args[@]}" -"${SCRIPT_DIR}"/linux-pre-tau-prod-release.sh "${args[@]}" # Restore working directory as it was prior to this script running... cd "${WORKING_DIR}" diff --git a/app/mac-prebuild.sh b/app/mac-prebuild.sh index b5ecbeca75..9ed6fbf06a 100755 --- a/app/mac-prebuild.sh +++ b/app/mac-prebuild.sh @@ -23,7 +23,6 @@ echo "Compiling native ruby extensions..." "$RUBY" "${SCRIPT_DIR}"/server/ruby/bin/compile-extensions.rb "${SCRIPT_DIR}"/mac-pre-translations.sh -"${SCRIPT_DIR}"/mac-pre-tau-prod-release.sh # Restore working directory as it was prior to this script running... cd "${WORKING_DIR}" diff --git a/app/win-build-gui.bat b/app/win-build-gui.bat index 45c0d3e71f..35a78d50a5 100644 --- a/app/win-build-gui.bat +++ b/app/win-build-gui.bat @@ -4,4 +4,6 @@ cd %~dp0 cd build cmake --build . --config Release +call win-pre-tau-prod-release.bat + cd %WORKING_DIR% diff --git a/app/win-prebuild.bat b/app/win-prebuild.bat index 88f556b9f3..0f99c7821d 100644 --- a/app/win-prebuild.bat +++ b/app/win-prebuild.bat @@ -4,6 +4,5 @@ cd %~dp0 call win-pre-vcpkg.bat call win-pre-translations.bat -call win-pre-tau-prod-release.bat cd %WORKING_DIR% From 1fa94acb4979ba6177486bbd13ed46d6c8791990 Mon Sep 17 00:00:00 2001 From: SunderB Date: Mon, 11 Jul 2022 22:58:02 +0100 Subject: [PATCH 05/14] Rename the NIFs so that they have the .so file extension on macOS The default file extension for dynamic libs on macOS is '.dylib'. However, Erlang expects '.so' on all UNIX-based platforms, so they need to be renamed to be found by Erlang. --- app/external/sp_link/CMakeLists.txt | 6 +++++- app/external/sp_midi/CMakeLists.txt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/external/sp_link/CMakeLists.txt b/app/external/sp_link/CMakeLists.txt index 67e5f84458..dcccbe7e40 100644 --- a/app/external/sp_link/CMakeLists.txt +++ b/app/external/sp_link/CMakeLists.txt @@ -76,4 +76,8 @@ elseif(UNIX) target_link_libraries(libsp_link Ableton::Link) endif(MSVC) -install(TARGETS libsp_link LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}) \ No newline at end of file +if(APPLE) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libsp_link.dylib DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME libsp_link.so) +else() + install(TARGETS libsp_link LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}) +endif() diff --git a/app/external/sp_midi/CMakeLists.txt b/app/external/sp_midi/CMakeLists.txt index 484145436a..e06260978f 100644 --- a/app/external/sp_midi/CMakeLists.txt +++ b/app/external/sp_midi/CMakeLists.txt @@ -92,4 +92,8 @@ elseif(UNIX) endif(USE_SYSTEM_RTMIDI) endif(MSVC) -install(TARGETS libsp_midi LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}) +if(APPLE) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libsp_midi.dylib DESTINATION ${CMAKE_INSTALL_PREFIX} RENAME libsp_midi.so) +else() + install(TARGETS libsp_midi LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}) +endif() From d291a06ace016240cbecba4397d2b2f1db52f930 Mon Sep 17 00:00:00 2001 From: SunderB Date: Mon, 11 Jul 2022 23:13:20 +0100 Subject: [PATCH 06/14] Remove redundant -r from an rm command in app/linux-clean.sh --- app/linux-clean.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/linux-clean.sh b/app/linux-clean.sh index 6a2091551f..17cf3c2f8c 100755 --- a/app/linux-clean.sh +++ b/app/linux-clean.sh @@ -9,7 +9,7 @@ rm -rf build echo "Cleaning out BEAM distribution..." rm -rf server/beam/tau/_build -rm -rf server/beam/tau/priv/*.{so,dylib,dll} +rm -f server/beam/tau/priv/*.{so,dylib,dll} if [ "$MIX_ENV" == dev ]; then rm -rf server/beam/tau/priv/static/assets rm -rf server/beam/tau/priv/static/cache_manifest.json From 234807ae9d5f9db05ce69e203ed8bc88a6791878 Mon Sep 17 00:00:00 2001 From: SunderB Date: Mon, 11 Jul 2022 23:31:35 +0100 Subject: [PATCH 07/14] Rename *-pre-tau-prod-release scripts to *-post-tau-prod-release The scripts are now run after the main build (at the end of *-build-gui). --- app/linux-build-gui.sh | 2 +- ...x-pre-tau-prod-release.sh => linux-post-tau-prod-release.sh} | 0 ...mac-pre-tau-prod-release.sh => mac-post-tau-prod-release.sh} | 0 app/{pi-pre-tau-prod-release.sh => pi-post-tau-prod-release.sh} | 0 app/win-build-gui.bat | 2 +- ...n-pre-tau-prod-release.bat => win-post-tau-prod-release.bat} | 0 6 files changed, 2 insertions(+), 2 deletions(-) rename app/{linux-pre-tau-prod-release.sh => linux-post-tau-prod-release.sh} (100%) mode change 100755 => 100644 rename app/{mac-pre-tau-prod-release.sh => mac-post-tau-prod-release.sh} (100%) mode change 100755 => 100644 rename app/{pi-pre-tau-prod-release.sh => pi-post-tau-prod-release.sh} (100%) mode change 100755 => 100644 rename app/{win-pre-tau-prod-release.bat => win-post-tau-prod-release.bat} (100%) diff --git a/app/linux-build-gui.sh b/app/linux-build-gui.sh index 09248cdc08..62bc6b2ffb 100755 --- a/app/linux-build-gui.sh +++ b/app/linux-build-gui.sh @@ -6,7 +6,7 @@ WORKING_DIR="$(pwd)" cd "${SCRIPT_DIR}"/build cmake --build . --config Release -"${SCRIPT_DIR}"/linux-pre-tau-prod-release.sh "${args[@]}" +"${SCRIPT_DIR}"/linux-post-tau-prod-release.sh "${args[@]}" # Restore working directory as it was prior to this script running... cd "${WORKING_DIR}" diff --git a/app/linux-pre-tau-prod-release.sh b/app/linux-post-tau-prod-release.sh old mode 100755 new mode 100644 similarity index 100% rename from app/linux-pre-tau-prod-release.sh rename to app/linux-post-tau-prod-release.sh diff --git a/app/mac-pre-tau-prod-release.sh b/app/mac-post-tau-prod-release.sh old mode 100755 new mode 100644 similarity index 100% rename from app/mac-pre-tau-prod-release.sh rename to app/mac-post-tau-prod-release.sh diff --git a/app/pi-pre-tau-prod-release.sh b/app/pi-post-tau-prod-release.sh old mode 100755 new mode 100644 similarity index 100% rename from app/pi-pre-tau-prod-release.sh rename to app/pi-post-tau-prod-release.sh diff --git a/app/win-build-gui.bat b/app/win-build-gui.bat index 35a78d50a5..23f2a10865 100644 --- a/app/win-build-gui.bat +++ b/app/win-build-gui.bat @@ -4,6 +4,6 @@ cd %~dp0 cd build cmake --build . --config Release -call win-pre-tau-prod-release.bat +call win-post-tau-prod-release.bat cd %WORKING_DIR% diff --git a/app/win-pre-tau-prod-release.bat b/app/win-post-tau-prod-release.bat similarity index 100% rename from app/win-pre-tau-prod-release.bat rename to app/win-post-tau-prod-release.bat From 57cc1eb7511736f3fe97d743db73c96a1b8d8308 Mon Sep 17 00:00:00 2001 From: SunderB Date: Tue, 12 Jul 2022 00:00:07 +0100 Subject: [PATCH 08/14] Add config option to win-build-gui.bat; remove redundant config from linux-build-gui.sh On Windows with MSVC, the build config is set at build time, while on macOS and Linux using make, the build config is set at configure time. --- app/linux-build-gui.sh | 2 +- app/win-build-gui.bat | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/linux-build-gui.sh b/app/linux-build-gui.sh index 62bc6b2ffb..805578ce32 100755 --- a/app/linux-build-gui.sh +++ b/app/linux-build-gui.sh @@ -4,7 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" WORKING_DIR="$(pwd)" cd "${SCRIPT_DIR}"/build -cmake --build . --config Release +cmake --build . "${SCRIPT_DIR}"/linux-post-tau-prod-release.sh "${args[@]}" diff --git a/app/win-build-gui.bat b/app/win-build-gui.bat index 23f2a10865..ec48c851c0 100644 --- a/app/win-build-gui.bat +++ b/app/win-build-gui.bat @@ -1,9 +1,14 @@ -set WORKING_DIR=%CD% +set WORKING_DIR=%CD% +set CONFIG=%1 cd %~dp0 + +if /I "%CONFIG%" == "" (set CONFIG=Release) + cd build -cmake --build . --config Release +cmake --build . --config %CONFIG% +cd %~dp0 call win-post-tau-prod-release.bat cd %WORKING_DIR% From 1004505aedfc562c7638752dddc31aa250edcb9f Mon Sep 17 00:00:00 2001 From: SunderB Date: Tue, 12 Jul 2022 00:05:09 +0100 Subject: [PATCH 09/14] CI: Use platform *-build-gui scripts, and set configs correctly --- .github/workflows/build.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be10b13516..1b07e033a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -156,7 +156,7 @@ jobs: CC: ${{ matrix.cc }} QT_INSTALL_LOCATION: ${{env.Qt6_DIR}} run: | - ./linux-config.sh + ./linux-config.sh --config ${{ matrix.build_type }} if: matrix.os == 'ubuntu-latest' # Run Configuration Config on Mac @@ -166,7 +166,7 @@ jobs: CC: ${{ matrix.cc }} QT_INSTALL_LOCATION: ${{env.Qt6_DIR}} run: | - ./mac-config.sh + ./mac-config.sh --config ${{ matrix.build_type }} if: matrix.os == 'macos-latest' # Run Configuration Config on Windows @@ -181,9 +181,20 @@ jobs: if: matrix.os == 'windows-latest' # Finally: Build - - name: Do build - working-directory: ${{github.workspace}}/app/build - run: cmake --build . --config ${{ matrix.build_type }} + - name: Build Linux + working-directory: ${{github.workspace}}/app + run: ./linux-build-gui.sh + if: matrix.os == 'ubuntu-latest' + + - name: Build Mac + working-directory: ${{github.workspace}}/app + run: ./mac-build-gui.sh + if: matrix.os == 'macos-latest' + + - name: Build Windows + working-directory: ${{github.workspace}}/app + run: win-build-gui.bat ${{ matrix.build_type }} + if: matrix.os == 'windows-latest' - name: BEAM Tests Windows shell: cmd From b36fb70172d2b73794068cbb26b1da8222721123 Mon Sep 17 00:00:00 2001 From: SunderB Date: Tue, 12 Jul 2022 00:25:24 +0100 Subject: [PATCH 10/14] Add execute permissions to all build scripts --- app/linux-post-tau-prod-release.sh | 0 app/mac-post-tau-prod-release.sh | 0 app/pi-post-tau-prod-release.sh | 0 app/win-build-all.bat | 0 app/win-build-gui.bat | 0 app/win-clean.bat | 0 app/win-config.bat | 0 app/win-post-tau-prod-release.bat | 0 app/win-pre-tau-dev-init.bat | 0 app/win-pre-translations.bat | 0 app/win-pre-vcpkg.bat | 0 app/win-prebuild.bat | 0 12 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 app/linux-post-tau-prod-release.sh mode change 100644 => 100755 app/mac-post-tau-prod-release.sh mode change 100644 => 100755 app/pi-post-tau-prod-release.sh mode change 100644 => 100755 app/win-build-all.bat mode change 100644 => 100755 app/win-build-gui.bat mode change 100644 => 100755 app/win-clean.bat mode change 100644 => 100755 app/win-config.bat mode change 100644 => 100755 app/win-post-tau-prod-release.bat mode change 100644 => 100755 app/win-pre-tau-dev-init.bat mode change 100644 => 100755 app/win-pre-translations.bat mode change 100644 => 100755 app/win-pre-vcpkg.bat mode change 100644 => 100755 app/win-prebuild.bat diff --git a/app/linux-post-tau-prod-release.sh b/app/linux-post-tau-prod-release.sh old mode 100644 new mode 100755 diff --git a/app/mac-post-tau-prod-release.sh b/app/mac-post-tau-prod-release.sh old mode 100644 new mode 100755 diff --git a/app/pi-post-tau-prod-release.sh b/app/pi-post-tau-prod-release.sh old mode 100644 new mode 100755 diff --git a/app/win-build-all.bat b/app/win-build-all.bat old mode 100644 new mode 100755 diff --git a/app/win-build-gui.bat b/app/win-build-gui.bat old mode 100644 new mode 100755 diff --git a/app/win-clean.bat b/app/win-clean.bat old mode 100644 new mode 100755 diff --git a/app/win-config.bat b/app/win-config.bat old mode 100644 new mode 100755 diff --git a/app/win-post-tau-prod-release.bat b/app/win-post-tau-prod-release.bat old mode 100644 new mode 100755 diff --git a/app/win-pre-tau-dev-init.bat b/app/win-pre-tau-dev-init.bat old mode 100644 new mode 100755 diff --git a/app/win-pre-translations.bat b/app/win-pre-translations.bat old mode 100644 new mode 100755 diff --git a/app/win-pre-vcpkg.bat b/app/win-pre-vcpkg.bat old mode 100644 new mode 100755 diff --git a/app/win-prebuild.bat b/app/win-prebuild.bat old mode 100644 new mode 100755 From 6773c19e7cd87e4aed1bcb85ff2737b372b7cfd1 Mon Sep 17 00:00:00 2001 From: SunderB Date: Tue, 12 Jul 2022 00:44:39 +0100 Subject: [PATCH 11/14] CI: Correct the shell for the Windows build step --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b07e033a2..a545b3dd79 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -193,6 +193,7 @@ jobs: - name: Build Windows working-directory: ${{github.workspace}}/app + shell: cmd run: win-build-gui.bat ${{ matrix.build_type }} if: matrix.os == 'windows-latest' From b472c6251293df5f5a0565d2be0ea9f4d1be0477 Mon Sep 17 00:00:00 2001 From: SunderB Date: Tue, 12 Jul 2022 09:37:14 +0100 Subject: [PATCH 12/14] Don't run *-post-tau-prod-release as a part of *-build-gui scripts --- .github/workflows/build.yml | 17 +++++++++++++++++ app/linux-build-gui.sh | 2 -- app/win-build-gui.bat | 3 --- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a545b3dd79..0d498f843b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,6 +197,23 @@ jobs: run: win-build-gui.bat ${{ matrix.build_type }} if: matrix.os == 'windows-latest' + # Build Tau server + - name: Build Tau Server (Linux) + working-directory: ${{github.workspace}}/app + run: ./linux-post-tau-prod-release.sh + if: matrix.os == 'ubuntu-latest' + + - name: Build Tau Server (Mac) + working-directory: ${{github.workspace}}/app + run: ./mac-post-tau-prod-release.sh + if: matrix.os == 'macos-latest' + + - name: Build Tau Server (Windows) + working-directory: ${{github.workspace}}/app + shell: cmd + run: win-post-tau-prod-release.bat + if: matrix.os == 'windows-latest' + - name: BEAM Tests Windows shell: cmd working-directory: ${{github.workspace}}/app/server/beam/tau diff --git a/app/linux-build-gui.sh b/app/linux-build-gui.sh index 805578ce32..c117dbfd61 100755 --- a/app/linux-build-gui.sh +++ b/app/linux-build-gui.sh @@ -6,7 +6,5 @@ WORKING_DIR="$(pwd)" cd "${SCRIPT_DIR}"/build cmake --build . -"${SCRIPT_DIR}"/linux-post-tau-prod-release.sh "${args[@]}" - # Restore working directory as it was prior to this script running... cd "${WORKING_DIR}" diff --git a/app/win-build-gui.bat b/app/win-build-gui.bat index ec48c851c0..b65c53bd79 100755 --- a/app/win-build-gui.bat +++ b/app/win-build-gui.bat @@ -8,7 +8,4 @@ if /I "%CONFIG%" == "" (set CONFIG=Release) cd build cmake --build . --config %CONFIG% -cd %~dp0 -call win-post-tau-prod-release.bat - cd %WORKING_DIR% From c8ff3d2beed58b2b95fc9a810d0144d28ec12a11 Mon Sep 17 00:00:00 2001 From: SunderB Date: Tue, 12 Jul 2022 10:20:58 +0100 Subject: [PATCH 13/14] Fix mac-post-tau-prod-release.sh --- app/mac-post-tau-prod-release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mac-post-tau-prod-release.sh b/app/mac-post-tau-prod-release.sh index fc3d07ef31..5464acda32 100755 --- a/app/mac-post-tau-prod-release.sh +++ b/app/mac-post-tau-prod-release.sh @@ -4,7 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" WORKING_DIR="$(pwd)" # Use generic linux clean script -"${SCRIPT_DIR}"/linux-pre-tau-prod-release.sh "$@" +"${SCRIPT_DIR}"/linux-post-tau-prod-release.sh "$@" # Restore working directory as it was prior to this script running... cd "${WORKING_DIR}" From 1680a109aa3669704102483bb790447f6dfec6f1 Mon Sep 17 00:00:00 2001 From: SunderB Date: Tue, 12 Jul 2022 10:22:13 +0100 Subject: [PATCH 14/14] Run *-post-tau-prod-release at the end of *-build-all; add argument support for mac-build-all.sh --- app/linux-build-all.sh | 1 + app/mac-build-all.sh | 7 ++++--- app/win-build-all.bat | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/linux-build-all.sh b/app/linux-build-all.sh index 2d4616f18d..c51dd9cde9 100755 --- a/app/linux-build-all.sh +++ b/app/linux-build-all.sh @@ -7,6 +7,7 @@ WORKING_DIR="$(pwd)" "${SCRIPT_DIR}"/linux-prebuild.sh "$@" "${SCRIPT_DIR}"/linux-config.sh "$@" "${SCRIPT_DIR}"/linux-build-gui.sh "$@" +"${SCRIPT_DIR}"/linux-post-tau-prod-release.sh "$@" # Restore working directory as it was prior to this script running... cd "${WORKING_DIR}" diff --git a/app/mac-build-all.sh b/app/mac-build-all.sh index 73fc4d5d9e..c977bae59c 100755 --- a/app/mac-build-all.sh +++ b/app/mac-build-all.sh @@ -4,9 +4,10 @@ set -e # Quit script on error SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" WORKING_DIR="$(pwd)" -"${SCRIPT_DIR}"/mac-prebuild.sh -"${SCRIPT_DIR}"/mac-config.sh -"${SCRIPT_DIR}"/mac-build-gui.sh +"${SCRIPT_DIR}"/mac-prebuild.sh "$@" +"${SCRIPT_DIR}"/mac-config.sh "$@" +"${SCRIPT_DIR}"/mac-build-gui.sh "$@" +"${SCRIPT_DIR}"/mac-post-tau-prod-release.sh "$@" # Restore working directory as it was prior to this script running... cd "${WORKING_DIR}" diff --git a/app/win-build-all.bat b/app/win-build-all.bat index fad67dfa33..8714526a94 100755 --- a/app/win-build-all.bat +++ b/app/win-build-all.bat @@ -3,5 +3,6 @@ set WORKING_DIR=%CD% call win-prebuild.bat call win-config.bat call win-build-gui.bat +call win-post-tau-prod-release.bat cd %WORKING_DIR%