Tests use new premake system Diffs= 026caa5a9 Tests use new premake system (#6526) Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head index 484df22..8bd06d6 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -a8c86e949999962ed56bcaf1b796c5a29b7f2b12 +026caa5a9d0e7dc2744b68be5e812fb63bea52a4
diff --git a/dev/test.bat b/dev/test.bat index 3846a44..cbd3ca3 100644 --- a/dev/test.bat +++ b/dev/test.bat
@@ -9,7 +9,7 @@ set "PREMAKE=%DEPENDENCIES%\bin\premake5.exe" pushd test -%PREMAKE% --scripts=..\..\build vs2022 +%PREMAKE% --scripts=..\..\build --no-download-progress --with_rive_tools --with_rive_text --with_rive_audio=external vs2022 MSBuild.exe /? 2> NUL if not %ERRORLEVEL%==9009 ( @@ -17,5 +17,5 @@ ) else ( set "MSBuild=%ProgramFiles%\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe" ) -call "%MSBuild%" rive.sln -build\bin\debug\tests.exe \ No newline at end of file +call "%MSBuild%" out\debug\rive.sln +out\debug\tests.exe \ No newline at end of file
diff --git a/dev/test.sh b/dev/test.sh index 87eb274..8ce23a6 100755 --- a/dev/test.sh +++ b/dev/test.sh
@@ -1,5 +1,4 @@ #!/bin/bash - set -e source ../dependencies/config_directories.sh @@ -16,7 +15,7 @@ exit elif [ "$OPTION" = "clean" ]; then echo Cleaning project ... - $PREMAKE --scripts=../../build clean || exit 1 + rm -fR out shift elif [ "$OPTION" = "memory" ]; then echo Will perform memory checks... @@ -28,12 +27,17 @@ shift fi -$PREMAKE --scripts=../../build gmake2 || exit 1 -make -j7 || exit 1 +unameOut="$(uname -s)" +case "${unameOut}" in +Linux*) NUM_CORES=$(grep -c processor /proc/cpuinfo) ;; +Darwin*) NUM_CORES=$(($(sysctl -n hw.physicalcpu) + 1)) ;; +MINGW*) NUM_CORES=$NUMBER_OF_PROCESSORS ;; +*) NUM_CORES=4 ;; +esac -for file in ./build/bin/debug/*; do - echo testing $file - $UTILITY $file "$1" -done +$PREMAKE --scripts=../../build gmake2 --with_rive_tools --with_rive_text --with_rive_audio=external --config=debug --out=out/debug +make -C out/debug -j$NUM_CORES + +$UTILITY out/debug/tests "$1" popd &>/dev/null
diff --git a/dev/test/premake5.lua b/dev/test/premake5.lua index 5c9975c..91b3bd2 100644 --- a/dev/test/premake5.lua +++ b/dev/test/premake5.lua
@@ -1,111 +1,35 @@ --- require "lfs" --- Clean Function -- -newaction({ - trigger = 'clean', - description = 'clean the build', - execute = function() - print('clean the build...') - os.rmdir('build') - os.remove('Makefile') - -- no wildcards in os.remove, so use shell - os.execute('rm *.make') - print('build cleaned') - end, +dofile('rive_build_config.lua') + +defines({ + 'TESTING', + 'ENABLE_QUERY_FLAT_VERTICES', + 'WITH_RIVE_TOOLS', + 'WITH_RIVE_TEXT', + 'WITH_RIVE_AUDIO', }) -workspace('rive') -configurations({ 'debug' }) - -dofile(path.join(path.getabsolute('../../dependencies/'), 'premake5_harfbuzz.lua')) -dofile(path.join(path.getabsolute('../../dependencies/'), 'premake5_sheenbidi.lua')) -dofile(path.join(path.getabsolute('../../dependencies/'), 'premake5_miniaudio.lua')) +dofile(path.join(path.getabsolute('../../'), 'premake5_v2.lua')) project('tests') do kind('ConsoleApp') - language('C++') - cppdialect('C++11') - targetdir('build/bin/%{cfg.buildcfg}') - objdir('build/obj/%{cfg.buildcfg}') - flags({ 'FatalWarnings' }) - buildoptions({ '-Wall', '-fno-exceptions', '-fno-rtti' }) exceptionhandling('On') includedirs({ './include', '../../include', - harfbuzz .. '/src', - sheenbidi .. '/Headers', miniaudio, }) - links({ 'rive_harfbuzz', 'rive_sheenbidi' }) + + links({ 'rive', 'rive_harfbuzz', 'rive_sheenbidi' }) files({ - '../../src/**.cpp', -- the Rive runtime source '../../test/**.cpp', -- the tests '../../utils/**.cpp', -- no_op utils }) - defines({ - 'TESTING', - 'ENABLE_QUERY_FLAT_VERTICES', - 'WITH_RIVE_TOOLS', - 'WITH_RIVE_TEXT', - 'WITH_RIVE_AUDIO', - }) - - filter({ 'system:windows', 'files:../../src/audio/audio_engine.cpp' }) - do - -- Too many warnings from miniaudio.h - removeflags({ 'FatalCompileWarnings' }) - removebuildoptions({ '-Wall' }) - end - - filter({ 'system:windows', 'toolset:clang' }) - do - -- Too many warnings from miniaudio.h - buildoptions({ - '-Wno-nonportable-system-include-path', - '-Wno-zero-as-null-pointer-constant', - '-Wno-missing-prototypes', - '-Wno-cast-qual', - '-Wno-format-nonliteral', - '-Wno-cast-align', - '-Wno-covered-switch-default', - '-Wno-comma', - '-Wno-tautological-type-limit-compare', - '-Wno-extra-semi-stmt', - '-Wno-tautological-constant-out-of-range-compare', - '-Wno-implicit-fallthrough', - '-Wno-implicit-int-conversion', - '-Wno-undef', - }) - end - - filter('configurations:debug') - do - defines({ 'DEBUG' }) - symbols('On') - end - filter('system:linux') do - defines({ 'EXTERNAL_RIVE_AUDIO_ENGINE' }) links({ 'dl', 'pthread' }) end - - filter('system:windows') - do - removebuildoptions({ - -- vs clang doesn't recognize these on windows - '-fno-exceptions', - '-fno-rtti', - }) - architecture('x64') - defines({ - '_USE_MATH_DEFINES', - '_CRT_SECURE_NO_WARNINGS', - '_CRT_NONSTDC_NO_DEPRECATE', - }) - end end
diff --git a/premake5_v2.lua b/premake5_v2.lua index d6098bc..7a8c270 100644 --- a/premake5_v2.lua +++ b/premake5_v2.lua
@@ -58,6 +58,26 @@ removeflags({ 'FatalCompileWarnings' }) end + filter({ 'system:windows', 'toolset:clang', 'files:src/audio/audio_engine.cpp' }) + do + buildoptions({ + '-Wno-nonportable-system-include-path', + '-Wno-zero-as-null-pointer-constant', + '-Wno-missing-prototypes', + '-Wno-cast-qual', + '-Wno-format-nonliteral', + '-Wno-cast-align', + '-Wno-covered-switch-default', + '-Wno-comma', + '-Wno-tautological-type-limit-compare', + '-Wno-extra-semi-stmt', + '-Wno-tautological-constant-out-of-range-compare', + '-Wno-implicit-fallthrough', + '-Wno-implicit-int-conversion', + '-Wno-undef', + }) + end + -- filter 'files:src/audio/audio_engine.cpp' -- do -- buildoptions {