From afe1398afc145e1ed05fd4bbeaa2c0f7ec3d601b Mon Sep 17 00:00:00 2001 From: Oli Larkin Date: Sun, 22 Jan 2023 23:25:50 +0100 Subject: [PATCH 1/2] Add CMakelists.txt --- TemplateProject/CMakeLists.txt | 74 ++++++++++++++++++++++++++++++++++ iPlug2 | 2 +- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 TemplateProject/CMakeLists.txt diff --git a/TemplateProject/CMakeLists.txt b/TemplateProject/CMakeLists.txt new file mode 100644 index 0000000..588a9d9 --- /dev/null +++ b/TemplateProject/CMakeLists.txt @@ -0,0 +1,74 @@ +cmake_minimum_required(VERSION 3.11 FATAL_ERROR) +cmake_policy(SET CMP0091 NEW) + +######### + +# To setup the build (change CMAKE_BUILD_TYPE as desired): +# cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug +# To build the VST2 version: +# cmake --build build --target vst2 +# To build the VST3 version: +# cmake --build build --target vst3 +# To build the AUv2 version (macOS only): +# cmake --build build --target auv2 + +project(TemplateProject VERSION 1.0.0 LANGUAGES C CXX) + +set(IPLUG2_DIR ${CMAKE_SOURCE_DIR}/../iPlug2) +include(${IPLUG2_DIR}/iPlug2.cmake) +find_package(iPlug2) +#find_package(iPlug2 REQUIRED COMPONENTS Skia) + +set(PROJECT_DIR "${CMAKE_SOURCE_DIR}") +set(SRC_FILES + "${PROJECT_DIR}/config.h" + "${PROJECT_DIR}/TemplateProject.h" + "${PROJECT_DIR}/TemplateProject.cpp" +) +source_group(TREE ${PROJECT_DIR} FILES ${SRC_FILES}) + +set(RESOURCES + "${PROJECT_DIR}/resources/fonts/Roboto-Regular.ttf" +) + +# While not required, creating a base interface for includes and settings seems like a good idea. +add_library(_base INTERFACE) +# iplug_target_add() is a shorthand function for adding sources and include directories, +# linking libraries, adding resources, setting compile options, etc. +iplug_target_add(_base INTERFACE + INCLUDE ${PROJECT_DIR} ${PROJECT_DIR}/resources + LINK iPlug2_NanoVG_GL2 + FEATURE cxx_std_17) + +# For typing convenience the TARGET name is put into a variable. +set(TARGET app) +add_executable(${TARGET} WIN32 MACOSX_BUNDLE ${SRC_FILES}) +iplug_target_add(${TARGET} PUBLIC LINK iPlug2_APP _base RESOURCE ${RESOURCES}) +# You MUST call iplug_configure_target( ) for things to build correctly. +iplug_configure_target(${TARGET} app) + +# set(TARGET vst2) +# add_library(${TARGET} MODULE ${SRC_FILES}) +# iplug_target_add(${TARGET} PUBLIC LINK iPlug2_VST2 _base RESOURCE ${RESOURCES}) +# iplug_configure_target(${TARGET} vst2) + +set(TARGET vst3) +add_library(${TARGET} MODULE ${SRC_FILES}) +iplug_target_add(${TARGET} PUBLIC LINK iPlug2_VST3 _base RESOURCE ${RESOURCES}) +iplug_configure_target(${TARGET} vst3) + +# set(TARGET clap) +# add_library(${TARGET} MODULE ${SRC_FILES}) +# iplug_target_add(${TARGET} PUBLIC LINK iPlug2_CLAP _base RESOURCE ${RESOURCES}) +# iplug_configure_target(${TARGET} clap) + +if (CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(TARGET auv2) + add_library(${TARGET} MODULE ${SRC_FILES}) + iplug_target_add(${TARGET} PUBLIC LINK iPlug2_AUv2 _base RESOURCE ${RESOURCES}) + iplug_configure_target(${TARGET} auv2) +endif() + +if (WIN32) + set(CMAKE_RC_FLAGS "/I${PROJECT_DIR}/resources /I${PROJECT_DIR}/resources/fonts /I${PROJECT_DIR}/resources/img ${CMAKE_RC_FLAGS}") +endif() diff --git a/iPlug2 b/iPlug2 index 97ee27e..b1d85a5 160000 --- a/iPlug2 +++ b/iPlug2 @@ -1 +1 @@ -Subproject commit 97ee27e1640b870a206df61c347c76872fdc2a45 +Subproject commit b1d85a5da458213eed34187ea2eec8953d7b1e86 From dae017a5cd7941b223e0dcfd72686ce703278985 Mon Sep 17 00:00:00 2001 From: singularity Date: Sat, 25 Feb 2023 16:00:32 +0000 Subject: [PATCH 2/2] cmake generated files for the workflows in iPlugOOS temmplate project --- .github/workflows/build-native.yml | 8 +++- TemplateProject/CMakeLists.txt | 4 +- TemplateProject/scripts/makedist-mac.sh | 50 ++++++++++++------------ TemplateProject/scripts/makedist-win.bat | 2 +- iPlug2 | 2 +- 5 files changed, 35 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build-native.yml b/.github/workflows/build-native.yml index 2bfa63b..02003e7 100644 --- a/.github/workflows/build-native.yml +++ b/.github/workflows/build-native.yml @@ -45,7 +45,9 @@ jobs: - name: Build macOS if: matrix.os == 'macOS-latest' run: | - cd ${{env.PROJECT_NAME}}/scripts + cd ${{env.PROJECT_NAME}} + cmake -G Xcode -S . -B build-mac + cd scripts ./makedist-mac.sh full zip shell: bash @@ -56,7 +58,9 @@ jobs: - name: Build Windows if: matrix.os == 'windows-latest' run: | - cd ${{env.PROJECT_NAME}}\scripts + cd ${{env.PROJECT_NAME}} + cmake -S . -B build-win + cd scripts .\makedist-win.bat full zip shell: pwsh diff --git a/TemplateProject/CMakeLists.txt b/TemplateProject/CMakeLists.txt index 588a9d9..3c4c0c8 100644 --- a/TemplateProject/CMakeLists.txt +++ b/TemplateProject/CMakeLists.txt @@ -41,7 +41,7 @@ iplug_target_add(_base INTERFACE FEATURE cxx_std_17) # For typing convenience the TARGET name is put into a variable. -set(TARGET app) +set(TARGET ${PROJECT_NAME}-app) add_executable(${TARGET} WIN32 MACOSX_BUNDLE ${SRC_FILES}) iplug_target_add(${TARGET} PUBLIC LINK iPlug2_APP _base RESOURCE ${RESOURCES}) # You MUST call iplug_configure_target( ) for things to build correctly. @@ -52,7 +52,7 @@ iplug_configure_target(${TARGET} app) # iplug_target_add(${TARGET} PUBLIC LINK iPlug2_VST2 _base RESOURCE ${RESOURCES}) # iplug_configure_target(${TARGET} vst2) -set(TARGET vst3) +set(TARGET ${PROJECT_NAME}-vst3) add_library(${TARGET} MODULE ${SRC_FILES}) iplug_target_add(${TARGET} PUBLIC LINK iPlug2_VST3 _base RESOURCE ${RESOURCES}) iplug_configure_target(${TARGET} vst3) diff --git a/TemplateProject/scripts/makedist-mac.sh b/TemplateProject/scripts/makedist-mac.sh index 0f3d152..2de416d 100755 --- a/TemplateProject/scripts/makedist-mac.sh +++ b/TemplateProject/scripts/makedist-mac.sh @@ -6,9 +6,9 @@ BASEDIR=$(dirname $0) cd $BASEDIR/.. -if [ -d build-mac ]; then - sudo rm -f -R build-mac -fi +# if [ -d build-mac ]; then +# sudo rm -f -R build-mac +# fi #--------------------------------------------------------------------------------------------------------- #variables @@ -117,37 +117,37 @@ touch *.cpp #--------------------------------------------------------------------------------------------------------- #remove existing binaries -echo "remove existing binaries" -echo "" +# echo "remove existing binaries" +# echo "" -if [ -d $APP ]; then - sudo rm -f -R -f $APP -fi +# if [ -d $APP ]; then +# sudo rm -f -R -f $APP +# fi -if [ -d $AU ]; then - sudo rm -f -R $AU -fi +# if [ -d $AU ]; then +# sudo rm -f -R $AU +# fi -if [ -d $VST2 ]; then - sudo rm -f -R $VST2 -fi +# if [ -d $VST2 ]; then +# sudo rm -f -R $VST2 +# fi -if [ -d $VST3 ]; then - sudo rm -f -R $VST3 -fi +# if [ -d $VST3 ]; then +# sudo rm -f -R $VST3 +# fi -if [ -d "${AAX}" ]; then - sudo rm -f -R "${AAX}" -fi +# if [ -d "${AAX}" ]; then +# sudo rm -f -R "${AAX}" +# fi -if [ -d "${AAX_FINAL}" ]; then - sudo rm -f -R "${AAX_FINAL}" -fi +# if [ -d "${AAX_FINAL}" ]; then +# sudo rm -f -R "${AAX_FINAL}" +# fi #--------------------------------------------------------------------------------------------------------- # build xcode project. Change target to build individual formats, or add to All target in the xcode project -xcodebuild -project ./projects/$PLUGIN_NAME-macOS.xcodeproj -xcconfig ./config/$PLUGIN_NAME-mac.xcconfig DEMO_VERSION=$DEMO -target "All" -UseModernBuildSystem=NO -configuration Release | tee build-mac.log | xcpretty #&& exit ${PIPESTATUS[0]} +xcodebuild -project ./build-mac/$PLUGIN_NAME.xcodeproj -xcconfig ./config/$PLUGIN_NAME-mac.xcconfig DEMO_VERSION=$DEMO -alltargets -UseModernBuildSystem=NO -configuration RelWithDebInfo | tee build-mac.log | xcpretty #&& exit ${PIPESTATUS[0]} if [ "${PIPESTATUS[0]}" -ne "0" ]; then echo "ERROR: build failed, aborting" @@ -337,7 +337,7 @@ sudo rm -R -f build-mac/*-dSYMs.zip echo "packaging dSYMs" echo "" -zip -r ./build-mac/$ARCHIVE_NAME-dSYMs.zip ./build-mac/*.dSYM +zip -r ./build-mac/$ARCHIVE_NAME-dSYMs.zip ./build-mac/**/*.dSYM #--------------------------------------------------------------------------------------------------------- diff --git a/TemplateProject/scripts/makedist-win.bat b/TemplateProject/scripts/makedist-win.bat index d0b8a26..81baf1f 100644 --- a/TemplateProject/scripts/makedist-win.bat +++ b/TemplateProject/scripts/makedist-win.bat @@ -81,7 +81,7 @@ REM msbuild TemplateProject.sln /p:configuration=release /p:platform=win32 /nolo REM echo Building 64 bit binaries... REM add projects with /t to build VST2 and AAX -msbuild TemplateProject.sln /t:TemplateProject-app;TemplateProject-vst3 /p:configuration=release /p:platform=x64 /nologo /verbosity:minimal /fileLogger /m /flp:logfile=build-win.log;errorsonly;append +msbuild build-win/TemplateProject.sln /t:TemplateProject-app;TemplateProject-vst3 /p:configuration=release /p:platform=x64 /nologo /verbosity:minimal /fileLogger /m /flp:logfile=build-win.log;errorsonly;append REM --echo Copying AAX Presets diff --git a/iPlug2 b/iPlug2 index b1d85a5..512f6a4 160000 --- a/iPlug2 +++ b/iPlug2 @@ -1 +1 @@ -Subproject commit b1d85a5da458213eed34187ea2eec8953d7b1e86 +Subproject commit 512f6a4f0af1645669022fa3e8d022811ba333c5