Skip to content

Commit

Permalink
Merge pull request #397 from jpcima/editor-vstgui-lv2
Browse files Browse the repository at this point in the history
Editor vstgui lv2
  • Loading branch information
jpcima authored Sep 4, 2020
2 parents e2a0c52 + 2512d80 commit acce5d4
Show file tree
Hide file tree
Showing 46 changed files with 2,684 additions and 1,115 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
url = https://github.com/sfztools/vst3_public_sdk.git
shallow = true
[submodule "vst/external/VST_SDK/VST3_SDK/vstgui4"]
path = vst/external/VST_SDK/VST3_SDK/vstgui4
path = editor/external/vstgui4
url = https://github.com/sfztools/vstgui.git
shallow = true
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
env:
- INSTALL_DIR="sfizz-plugins-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
- ENABLE_VST_PLUGIN=OFF
- ENABLE_LV2_UI=OFF
addons:
apt:
packages:
Expand All @@ -125,6 +126,7 @@ jobs:
env:
- INSTALL_DIR="sfizz-plugins-${TRAVIS_BRANCH}-${TRAVIS_OS_NAME}-${TRAVIS_CPU_ARCH}"
- ENABLE_VST_PLUGIN=ON
- ENABLE_LV2_UI=ON
addons:
apt:
packages:
Expand Down
3 changes: 2 additions & 1 deletion .travis/prepare_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ buildenv make DESTDIR=${PWD}/${INSTALL_DIR} install

# Bundle LV2 dependencies
cd "${INSTALL_DIR}"/Library/Audio/Plug-Ins/LV2
dylibbundler -od -b -x sfizz.lv2/sfizz.so -d sfizz.lv2/libs/ -p @loader_path/libs/
dylibbundler -od -b -x sfizz.lv2/Contents/Binary/sfizz.so -d sfizz.lv2/Contents/libs/ -p @loader_path/../libs/
dylibbundler -od -b -x sfizz.lv2/Contents/Binary/sfizz_ui.so -d sfizz.lv2/Contents/libs/ -p @loader_path/../libs/
cd "${TRAVIS_BUILD_DIR}/build"

# Bundle VST3 dependencies
Expand Down
4 changes: 2 additions & 2 deletions .travis/script_mingw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ ${CROSS_COMPILE} == "mingw32" ]]; then
-DENABLE_LTO=OFF \
-DSFIZZ_JACK=OFF \
-DSFIZZ_VST=ON \
-DSFIZZ_STATIC_LIBSNDFILE=ON \
-DSFIZZ_STATIC_DEPENDENCIES=ON \
-DCMAKE_CXX_STANDARD=17 \
..
buildenv make -j$(nproc)
Expand All @@ -18,7 +18,7 @@ elif [[ ${CROSS_COMPILE} == "mingw64" ]]; then
-DENABLE_LTO=OFF \
-DSFIZZ_JACK=OFF \
-DSFIZZ_VST=ON \
-DSFIZZ_STATIC_LIBSNDFILE=ON \
-DSFIZZ_STATIC_DEPENDENCIES=ON \
-DCMAKE_CXX_STANDARD=17 \
..
buildenv make -j$(nproc)
Expand Down
2 changes: 1 addition & 1 deletion .travis/script_moddevices.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ mkdir -p build/${INSTALL_DIR} && cd build

