Old 10-07-2018, 07:55 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,104
Default Can someone help me build an extension for MacOS?

I would like to release an extension, js_ReaScriptAPI, via ReaPack, and I would appreciate it very much if someone could build the extension for MacOS.

The extension builds without any complaints on Linux and Windows, so I expect that it wouldn't be difficult to build on MacOS either.

The source files are in https://github.com/ReaTeam/Extension...s_ReaScriptAPI.

In addition to these files, the extension needs Cockos's WDL/swell. On Linux, the swell source files can be compiled using the included makefile, but I'm not sure how it would work on Mac. After compilation, the extension only needs to be linked to "swell-modstub-generic".

On Linux, I use the command
Code:
g++ -fPIC -shared js_ReaScriptAPI.cpp -I"path/to/WDL/folder" "path/to/WDL/swell/swell-modstub-generic.o" -std=gnu++11 -m32 -o reaper_js_ReaScriptAPI32.so
juliansader is offline   Reply With Quote
Old 10-07-2018, 09:08 AM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,198
Default

I can give it a go tomorrow.

A ReaTeam/Extensions repository is a great idea (I'll add it to the default list once it's ready enough). However, I don't think it should host source code (of multiple extensions). This would quickly lead to a big mess. (Also compiled executables ideally should not be put in version control.)

I suggest creating a work repository under your own GitHub account and reserving ReaTeam/Extensions exclusively for ReaPack releases (.ext package files linking to binaries hosted elsewhere).

Last edited by cfillion; 10-07-2018 at 09:15 AM.
cfillion is offline   Reply With Quote
Old 10-07-2018, 02:05 PM   #3
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 449
Default

If it helps, we at Ultraschall have a plugin for ourselves, which runs on Windows and Mac.
You may find useful hints for that:

https://github.com/Ultraschall/ultra.../REAPER/Plugin
__________________
Reaper Fun Fact of the week: The maximum number of scripts you can add to each section is 11997.
mespotine is offline   Reply With Quote
Old 10-07-2018, 04:43 PM   #4
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,198
Default

Done (using clang version 6.0.1). https://cfillion.ca/files/js_ReaScriptAPI/

Code:
function build {
  clang \
    -fPIC -O2 -std=c++17 -stdlib=libc++ -arch "$1" -mmacosx-version-min=10.5 \
    -DSWELL_PROVIDED_BY_APP -Ivendor/WDL \
    -dynamiclib -lc++ -framework AppKit \
    vendor/WDL/WDL/swell/swell-modstub.mm js_ReaScriptAPI.cpp \
    -o "reaper_js_ReaScriptAPI$2.dylib"
}

build x86_64 64
build i386   32
It outputted a few useful warnings (it found two typos and a memory leak):

Code:
In file included from js_ReaScriptAPI.cpp:1:
./stdafx.h:24:9: warning: 'SWELL_PROVIDED_BY_APP' macro redefined [-Wmacro-redefined]
#define SWELL_PROVIDED_BY_APP
        ^
<command line>:1:9: note: previous definition is here
#define SWELL_PROVIDED_BY_APP 1
        ^
In file included from js_ReaScriptAPI.cpp:1:
In file included from ./stdafx.h:44:
./js_ReaScriptAPI_namespace.h:1:9: warning: 'JS_REASCRIPTAPI_NAMESPACE' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef JS_REASCRIPTAPI_NAMESPACE
        ^~~~~~~~~~~~~~~~~~~~~~~~~
./js_ReaScriptAPI_namespace.h:2:9: note: 'JS_REACSRIPTAPI_NAMESPACE' is defined here; did you mean 'JS_REASCRIPTAPI_NAMESPACE'?
#define JS_REACSRIPTAPI_NAMESPACE
        ^~~~~~~~~~~~~~~~~~~~~~~~~
        JS_REASCRIPTAPI_NAMESPACE
In file included from js_ReaScriptAPI.cpp:1:
In file included from ./stdafx.h:47:
./js_ReaScriptAPI_def.h:1:9: warning: 'JS_REASCRIPTAPI_DEF' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef JS_REASCRIPTAPI_DEF
        ^~~~~~~~~~~~~~~~~~~
./js_ReaScriptAPI_def.h:2:9: note: 'JS_REACSRIPTAPI_DEF' is defined here; did you mean 'JS_REASCRIPTAPI_DEF'?
#define JS_REACSRIPTAPI_DEF
        ^~~~~~~~~~~~~~~~~~~
        JS_REASCRIPTAPI_DEF
js_ReaScriptAPI.cpp:1518:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete p;
        ^
              []
js_ReaScriptAPI.cpp:1513:13: note: allocated with 'new[]' here
        POINT* p = new POINT[numPoints];
                   ^
js_ReaScriptAPI.cpp:1544:2: warning: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Wmismatched-new-delete]
        delete p;
        ^
              []
js_ReaScriptAPI.cpp:1540:13: note: allocated with 'new[]' here
        POINT* p = new POINT[numPoints];
                   ^
5 warnings generated.
(Alternatively you could use a std::vector or a smart pointer – std::unique_ptr in this case – to safely manage that array of POINTs.)

Last edited by cfillion; 10-08-2018 at 06:31 AM.
cfillion is offline   Reply With Quote
Old 10-08-2018, 01:37 AM   #5
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,104
Default

Quote:
Originally Posted by cfillion View Post
I suggest creating a work repository under your own GitHub account and reserving ReaTeam/Extensions exclusively for ReaPack releases (.ext package files linking to binaries hosted elsewhere).
I have moved the source files to https://github.com/juliansader/ReaEx.../Source%20code, and will also store the binaries there in my account.


