@@ -81,7 +81,7 @@ newoption({
8181 {
8282 ' runtime' ,
8383 ' Build the static library specifically targeting our runtimes' ,
84- }
84+ },
8585 },
8686 default = ' system' ,
8787})
@@ -183,10 +183,10 @@ newoption({
183183})
184184
185185newoption ({
186- trigger = " toolsversion" ,
187- value = " msvc_toolsversion" ,
188- description = " specify the version of the compiler tool. On windows thats the msvc version which affects both clang and msvc outputs." ,
189- default = ' latest'
186+ trigger = ' toolsversion' ,
187+ value = ' msvc_toolsversion' ,
188+ description = ' specify the version of the compiler tool. On windows thats the msvc version which affects both clang and msvc outputs.' ,
189+ default = ' latest' ,
190190})
191191
192192-- This is just to match our old windows config. Rive Native specifically sets
252252end
253253
254254-- for latest builds we leave toolsversion unset so that it automatically chooses the latest version
255- filter ({" options:toolsversion != latest" })
255+ filter ({ ' options:toolsversion != latest' })
256256do
257257 -- this is because unreal "prefers" certain msvc versions so we try to match it from the python build script
258- toolsversion (_OPTIONS [" toolsversion" ])
258+ toolsversion (_OPTIONS [' toolsversion' ])
259259end
260260
261261filter ({ ' system:windows' , ' options:toolset=clang' })
@@ -353,9 +353,42 @@ filter({})
353353if _OPTIONS [' os' ] == ' android' then
354354 pic (' on' ) -- Position-independent code is required for NDK libraries.
355355
356- ndk = os.getenv (' NDK_PATH' ) or os.getenv (' ANDROID_NDK' )
357- if not ndk then
358- error (' export $NDK_PATH or $ANDROID_NDK' )
356+ -- Detect the NDK.
357+ EXPECTED_NDK_VERSION = ' r27c'
358+ ndk = os.getenv (' NDK_PATH' ) or os.getenv (' ANDROID_NDK' ) or ' <undefined>'
359+ local ndk_version = ' <undetected>'
360+ local f = io.open (ndk .. ' /source.properties' , ' r' )
361+ if f then
362+ for line in f :lines () do
363+ local match = line :match (' ^Pkg.ReleaseName = (.+)$' )
364+ if match then
365+ ndk_version = match
366+ break
367+ end
368+ end
369+ f :close ()
370+ end
371+ if ndk_version ~= EXPECTED_NDK_VERSION then
372+ print ()
373+ print (' ** Rive requires Android NDK version ' .. EXPECTED_NDK_VERSION .. ' **' )
374+ print ()
375+ print (' To install via Android Studio:' )
376+ print (' - Settings > SDK Manager > SDK Tools' )
377+ print (' - Check "Show Package Details" at the bottom' )
378+ print (' - Select 27.2.12479018 under "NDK (Side by side)"' )
379+ print (' - Note the value of "Android SDK Location"' )
380+ print ()
381+ print (' Then set the ANDROID_NDK environment variable:' )
382+ print (' - export ANDROID_NDK="<Android SDK Location>/ndk/27.2.12479018"' )
383+ print ()
384+ error (
385+ ' Unsupported Android NDK\n ndk: '
386+ .. ndk
387+ .. ' \n version: '
388+ .. ndk_version
389+ .. ' \n expected: '
390+ .. EXPECTED_NDK_VERSION
391+ )
359392 end
360393
361394 local ndk_toolchain = ndk .. ' /toolchains/llvm/prebuilt'
0 commit comments