buildenv mod-plugin-builder /usr/local/bin/cmake \
-DSFIZZ_SYSTEM_PROCESSOR=armv7-a \
-DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF ..
-DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_LV2_UI=OFF ..
buildenv mod-plugin-builder make -j$(nproc)
3 changes: 2 additions & 1 deletion .travis/script_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ mkdir -p build/${INSTALL_DIR} && cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DSFIZZ_JACK=OFF \
-DSFIZZ_VST="$ENABLE_VST_PLUGIN" \
-DSFIZZ_LV2_UI="$ENABLE_LV2_UI" \
-DSFIZZ_TESTS=OFF \
-DSFIZZ_SHARED=OFF \
-DSFIZZ_STATIC_LIBSNDFILE=ON \
-DSFIZZ_STATIC_DEPENDENCIES=ON \
-DCMAKE_CXX_STANDARD=17 \
..
make -j$(nproc)
2 changes: 1 addition & 1 deletion .travis/script_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake -DCMAKE_BUILD_TYPE=Release \
-DSFIZZ_JACK=OFF \
-DSFIZZ_TESTS=ON \
-DSFIZZ_SHARED=OFF \
-DSFIZZ_STATIC_LIBSNDFILE=OFF \
-DSFIZZ_STATIC_DEPENDENCIES=OFF \
-DSFIZZ_LV2=OFF \
-DCMAKE_CXX_STANDARD=17 \
..
Expand Down
13 changes: 6 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,19 @@ include (SfizzConfig)
# Build Options
set (BUILD_TESTING OFF CACHE BOOL "Disable Abseil's tests [default: OFF]")

# On macOS add the needed directories for both library and jack client
if (APPLE)
include_directories (SYSTEM /usr/local/opt/libsndfile/include)
link_directories (/usr/local/opt/libsndfile/lib)
endif()

option (ENABLE_LTO "Enable Link Time Optimization [default: ON]" ON)
option (SFIZZ_JACK "Enable JACK stand-alone build [default: ON]" ON)
option (SFIZZ_RENDER "Enable renderer of SMF files [default: ON]" ON)
option (SFIZZ_LV2 "Enable LV2 plug-in build [default: ON]" ON)
option (SFIZZ_LV2_UI "Enable LV2 plug-in user interface [default: ON]" ON)
option (SFIZZ_VST "Enable VST plug-in build [default: OFF]" OFF)
option (SFIZZ_AU "Enable AU plug-in build [default: OFF]" OFF)
option (SFIZZ_BENCHMARKS "Enable benchmarks build [default: OFF]" OFF)
option (SFIZZ_TESTS "Enable tests build [default: OFF]" OFF)
option (SFIZZ_DEVTOOLS "Enable developer tools build [default: OFF]" OFF)
option (SFIZZ_SHARED "Enable shared library build [default: ON]" ON)
option (SFIZZ_USE_VCPKG "Assume that sfizz is build using vcpkg [default: OFF]" OFF)
option (SFIZZ_STATIC_LIBSNDFILE "Link libsndfile statically [default: OFF]" OFF)
option (SFIZZ_STATIC_DEPENDENCIES "Link dependencies statically [default: OFF]" OFF)
option (SFIZZ_RELEASE_ASSERTS "Forced assertions in release builds [default: OFF]" OFF)

# Don't use IPO in non Release builds
Expand All @@ -51,6 +46,10 @@ add_subdirectory (src)
# Optional targets
add_subdirectory (clients)

if ((SFIZZ_LV2 AND SFIZZ_LV2_UI) OR SFIZZ_VST)
add_subdirectory (editor)
endif()

if (SFIZZ_LV2)
add_subdirectory (lv2)
endif()
Expand Down
2 changes: 0 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ build_script:
- cmd: cmake --build . --config Release -j

after_build:
- cmd: cp sfizz.lv2/Release/sfizz.dll sfizz.lv2/
- cmd: rm -rf sfizz.lv2/Release
- cmd: if %platform%==Win32 set RELEASE_ARCH=x86
- cmd: if %platform%==x64 set RELEASE_ARCH=x64
- cmd: 7z a sfizz-lv2-%APPVEYOR_REPO_TAG_NAME%-%RELEASE_ARCH%-msvc.zip sfizz.lv2
Expand Down
16 changes: 16 additions & 0 deletions cmake/LV2Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ else()
set (LV2PLUGIN_SPDX_LICENSE_ID "ISC")
endif()

if(SFIZZ_LV2_UI)
set(LV2PLUGIN_IF_ENABLE_UI "")
else()
set(LV2PLUGIN_IF_ENABLE_UI "#")
endif()