Quote:
Originally Posted by cfillion View Post
It outputted a few useful warnings (it found two typos and a memory leak):
Whoops. I uploaded a new fixed version of the source files.
juliansader is offline   Reply With Quote
Old 10-08-2018, 05:35 AM   #6
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,344
Default

I changed the code that was using new[] and delete[] to use std::vector, there's pretty much never a reason to use the old raw array style. I suppose you can accept the pull request I did at Github?
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 10-08-2018, 07:08 AM   #7
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,104
Default

Quote:
Originally Posted by Xenakios View Post
I changed the code that was using new[] and delete[] to use std::vector, there's pretty much never a reason to use the old raw array style. I suppose you can accept the pull request I did at Github?
Merged!
juliansader is offline   Reply With Quote
Old 10-08-2018, 10:05 AM   #8
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,344
Default

I also did macOs builds based on cfillion's shell script code. However, the XCode/Clang version I am using requires OS-X 10.7 as the minimum version to run the dylibs. Unfortunately, apparently some Reaper users have got stuck with the now 7 years old OS-X 10.6.8. Personally, I don't feel an obligation to have things working for those users, but you may of course have a different view on that.
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is online now   Reply With Quote
Old 10-09-2018, 12:54 AM   #9
doppelganger
Human being with feelings
 
Join Date: Feb 2017
Posts: 298
Default

i see , you wrote in file stdafx.h:
#ifndef JS_REASCRIPTAPI_STDAFX
#define JS_REASCRIPTAPI_STDAFX
Shouldn't that file be named js_ReaScriptAPI_stdafx.h then or what?
Sorry, if it's stupid question.
doppelganger is offline   Reply With Quote
Old 10-09-2018, 02:21 AM   #10
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 7,344
Default

Quote:
Originally Posted by doppelganger View Post
i see , you wrote in file stdafx.h:
#ifndef JS_REASCRIPTAPI_STDAFX
#define JS_REASCRIPTAPI_STDAFX
Shouldn't that file be named js_ReaScriptAPI_stdafx.h then or what?
Sorry, if it's stupid question.
That's just an old style header include guard, it doesn't matter what is written into the ifndef and define lines (as long as they are the same identifier). A simple "#pragma once" could be used instead.

edit : I changed the header files to use #pragma once and will make a pull request.
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/

Last edited by Xenakios; 10-09-2018 at 02:35 AM.
Xenakios is online now   Reply With Quote
Old 10-09-2018, 02:39 AM   #11
doppelganger
Human being with feelings
 
Join Date: Feb 2017
Posts: 298
Default

Quote:
Originally Posted by Xenakios View Post
That's just an old style header include guard, it doesn't matter what is written into the ifndef and define lines (as long as they are the same identifier). A simple "#pragma once" could be used instead.

edit : I changed the header files to use #pragma once and will make a pull request.
thanks for explanation, i didn't find much information on internet about such case and thought maybe it's a typo, good to know.

@Julian
edit: hmm, there's alot of new stuff, even function to get track from hwnd, very cool.
How can i donate to you?

Last edited by doppelganger; 10-09-2018 at 09:54 AM.
doppelganger is offline   Reply With Quote
Old 10-10-2018, 02:26 AM   #12
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,104
Default

Quote:
Originally Posted by doppelganger View Post
edit: hmm, there's alot of new stuff, even function to get track from hwnd, very cool.
How can i donate to you?
paypal.me/juliansader, thanks!


Quote:
Originally Posted by cfillion View Post
Done (using clang version 6.0.1).
I have merged Xenakios's changes. Could you perhaps try to build the MacOS versions again?
juliansader is offline   Reply With Quote
Old 10-10-2018, 02:50 AM   #13
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,198
Default

Quote:
Originally Posted by juliansader View Post
I have merged Xenakios's changes. Could you perhaps try to build the MacOS versions again?
Builds updated.

Have you considered setting up a continuous integration service to get cross-platform builds done automatically for every commit pushed (including pull requests)? Many services offer up to ~1 hour of time per build job on a Linux/Windows/macOS virtual machine free of charge for open-source projects. (For ReaPack I use AppVeyor to make and test Linux/Windows builds and Travis for macOS builds.)

Last edited by cfillion; 10-10-2018 at 02:58 AM.
cfillion is offline   Reply With Quote
Old 10-11-2018, 01:12 AM   #14
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 62
Default

I am dying to try this out. Cant find it in the Repack repo list. Is it just to early to give this a stab? Pleeeeease?

Thx Julian
reapero is offline   Reply With Quote
Old 10-13-2018, 02:43 PM   #15
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,104
Default

Quote:
Originally Posted by reapero View Post
I am dying to try this out. Cant find it in the Repack repo list. Is it just to early to give this a stab? Pleeeeease?
At long last, the (beta) release thread: js_ReaScriptAPI extension!
juliansader is offline   Reply With Quote
Old 10-13-2018, 02:51 PM   #16
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,104
Default

Quote:
Originally Posted by cfillion View Post
Have you considered setting up a continuous integration service to get cross-platform builds done automatically for every commit pushed (including pull requests)? Many services offer up to ~1 hour of time per build job on a Linux/Windows/macOS virtual machine free of charge for open-source projects. (For ReaPack I use AppVeyor to make and test Linux/Windows builds and Travis for macOS builds.)
This is great! I didn't know they offer these services for free. I have set up an account with Travis to build MacOS and deploy back into my Github account.

Last edited by juliansader; 10-13-2018 at 03:54 PM.
juliansader is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.