Skip to content

Commit

Permalink
Require Android NDK r27c from premake
Browse files Browse the repository at this point in the history
Move the validation of this requirement from `build.rive.for.sh` into our core build system.

Diffs=
52c045aaf7 Require Android NDK r27c from premake (#8900)

Co-authored-by: Chris Dalton <[email protected]>
  • Loading branch information
csmartdalton and csmartdalton committed Jan 21, 2025
1 parent 146533b commit 0b8d292
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d5a774b4b46a147fd72e3ffd9dc730ab313d4a13
52c045aaf73d9dac513a68c86323c956c0063136
53 changes: 43 additions & 10 deletions build/rive_build_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ newoption({
{
'runtime',
'Build the static library specifically targeting our runtimes',
}
},
},
default = 'system',
})
Expand Down Expand Up @@ -183,10 +183,10 @@ newoption({
})

newoption({
trigger= "toolsversion",
value="msvc_toolsversion",
description = "specify the version of the compiler tool. On windows thats the msvc version which affects both clang and msvc outputs.",
default= 'latest'
trigger = 'toolsversion',
value = 'msvc_toolsversion',
description = 'specify the version of the compiler tool. On windows thats the msvc version which affects both clang and msvc outputs.',
default = 'latest',
})

-- This is just to match our old windows config. Rive Native specifically sets
Expand Down Expand Up @@ -252,10 +252,10 @@ do
end

-- for latest builds we leave toolsversion unset so that it automatically chooses the latest version
filter({"options:toolsversion != latest"})
filter({ 'options:toolsversion != latest' })
do
-- this is because unreal "prefers" certain msvc versions so we try to match it from the python build script
toolsversion(_OPTIONS["toolsversion"])
toolsversion(_OPTIONS['toolsversion'])
end

filter({ 'system:windows', 'options:toolset=clang' })
Expand Down Expand Up @@ -353,9 +353,42 @@ filter({})
if _OPTIONS['os'] == 'android' then
pic('on') -- Position-independent code is required for NDK libraries.

ndk = os.getenv('NDK_PATH') or os.getenv('ANDROID_NDK')
if not ndk then
error('export $NDK_PATH or $ANDROID_NDK')
-- Detect the NDK.
EXPECTED_NDK_VERSION = 'r27c'
ndk = os.getenv('NDK_PATH') or os.getenv('ANDROID_NDK') or '<undefined>'
local ndk_version = '<undetected>'
local f = io.open(ndk .. '/source.properties', 'r')
if f then
for line in f:lines() do
local match = line:match('^Pkg.ReleaseName = (.+)$')
if match then
ndk_version = match
break
end
end
f:close()
end
if ndk_version ~= EXPECTED_NDK_VERSION then
print()
print('** Rive requires Android NDK version ' .. EXPECTED_NDK_VERSION .. ' **')
print()
print('To install via Android Studio:')
print(' - Settings > SDK Manager > SDK Tools')
print(' - Check "Show Package Details" at the bottom')
print(' - Select 27.2.12479018 under "NDK (Side by side)"')
print(' - Note the value of "Android SDK Location"')
print()
print('Then set the ANDROID_NDK environment variable:')
print(' - export ANDROID_NDK="<Android SDK Location>/ndk/27.2.12479018"')
print()
error(
'Unsupported Android NDK\n ndk: '
.. ndk
.. '\n version: '
.. ndk_version
.. '\n expected: '
.. EXPECTED_NDK_VERSION
)
end

local ndk_toolchain = ndk .. '/toolchains/llvm/prebuilt'
Expand Down
8 changes: 8 additions & 0 deletions tests/gm/gmmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ static void dumpGMs(const std::string& match, bool interactive)
{
continue; // A different process already drew this gm.
}
#ifdef RIVE_ANDROID
if (gm->name().find("feather") != std::string::npos)
{
// Don't support or test feathering on Android until MSAA is
// implemented and device-specific crashes are resolved.
continue;
}
#endif
gm->onceBeforeDraw();

dump_gm(gm.get());
Expand Down

0 comments on commit 0b8d292

Please sign in to comment.