if(WIN32)
set(LV2_UI_TYPE "WindowsUI")
elseif(APPLE)
set(LV2_UI_TYPE "CocoaUI")
elseif(HAIKU)
set(LV2_UI_TYPE "BeUI")
else()
set(LV2_UI_TYPE "X11UI")
endif()

if (MSVC)
set (LV2PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lv2" CACHE STRING
"Install destination for LV2 bundle [default: ${CMAKE_INSTALL_PREFIX}/lv2}]")
Expand Down
12 changes: 10 additions & 2 deletions cmake/SfizzConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ if (WIN32)
add_compile_definitions(_WIN32_WINNT=0x601)
endif()

# Do not define macros `min` and `max`
if (WIN32)
add_compile_definitions(NOMINMAX)
endif()

# The variable CMAKE_SYSTEM_PROCESSOR is incorrect on Visual studio...
# see https://gitlab.kitware.com/cmake/cmake/issues/15170

Expand Down Expand Up @@ -48,6 +53,7 @@ function(sfizz_enable_fast_math NAME)
endif()
endfunction()

# The sndfile library
add_library(sfizz-sndfile INTERFACE)

if (SFIZZ_USE_VCPKG OR CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
Expand All @@ -59,11 +65,12 @@ else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(SNDFILE "sndfile" REQUIRED)
target_include_directories(sfizz-sndfile INTERFACE ${SNDFILE_INCLUDE_DIRS})
if (SFIZZ_STATIC_LIBSNDFILE)
if (SFIZZ_STATIC_DEPENDENCIES)
target_link_libraries(sfizz-sndfile INTERFACE ${SNDFILE_STATIC_LIBRARIES})
else()
target_link_libraries(sfizz-sndfile INTERFACE ${SNDFILE_LIBRARIES})
endif()
link_directories(${SNDFILE_LIBRARY_DIRS})
endif()


Expand Down Expand Up @@ -112,12 +119,13 @@ Build using LTO: ${ENABLE_LTO}
Build as shared library: ${SFIZZ_SHARED}
Build JACK stand-alone client: ${SFIZZ_JACK}
Build LV2 plug-in: ${SFIZZ_LV2}
Build LV2 user interface: ${SFIZZ_LV2_UI}
Build VST plug-in: ${SFIZZ_VST}
Build AU plug-in: ${SFIZZ_AU}
Build benchmarks: ${SFIZZ_BENCHMARKS}
Build tests: ${SFIZZ_TESTS}
Use vcpkg: ${SFIZZ_USE_VCPKG}
Statically link libsndfile: ${SFIZZ_STATIC_LIBSNDFILE}
Statically link dependencies: ${SFIZZ_STATIC_DEPENDENCIES}
Link libatomic: ${SFIZZ_LINK_LIBATOMIC}
Use clang libc++: ${USE_LIBCPP}
Release asserts: ${SFIZZ_RELEASE_ASSERTS}
Expand Down
21 changes: 21 additions & 0 deletions editor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
set(VSTGUI_BASEDIR "${CMAKE_CURRENT_SOURCE_DIR}/external/vstgui4")
include("cmake/Vstgui.cmake")

set(EDITOR_RESOURCES
logo.png
PARENT_SCOPE)

# editor
add_library(sfizz_editor STATIC EXCLUDE_FROM_ALL
src/editor/EditIds.h
src/editor/EditIds.cpp
src/editor/Editor.h
src/editor/Editor.cpp
src/editor/EditorController.h
src/editor/GUIComponents.h
src/editor/GUIComponents.cpp
src/editor/utility/vstgui_after.h
src/editor/utility/vstgui_before.h)
target_include_directories(sfizz_editor PUBLIC "src")
target_link_libraries(sfizz_editor PRIVATE sfizz-vstgui)
target_link_libraries(sfizz_editor PUBLIC absl::strings)
Loading

0 comments on commit acce5d4

Please sign in to comment.