Old 10-07-2018, 07:55 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
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: 4,937
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
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
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
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada 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: 4,937
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: 3,714
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: 8,062
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?
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 10-08-2018, 07:08 AM   #7
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
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: 8,062
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.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios 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 11:14 PM.


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