aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2022-11-19 21:18:26 +0100
committerAndre Weissflog <floooh@gmail.com>2022-11-19 21:18:26 +0100
commit6d3dd90ddce1da8fbec39efa84dbf2825326fbd0 (patch)
tree32807f2f206376cd005015b50af2cf10f5840c4a /tests
parent0d1e8360d8623ca4d44f475eab5196f8a98d990a (diff)
cmake presets for iOS and macOS
Diffstat (limited to 'tests')
-rw-r--r--tests/ext/CMakeLists.txt158
-rw-r--r--tests/test_common.sh32
-rwxr-xr-xtests/test_ios.sh19
-rwxr-xr-xtests/test_macos.sh19
4 files changed, 105 insertions, 123 deletions
diff --git a/tests/ext/CMakeLists.txt b/tests/ext/CMakeLists.txt
index 6c611e06..4ded7c41 100644
--- a/tests/ext/CMakeLists.txt
+++ b/tests/ext/CMakeLists.txt
@@ -1,80 +1,82 @@
# external dependencies
-FetchContent_Declare(
- spineruntimes
- GIT_REPOSITORY https://github.com/EsotericSoftware/spine-runtimes
- GIT_SUBMODULES_RECURSE ON
- GIT_SHALLOW ON
- GIT_TAG "4.1"
-)
-FetchContent_Declare(
- fipscimgui
- GIT_REPOSITORY https://github.com/fips-libs/fips-cimgui
- GIT_SUBMODULES_RECURSE ON
- GIT_SHALLOW ON
-)
-FetchContent_Populate(fipscimgui)
-FetchContent_Populate(spineruntimes)
+
+# NOTE FetchContent is so frigging slow that we just run git directly
+set(cimgui_dir ${CMAKE_BINARY_DIR}/../_deps/cimgui)
+set(spineruntimes_dir ${CMAKE_BINARY_DIR}/../_deps/spineruntimes)
+
+if (IS_DIRECTORY ${cimgui_dir})
+ message("### ${cimgui_dir} exists...")
+else()
+ message("### Fetching cimgui to ${cimgui_dir} (this may take a while...)")
+ execute_process(COMMAND git clone --depth=1 --recursive https://github.com/fips-libs/fips-cimgui ${cimgui_dir})
+endif()
+if (IS_DIRECTORY ${spineruntimes_dir})
+ message("### ${spineruntimes_dir} exists...")
+else()
+ message("### Fetching spine runtimes to ${spineruntimes_dir} (this may take a while...)")
+ execute_process(COMMAND git clone --depth=1 --recursive https://github.com/EsotericSoftware/spine-runtimes ${spineruntimes_dir})
+endif()
add_library(cimgui
- ${fipscimgui_SOURCE_DIR}/cimgui/cimgui.cpp
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui.cpp
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui_demo.cpp
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui_draw.cpp
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui_tables.cpp
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui_widgets.cpp)
-target_include_directories(cimgui SYSTEM PUBLIC ${fipscimgui_SOURCE_DIR})
+ ${cimgui_dir}/cimgui/cimgui.cpp
+ ${cimgui_dir}/cimgui/imgui/imgui.cpp
+ ${cimgui_dir}/cimgui/imgui/imgui_demo.cpp
+ ${cimgui_dir}/cimgui/imgui/imgui_draw.cpp
+ ${cimgui_dir}/cimgui/imgui/imgui_tables.cpp
+ ${cimgui_dir}/cimgui/imgui/imgui_widgets.cpp)
+target_include_directories(cimgui SYSTEM PUBLIC ${cimgui_dir})
add_library(imgui
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui.cpp
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui_demo.cpp
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui_draw.cpp
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui_tables.cpp
- ${fipscimgui_SOURCE_DIR}/cimgui/imgui/imgui_widgets.cpp)
-target_include_directories(imgui SYSTEM PUBLIC ${fipscimgui_SOURCE_DIR}/cimgui/imgui)
+ ${cimgui_dir}/cimgui/imgui/imgui.cpp
+ ${cimgui_dir}/cimgui/imgui/imgui_demo.cpp
+ ${cimgui_dir}/cimgui/imgui/imgui_draw.cpp
+ ${cimgui_dir}/cimgui/imgui/imgui_tables.cpp
+ ${cimgui_dir}/cimgui/imgui/imgui_widgets.cpp)
+target_include_directories(imgui SYSTEM PUBLIC ${cimgui_dir}/cimgui/imgui)
add_library(spine
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Animation.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/AnimationState.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/AnimationStateData.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Array.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Atlas.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/AtlasAttachmentLoader.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Attachment.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/AttachmentLoader.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Bone.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/BoneData.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/BoundingBoxAttachment.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/ClippingAttachment.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Color.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Debug.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Event.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/EventData.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/IkConstraint.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/IkConstraintData.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Json.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Json.h
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/MeshAttachment.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/PathAttachment.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/PathConstraint.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/PathConstraintData.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/PointAttachment.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/RegionAttachment.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Sequence.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Skeleton.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/SkeletonBinary.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/SkeletonBounds.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/SkeletonClipping.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/SkeletonData.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/SkeletonJson.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Skin.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Slot.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/SlotData.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/TransformConstraint.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/TransformConstraintData.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/Triangulator.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/VertexAttachment.c
- ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/src/spine/extension.c)
-target_include_directories(spine SYSTEM PUBLIC ${spineruntimes_SOURCE_DIR}/spine-c/spine-c/include)
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Animation.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/AnimationState.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/AnimationStateData.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Array.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Atlas.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/AtlasAttachmentLoader.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Attachment.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/AttachmentLoader.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Bone.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/BoneData.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/BoundingBoxAttachment.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/ClippingAttachment.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Color.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Debug.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Event.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/EventData.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/IkConstraint.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/IkConstraintData.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Json.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Json.h
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/MeshAttachment.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/PathAttachment.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/PathConstraint.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/PathConstraintData.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/PointAttachment.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/RegionAttachment.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Sequence.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Skeleton.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/SkeletonBinary.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/SkeletonBounds.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/SkeletonClipping.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/SkeletonData.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/SkeletonJson.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Skin.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Slot.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/SlotData.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/TransformConstraint.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/TransformConstraintData.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/Triangulator.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/VertexAttachment.c
+ ${spineruntimes_dir}/spine-c/spine-c/src/spine/extension.c)
+target_include_directories(spine SYSTEM PUBLIC ${spineruntimes_dir}/spine-c/spine-c/include)
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options(spine PRIVATE /wd4267 /wd4244) # conversion from 'x' to 'y' possible loss of data
endif()
@@ -82,14 +84,14 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(spine PRIVATE -Wno-shorten-64-to-32)
endif()
-file(COPY ${spineruntimes_SOURCE_DIR}/examples/spineboy/export/spineboy-pro.json DESTINATION ${CMAKE_BINARY_DIR})
-file(COPY ${spineruntimes_SOURCE_DIR}/examples/spineboy/export/spineboy-pro.skel DESTINATION ${CMAKE_BINARY_DIR})
-file(COPY ${spineruntimes_SOURCE_DIR}/examples/spineboy/export/spineboy.atlas DESTINATION ${CMAKE_BINARY_DIR})
-file(COPY ${spineruntimes_SOURCE_DIR}/examples/spineboy/export/spineboy.png DESTINATION ${CMAKE_BINARY_DIR})
+file(COPY ${spineruntimes_dir}/examples/spineboy/export/spineboy-pro.json DESTINATION ${CMAKE_BINARY_DIR})
+file(COPY ${spineruntimes_dir}/examples/spineboy/export/spineboy-pro.skel DESTINATION ${CMAKE_BINARY_DIR})
+file(COPY ${spineruntimes_dir}/examples/spineboy/export/spineboy.atlas DESTINATION ${CMAKE_BINARY_DIR})
+file(COPY ${spineruntimes_dir}/examples/spineboy/export/spineboy.png DESTINATION ${CMAKE_BINARY_DIR})
-file(COPY ${spineruntimes_SOURCE_DIR}/examples/spineboy/export/spineboy-pro.json DESTINATION ${CMAKE_BINARY_DIR}/Debug)
-file(COPY ${spineruntimes_SOURCE_DIR}/examples/spineboy/export/spineboy-pro.skel DESTINATION ${CMAKE_BINARY_DIR}/Debug)
-file(COPY ${spineruntimes_SOURCE_DIR}/examples/spineboy/export/spineboy.atlas DESTINATION ${CMAKE_BINARY_DIR}/Debug)
-file(COPY ${spineruntimes_SOURCE_DIR}/examples/spineboy/export/spineboy.png DESTINATION ${CMAKE_BINARY_DIR}/Debug)
+file(COPY ${spineruntimes_dir}/examples/spineboy/export/spineboy-pro.json DESTINATION ${CMAKE_BINARY_DIR}/Debug)
+file(COPY ${spineruntimes_dir}/examples/spineboy/export/spineboy-pro.skel DESTINATION ${CMAKE_BINARY_DIR}/Debug)
+file(COPY ${spineruntimes_dir}/examples/spineboy/export/spineboy.atlas DESTINATION ${CMAKE_BINARY_DIR}/Debug)
+file(COPY ${spineruntimes_dir}/examples/spineboy/export/spineboy.png DESTINATION ${CMAKE_BINARY_DIR}/Debug)
add_library(nuklear nuklear.c)
diff --git a/tests/test_common.sh b/tests/test_common.sh
index 1515eb90..6708a16b 100644
--- a/tests/test_common.sh
+++ b/tests/test_common.sh
@@ -26,10 +26,12 @@ setup_android() {
}
build() {
- preset=$1
- cmake --preset $preset ../..
- cmake --build .
- cd ../..
+ gen_preset=$1
+ build_preset=$2
+# cd ..
+ cmake --preset $gen_preset
+ cmake --build --preset $build_preset
+# cd tests
}
build_force_egl() {
@@ -52,16 +54,6 @@ analyze() {
cd ../..
}
-build_arc() {
- cfg=$1
- backend=$2
- mode=$3
- mkdir -p build/$cfg && cd build/$cfg
- cmake -GNinja -DSOKOL_BACKEND=$backend -DUSE_ARC:BOOL=ON -DCMAKE_BUILD_TYPE=$mode ../..
- cmake --build .
- cd ../..
-}
-
analyze_arc() {
cfg=$1
backend=$2
@@ -72,16 +64,6 @@ analyze_arc() {
cd ../..
}
-build_ios() {
- cfg=$1
- backend=$2
- mode=$3
- mkdir -p build/$cfg && cd build/$cfg
- cmake -GXcode -DSOKOL_BACKEND=$backend -DCMAKE_SYSTEM_NAME=iOS ../..
- cmake --build . --config $mode -- CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
- cd ../..
-}
-
analyze_ios() {
cfg=$1
backend=$2
@@ -134,7 +116,7 @@ build_android() {
runtest() {
cfg=$1
- cd build/$cfg
+ cd tests/build/$cfg
./sokol-test
cd ../../..
}
diff --git a/tests/test_ios.sh b/tests/test_ios.sh
index ea8a58f0..0d087f9d 100755
--- a/tests/test_ios.sh
+++ b/tests/test_ios.sh
@@ -1,11 +1,10 @@
set -e
-source test_common.sh
-prepare
-build_ios ios_gl_debug SOKOL_GLES3 Debug
-build_ios ios_gl_release SOKOL_GLES3 Release
-build_ios ios_metal_debug SOKOL_METAL Debug
-build_ios ios_metal_release SOKOL_METAL Release
-build_arc_ios ios_arc_gl_debug SOKOL_GLES3 Debug
-build_arc_ios ios_arc_gl_release SOKOL_GLES3 Release
-build_arc_ios ios_arc_metal_debug SOKOL_METAL Debug
-build_arc_ios ios_arc_metal_release SOKOL_METAL Release
+source tests/test_common.sh
+build ios_gl ios_gl_debug
+build ios_gl ios_gl_release
+build ios_metal ios_metal_debug
+build ios_metal ios_metal_release
+build ios_arc_gl ios_arc_gl_debug
+build ios_arc_gl ios_arc_gl_release
+build ios_arc_metal ios_arc_metal_debug
+build ios_arc_metal ios_arc_metal_release
diff --git a/tests/test_macos.sh b/tests/test_macos.sh
index b2bcf999..2f28a8a9 100755
--- a/tests/test_macos.sh
+++ b/tests/test_macos.sh
@@ -1,12 +1,11 @@
set -e
-source test_common.sh
-prepare
-build macos_gl_debug SOKOL_GLCORE33 Debug
-build macos_gl_release SOKOL_GLCORE33 Release
-build macos_metal_debug SOKOL_METAL Debug
-build macos_metal_release SOKOL_METAL Release
-build_arc macos_arc_gl_debug SOKOL_GLCORE33 Debug
-build_arc macos_arc_gl_release SOKOL_GLCORE33 Release
-build_arc macos_arc_metal_debug SOKOL_METAL Debug
-build_arc macos_arc_metal_release SOKOL_METAL Release
+source tests/test_common.sh
+build macos_gl_debug macos_gl_debug
+build macos_gl_release macos_gl_release
+build macos_metal_debug macos_metal_debug
+build macos_metal_release macos_metal_release
+build macos_arc_gl_debug macos_arc_gl_debug
+build macos_arc_gl_release macos_arc_gl_release
+build macos_arc_metal_debug macos_arc_metal_debug
+build macos_arc_metal_release macos_arc_metal_release
runtest macos_gl_debug