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

WIP: Adds basic Linux support, it's building... #11

Open
wants to merge 1 commit into
base: main
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,19 @@ public/dsp.main.js
*.sln
*.sw?
*.swp

# CMake
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps

# native
native/SRVB_artefacts/
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ available at the command line:
* [CMake](https://cmake.org/)
* [Node.js](https://nodejs.org/en)
* Bash: the build steps below expect to run scripts in a Bash environment. For Windows machines, consider running the following steps in a Git Bash environment, or with WSL.
* For Linux you'll need the following:

```
sudo apt install -y build-essential \
gnome-devel \
libxinerama-dev \
libxrandr-dev \
libxcursor-dev \
libxft2-dev \
libwebkit2gtk-4.0-dev \
libgtk-3-dev \
libalsaplayer-dev \
libcurl4-dev-openssl \
libasound2-dev
```

Next, we fetch the SRVB project and its dependencies,

Expand Down
12 changes: 12 additions & 0 deletions native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ target_sources(${TARGET_NAME}
PluginProcessor.cpp
WebViewEditor.cpp)

if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
find_package(PkgConfig REQUIRED)
pkg_check_modules (gtk3 REQUIRED gtk+-3.0 IMPORTED_TARGET)
pkg_check_modules (webkit2 REQUIRED webkit2gtk-4.0 IMPORTED_TARGET)
target_link_libraries (${TARGET_NAME}
PRIVATE
pthread
PkgConfig::gtk3
PkgConfig::webkit2
)
endif()

target_include_directories(${TARGET_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/choc/gui
Expand Down
8 changes: 6 additions & 2 deletions native/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ juce::File getAssetsDirectory()
.getParentDirectory() // Plugin.vst3/Contents/<arch>/
.getParentDirectory() // Plugin.vst3/Contents/
.getChildFile("Resources/dist");
#elif JUCE_LINUX
auto assetsDir = juce::File::getSpecialLocation(juce::File::SpecialLocationType::currentExecutableFile) // $HOME/.vst3
.getParentDirectory() // Plugin.vst3/Contents/<arch>/
.getParentDirectory() // Plugin.vst3/Contents/
.getChildFile("Resources/dist");
#else
#error "We only support Mac and Windows here yet."
#error "We only support Mac, Windows, and Linux here yet."
#endif

return assetsDir;
}

Expand Down
4 changes: 4 additions & 0 deletions native/WebViewEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ WebViewEditor::WebViewEditor(juce::AudioProcessor* proc, juce::File const& asset
viewContainer.setView(webView->getViewHandle());
#elif JUCE_WINDOWS
viewContainer.setHWND(webView->getViewHandle());
#elif JUCE_LINUX
// TODO
// viewContainer.setView(webView->getViewHandle());
#else
#error "We only support MacOS and Windows here yet."

#endif

addAndMakeVisible(viewContainer);
Expand Down
4 changes: 3 additions & 1 deletion native/WebViewEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class WebViewEditor : public juce::AudioProcessorEditor
juce::NSViewComponent viewContainer;
#elif JUCE_WINDOWS
juce::HWNDComponent viewContainer;
#elif JUCE_LINUX
juce::XEmbedComponent viewContainer;
#else
#error "We only support MacOS and Windows here yet."
#error "We only support MacOS, Windows, and Linux here yet."
#endif
};
4 changes: 2 additions & 2 deletions scripts/build-native.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env zx


let rootDir = await path.resolve(__dirname, '..');
let buildDir = await path.join(rootDir, 'native', 'build', 'scripted');

Expand All @@ -16,5 +15,6 @@ cd(buildDir);
let buildType = argv.dev ? 'Debug' : 'Release';
let devFlag = argv.dev ? '-DELEM_DEV_LOCALHOST=1' : '';


await $`cmake -DCMAKE_BUILD_TYPE=${buildType} -DCMAKE_INSTALL_PREFIX=./out/ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 ${devFlag} ../..`;
await $`cmake --build . --config ${buildType} -j 4`;
await $`cmake --build ../.. --config ${buildType} -j 4`;