Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake generated files for the workflows in iPlugOOS temmplate project #7

Open
wants to merge 2 commits into
base: cmake
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
74 changes: 74 additions & 0 deletions TemplateProject/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 ${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(<target_name> <app|vst2|vst3|...>) 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 ${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)

# 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()
50 changes: 25 additions & 25 deletions TemplateProject/scripts/makedist-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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

#---------------------------------------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion TemplateProject/scripts/makedist-win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down