Debian Codegraph @

tools/internal/check_castle_window_backends_compilation

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 set -eu
3
4 # -----------------------------------------------------------------
5 # Test compilation of various CGE CastleWindow backends.
6 # Assumes $CASTLE_ENGINE_PATH is set.
7 # Current directory doesn't matter.
8 # -----------------------------------------------------------------
9
10 TEST_PROJECT=examples/viewport_and_scenes/view_3d_model_advanced/
11 TEST_LPI="${TEST_PROJECT}"view_3d_model_advanced.lpi
12
13 # Run the command in parameters, reporting it to console too.
14 do_runscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_run(). ()
15 {
16 echoscip-shell system . . echo. '---------------------------------------------------------'
17 echoscip-shell system . . echo. 'Running:'
18 echoscip-shell system . . echo. "$@"
19 "$@"
20 }
21
22 # Test the LCL backend.
23 # This requires a bit different code than standard do_test_one_backend implementation.
24 # Parameters: OS CPU
25 do_test_one_backend_lclscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend_lcl(). ()
26 {
27 LAZBUILD_OPTIONS="--os=$1 --cpu=$2"
28 lazbuild $LAZBUILD_OPTIONS packages/alternative_castle_window_based_on_lcl.lpk
29
30 # Depend on alternative_castle_window_based_on_lcl from TEST_LPI
31 sedscip-shell system . . sed. -e 's|<PackageName Value="castle_window"/>|<PackageName Value="alternative_castle_window_based_on_lcl"/>|' \
32 --in-place "${TEST_LPI}"
33 do_runscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_run(). lazbuild $LAZBUILD_OPTIONS "${TEST_LPI}"
34
35 # Restore original view_3d_model_advanced.lpi
36 sedscip-shell system . . sed. -e 's|<PackageName Value="alternative_castle_window_based_on_lcl"/>|<PackageName Value="castle_window"/>|' \
37 --in-place "${TEST_LPI}"
38 }
39
40 # Test a single backend.
41 # Parameters: OS CPU backend-name
42 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). ()
43 {
44 if [scip-shell system . . `[`. "$3" = 'CASTLE_WINDOW_FORM' ]; then
45 do_test_one_backend_lclscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend_lcl(). $1 $2
46 else
47 # Cleans the project, to remove compilation outputs with defined CASTLE_WINDOW_*
48 do_runscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_run(). "${BUILD_TOOL}" --project="${TEST_PROJECT}" clean
49 do_runscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_run(). "${BUILD_TOOL}" --project="${TEST_PROJECT}" compile --os=$1 --cpu=$2 --mode=debug --compiler-option=-d$3
50 do_runscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_run(). "${BUILD_TOOL}" --project="${TEST_PROJECT}" clean
51 do_runscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_run(). "${BUILD_TOOL}" --project="${TEST_PROJECT}" compile --os=$1 --cpu=$2 --mode=release --compiler-option=-d$3
52 fi
53 }
54
55 # Test all CastleWindow backends.
56 do_test_all_backendsscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_all_backends(). ()
57 {
58 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). linux x86_64 CASTLE_WINDOW_GTK_2
59 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). linux x86_64 CASTLE_WINDOW_XLIB
60 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). linux x86_64 CASTLE_WINDOW_TEMPLATE
61 # Note that CASTLE_WINDOW_LIBRARY backend will not really work
62 # with a standalone application, but it should compile OK.
63 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). linux x86_64 CASTLE_WINDOW_LIBRARY
64 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). linux x86_64 CASTLE_WINDOW_FORM
65
66 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). win32 i386 CASTLE_WINDOW_WINAPI
67 # For now we don't support CASTLE_WINDOW_GTK_2 on non-Unix,
68 # see "TODO: WindowXID is only with X" in implementation.
69 # This could be fixed if ever needed -- but in practice there's no point using
70 # GTK backend e.g. on Windows, since we have WinAPI backend.
71 # do_test_one_backend win32 i386 CASTLE_WINDOW_GTK_2
72 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). win32 i386 CASTLE_WINDOW_TEMPLATE
73 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). win32 i386 CASTLE_WINDOW_LIBRARY
74 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). win32 i386 CASTLE_WINDOW_FORM
75
76 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). win64 x86_64 CASTLE_WINDOW_WINAPI
77 # See above for CASTLE_WINDOW_GTK_2 on non-Unix notes.
78 # do_test_one_backend win64 x86_64 CASTLE_WINDOW_GTK_2
79 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). win64 x86_64 CASTLE_WINDOW_TEMPLATE
80 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). win64 x86_64 CASTLE_WINDOW_LIBRARY
81 do_test_one_backendscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_one_backend(). win64 x86_64 CASTLE_WINDOW_FORM
82 }
83
84 cd "${CASTLE_ENGINE_PATH}"
85
86 # make sure no leftover compilation remains with some specific CASTLE_WINDOW_*
87 makescip-shell system . . make. clean
88
89 ./tools/build-tool/castle-engine_compile.sh
90 BUILD_TOOL="${CASTLE_ENGINE_PATH}/tools/build-tool/castle-engine"
91
92 do_test_all_backendsscip-shell shell castle-game-engine 7.0~alpha.3+dfsg2-5 do_test_all_backends().