-
Notifications
You must be signed in to change notification settings - Fork 84
Added more build options for 3d party users #75
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,6 +145,12 @@ if _OPTIONS['with_optick'] then | |
| RIVE_OPTICK_VERSION = '1.4.0.0' | ||
| end | ||
|
|
||
| -- Optional pthread enabling (used e.g. for Emscripten wagyu builds) | ||
| newoption({ | ||
| trigger = 'with_pthread', | ||
| description = 'Enable pthread compile/link flags (-pthread)', | ||
| }) | ||
|
|
||
| location(RIVE_BUILD_OUT) | ||
| targetdir(RIVE_BUILD_OUT) | ||
| objdir(RIVE_BUILD_OUT .. '/obj') | ||
|
|
@@ -422,7 +428,7 @@ if _OPTIONS['for_android'] then | |
|
|
||
| -- Detect the NDK. | ||
| local EXPECTED_NDK_VERSION = 'r27c' | ||
| local NDK_LONG_VERSION_STRING = "27.2.12479018" | ||
| local NDK_LONG_VERSION_STRING = "25.2.9519653" | ||
| if _OPTIONS['for_unreal'] then | ||
| EXPECTED_NDK_VERSION = '25.1.8937393' | ||
| NDK_LONG_VERSION_STRING = '25.1.8937393' | ||
|
|
@@ -559,6 +565,43 @@ end | |
|
|
||
| filter({}) | ||
|
|
||
| -- Always build position independent code on Linux | ||
| -- Ensures static libs can link into shared objects without relocation errors. | ||
| filter({ 'system:linux' }) | ||
| do | ||
| pic('on') | ||
| buildoptions({ '-fPIC' }) | ||
| linkoptions({ '-fPIC' }) | ||
| end | ||
|
Comment on lines
+568
to
+575
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried using the "--with-pic" option, but it seems it didn't apply to everything required 🤷 |
||
|
|
||
| -- Cross-compilation helpers for Linux. When targeting a Linux architecture that does not match | ||
| -- the host, add an explicit target triple so clang uses the correct backend. Optionally honor a | ||
| -- provided --sysroot for both compilation and linking. | ||
| if os.target() == 'linux' then | ||
| local host_arch = os.outputof('uname -m') or '' | ||
|
|
||
| -- Apply target triple if host arch doesn't match requested arch | ||
| if _OPTIONS['arch'] == 'x64' and host_arch ~= 'x86_64' then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for handling these. Can we add x86, just for completeness?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll try adding it. |
||
| buildoptions({ '--target=x86_64-linux-gnu' }) | ||
| linkoptions({ '--target=x86_64-linux-gnu' }) | ||
| elseif _OPTIONS['arch'] == 'x86' and host_arch ~= 'i686' and host_arch ~= 'i386' then | ||
| buildoptions({ '--target=i686-linux-gnu' }) | ||
| linkoptions({ '--target=i686-linux-gnu' }) | ||
| elseif _OPTIONS['arch'] == 'arm64' and host_arch ~= 'aarch64' then | ||
| buildoptions({ '--target=aarch64-linux-gnu' }) | ||
| linkoptions({ '--target=aarch64-linux-gnu' }) | ||
| elseif _OPTIONS['arch'] == 'arm' and not host_arch:match('arm') then | ||
| buildoptions({ '--target=arm-linux-gnueabihf' }) | ||
| linkoptions({ '--target=arm-linux-gnueabihf' }) | ||
| end | ||
| end | ||
|
|
||
| -- Apply pthread flags when requested | ||
| if _OPTIONS['with_pthread'] then | ||
| buildoptions({ '-pthread' }) | ||
| linkoptions({ '-pthread' }) | ||
| end | ||
|
|
||
| filter('system:macosx') | ||
| do | ||
| defines({ 'RIVE_MACOSX' }) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,11 +6,11 @@ dofile(RIVE_RUNTIME_DIR .. '/decoders/premake5_v2.lua') | |
| dofile(RIVE_RUNTIME_DIR .. '/dependencies/premake5_glfw_v2.lua') | ||
|
|
||
| newoption({ trigger = 'with-skia', description = 'use skia' }) | ||
| if _OPTIONS['with-skia'] then | ||
| if _OPTIONS['with-skia'] and not _OPTIONS['with-libs-only'] then | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This approach may be obsolete with the workaround Chris suggested. |
||
| dofile(RIVE_RUNTIME_DIR .. '/skia/renderer/premake5_v2.lua') | ||
| end | ||
|
|
||
| if not _OPTIONS['with-webgpu'] then | ||
| if not _OPTIONS['with-webgpu'] and not _OPTIONS['with-libs-only'] then | ||
| project('path_fiddle') | ||
| do | ||
| dependson('rive') | ||
|
|
@@ -179,7 +179,7 @@ if not _OPTIONS['with-webgpu'] then | |
| end | ||
| end | ||
|
|
||
| if _OPTIONS['with-webgpu'] or _OPTIONS['with-dawn'] then | ||
| if (_OPTIONS['with-webgpu'] or _OPTIONS['with-dawn']) and not _OPTIONS['with-libs-only'] then | ||
| project('webgpu_player') | ||
| do | ||
| kind('ConsoleApp') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,11 @@ do | |
| defines({ 'RIVE_WEBGPU=' .. _OPTIONS['webgpu-version'] }) | ||
| end | ||
|
|
||
| newoption({ | ||
| trigger = 'with-libs-only', | ||
| description = 'only builds the libraries', | ||
| }) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this should be necessary. If you want to build just a library, you can already say:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While I just verified that it is indeed possible to do, there are still major flaws with that approach:
So, in all fairness, I think the notion of a "build libraries only" target is still very much needed here. |
||
|
|
||
| filter({}) | ||
|
|
||
| newoption({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for calling attention to this! @ErikUggeldahl can probably suggest how we should handle it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, looks like this wasn't fully handled. Right now it's 27 to match with Rive Android's expected build. By changing this, we will likely clash. I could see adding a parameter to change it if necessary, but just changing it like this is likely to cause issues.
Additionally:
EXPECTEDvariable above.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this entire PR is highlighting customer hot spots. So, what we likely need is a good way to specify the NDK/SDK version. I'm not sure what is the best way to do it, but basically something like this is a common approach:
And then you will of course have your own defaults.