Skip to content

Commit

Permalink
Building for windows and linux (0.0.1) (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
actondev authored Sep 12, 2020
1 parent bca7e91 commit 4e407e7
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ imgui.ini
*.rpp-bak
*.RPP-bak
*.kdev4
*.tar.gz
*.zip
80 changes: 73 additions & 7 deletions dev.org
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
ln -s `readlink -f ../iPlug2` subprojects/iPlug2
ln -s `readlink -f ../s7-imgui` subprojects/s7_imgui
ln -s `readlink -f ../s7` subprojects/s7
ln -s `readlink -f ../SDL` subprojects/sdl2
ln -s `readlink -f ../SDL_net` subprojects/sdl_net
ln -s `readlink -f ../imgui` subprojects/imgui
ln -s `readlink -f ../SFML` subprojects/SFML

Expand All @@ -20,7 +18,9 @@ ln -s `readlink -f ../nativefiledialog` subprojects/nfd
Necessary s7-imgui scheme files: contain imgui macros etc.
#+BEGIN_SRC sh
ln -s `readlink -f subprojects/s7_imgui/src/scheme/aod` src/scheme/aod
ln -s `readlink -f src/scheme/` build/scheme
ln -s `readlink -f src/scheme/` build/s7-reaper
# validate
ls build/scheme -alL
#+END_SRC

** Building
Expand All @@ -32,14 +32,16 @@ meson setup --wipe build
# to cleanup/regenerate
rm -rf build
#+END_SRC

** Launching REAPER
(pardon the hardcoded reaper path for now)
#+BEGIN_SRC sh
# installing
ln -s `readlink -f build/reaper_s7-reaper-repl.so` ~/Downloads/reaper_linux_x86_64/REAPER/Plugins
# scheme files: available in Plugins/s7_reaper
ln -s `readlink -f src/scheme/` ~/Downloads/reaper_linux_x86_64/REAPER/Plugins/s7_reaper
ln -s `readlink -f build/reaper_s7-reaper.so` ~/Downloads/reaper_linux_x86_64/REAPER/Plugins
# scheme files: available in Plugins/s7-reaper
ln -s `readlink -f src/scheme/` ~/Downloads/reaper_linux_x86_64/REAPER/Plugins/s7-reaper
# ooor, in UserPlugins folder
ln -s `readlink -f build/reaper_s7-reaper.so` ~/.config/REAPER/UserPlugins
ln -s `readlink -f src/scheme/` ~/.config/REAPER/UserPlugins/s7-reaper

~/Downloads/reaper_linux_x86_64/REAPER/reaper

Expand Down Expand Up @@ -82,7 +84,71 @@ x
(rpr/UpdateArrange)
#+END_SRC

** Zip tar build bundle
#+BEGIN_SRC sh
tar -czvf s7-reaper.tar.gz -C build --dereference --exclude=.gitignore reaper_s7-reaper.so s7-reaper
#+END_SRC

*** COMMENT versioned
#+BEGIN_SRC sh :var version=(read-string "version: ") :results silent
tar -czvf "s7-reaper_linux_${version}.tar.gz" -C build --dereference --exclude=.gitignore reaper_s7-reaper.so s7-reaper
#+END_SRC
* Windows
** Setup & build project
#+BEGIN_SRC sh :session *s7-reaper-vs*
cmd //k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64

meson setup build --backend vs
meson compile -C build

# useful commands
meson setup build --reconfigure --backend vs
meson setup build --wipe --backend vs
rm -rf build
#+END_SRC

** Necessary symlinks
#+BEGIN_SRC sh :session *s7-reaper-vs*
cmd
mklink /J src\scheme\aod subprojects\s7_imgui\src\scheme\aod
mklink /J build\s7-reaper src\scheme
exit
#+END_SRC
** Launching REAPER
(pardon the hardcoded reaper path for now)
#+BEGIN_SRC sh :session *s7-reaper-vs*

ln -s `readlink -f build/reaper_s7-reaper.so` ~/Downloads/reaper_linux_x86_64/REAPER/Plugins
# scheme files: available in Plugins/s7-reaper
ln -s `readlink -f src/scheme/` ~/Downloads/reaper_linux_x86_64/REAPER/Plugins/s7-reaper

~/Downloads/reaper_linux_x86_64/REAPER/reaper

~/Downloads/reaper_linux_x86_64/REAPER/reaper test/demo-regions.rpp
#+END_SRC


#+BEGIN_SRC sh :session *s7-reaper-cmd*
cmd
# fuck that's not working, do it by hand
mklink W:\DAW\Reaper\Plugins\reaper_s7-reaper.dll build\reaper_s7-reaper.dll

mklink /J W:\DAW\Reaper\Plugins\s7-reaper src\scheme
mklink /h
W:\DAW\Reaper\reaper.exe

exit
cp build/reaper_s7-reaper.dll /w/DAW/Reaper/Plugins/
/w/DAW/Reaper/reaper
#+END_SRC
** Zip build bundle
#+BEGIN_SRC sh
cd build && zip ../s7-reaper.zip -r reaper_s7-reaper.dll s7-reaper -x "*.gitignore" && cd ..
#+END_SRC
*** COMMENT versioned
#+BEGIN_SRC sh :var version=(read-string "version: ") :results silent
cd build && zip "../s7-reaper_win_${version}.zip" -r reaper_s7-reaper.dll s7-reaper -x "*.gitignore" && cd ..
#+END_SRC
* COMMENT Local variables
# Local Variables:
# eval: (aod.org-babel/generate-call-buttons)
Expand Down
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('s7-reaper-repl', 'cpp', 'c',
project('s7-reaper', 'cpp', 'c',
default_options: [
'cpp_std=c++17',
'default_library=static',]
Expand All @@ -13,7 +13,7 @@ s7_imgui_dep = s7_imgui.get_variable('s7_imgui_dep')
subdir('src')

app = shared_library(
'reaper_s7-reaper-repl',
'reaper_s7-reaper',
name_prefix: '', # skipping the lib prefix in linux
dependencies: [
iplug2_proj.get_variable('iplug2_RPR_dep'),
Expand Down
2 changes: 1 addition & 1 deletion src/ReaperRepl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ReaperRepl::ReaperRepl(reaper_plugin_info_t* pRec)
printf("path is %s\n", path.c_str());

fs::path base_path = fs::path(path).remove_filename();
fs::path scheme_path = base_path / "s7_reaper";
fs::path scheme_path = base_path / "s7-reaper";
cerr << "scheme path is " << scheme_path << '\n';

sc = aod::s7::init(scheme_path);
Expand Down
2 changes: 1 addition & 1 deletion src/s7_reaper/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void init(reaper_plugin_info_t* pRec, std::string file) {
std::string path = s7_reaper::path::get();

fs::path base_path = fs::path(path).remove_filename();
fs::path scheme_path = base_path / "s7_reaper";
fs::path scheme_path = base_path / "s7-reaper";

s7_scheme* sc = aod::s7::init(scheme_path);
// passing NULL instance
Expand Down
21 changes: 8 additions & 13 deletions src/s7_reaper/path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,30 @@ std::string get() {

return path;
#elif defined(_WIN32)
// TODOOOOO

TCHAR path[2048];
GetModuleFileName(NULL, path, 2048);
std::string path_str = path;

char path_char[MAX_PATH];
std::string path_str;
HMODULE hm = NULL;

if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCSTR)&aod::vst3::path, &hm) == 0)
// pointing to our get function here
(LPCSTR)&get, &hm) == 0)
{
int ret = GetLastError();
fprintf(stderr, "GetModuleHandle failed, error = %d\n", ret);
// Return or however you want to handle an error.
return path_str;
}
if (GetModuleFileName(hm, path, sizeof(path_char)) == 0)
if (GetModuleFileName(hm, path_char, sizeof(path_char)) == 0)
{
int ret = GetLastError();
fprintf(stderr, "GetModuleFileName failed, error = %d\n", ret);
// Return or however you want to handle an error.
return path_str;
}
//fprintf(stderr, "Got vst3 path %s\n", path_char);


path_str = path_char;
return path_str;
#else
#error "aod::vst3::path() not implemented in this platform"
#error "s7_reaper::path::get() not implemented in this platform"
#endif
}

Expand Down
4 changes: 4 additions & 0 deletions subprojects/SFML.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[wrap-git]
url = https://github.com/SFML/SFML.git
revision = 2.5.1
depth = 1
6 changes: 2 additions & 4 deletions subprojects/iPlug2.wrap
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[wrap-git]
url = https://github.com/actonDev/iPlug2.git
# TODO: use a tag when things are ~stable
# for now using a symlink to my iPlug2 repo
depth = 1
revision = feature/meson-and-linux-nogui
revision = feature/meson-and-linux-nogui
depth = 1
11 changes: 7 additions & 4 deletions subprojects/imgui.wrap
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[wrap-git]
url = https://github.com/actonDev/imgui.git
# contains fixes about how the mouse events are handled
# needed for the vst
# if not.. some hacks for the input focus had to be done
revision = feature/meson-sdl
# contains a patch with thread_local:
# - imgui context is thread_local
# - opengl2 impl global variables thread_local
# revision = feature/meson+thread_local
# depth = 1
# c6411cd : feature/meson+thread_local 12/09/2020
revision = c6411cdb
11 changes: 8 additions & 3 deletions subprojects/s7_imgui.wrap
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
[wrap-git]
url = https://github.com/actonDev/s7-imgui.git
#WIP.. this changes fast
revision = feature/c-bindings-s7-work-etc
depth = 1
# WIP.. this changes fast
# revision = feature/c-bindings-s7-work-etc
# SFML work (migrated from SDL)
revision = 4515e47
# Note: cannot use commit ids with depth=1
# https://mesonbuild.com/Wrap-dependency-system-manual.html
# depth - shallowly clone the repository to X number of commits. Note that git always allow shallowly cloning branches, but in order to clone commit ids shallowly, the server must support
# depth = 1
6 changes: 0 additions & 6 deletions subprojects/sdl2.wrap

This file was deleted.

4 changes: 0 additions & 4 deletions subprojects/sdl_net.wrap

This file was deleted.

0 comments on commit 4e407e7

Please sign in to comment.