|
1 | 1 | #![allow(dead_code)]
|
2 | 2 |
|
3 | 3 | fn build_glue_for_game_activity() {
|
4 |
| - let activity_basepath = "android-games-sdk/game-activity/prefab-src/modules/game-activity/include"; |
5 |
| - let textinput_basepath = "android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include"; |
| 4 | + let activity_path = |src_inc, name| { |
| 5 | + format!("android-games-sdk/game-activity/prefab-src/modules/game-activity/{src_inc}/game-activity/{name}") |
| 6 | + }; |
| 7 | + let textinput_path = |src_inc, name| { |
| 8 | + format!("android-games-sdk/game-text-input/prefab-src/modules/game-text-input/{src_inc}/game-text-input/{name}") |
| 9 | + }; |
| 10 | + |
| 11 | + for f in ["GameActivity.cpp", "GameActivityEvents.cpp"] { |
| 12 | + println!("cargo:rerun-if-changed={}", activity_path("src", f)); |
| 13 | + } |
6 | 14 |
|
7 | 15 | for f in [
|
8 | 16 | "GameActivity.h",
|
9 |
| - "GameActivity.cpp", |
10 | 17 | "GameActivityEvents.h",
|
11 |
| - "GameActivityEvents.cpp", |
12 | 18 | "GameActivityLog.h",
|
13 | 19 | ] {
|
14 |
| - println!("cargo:rerun-if-changed={activity_basepath}/game-activity/{f}"); |
| 20 | + println!("cargo:rerun-if-changed={}", activity_path("include", f)); |
15 | 21 | }
|
| 22 | + |
16 | 23 | cc::Build::new()
|
17 | 24 | .cpp(true)
|
18 |
| - .include("android-games-sdk/include") |
19 |
| - .include(activity_basepath) |
20 |
| - .file(format!("{activity_basepath}/game-activity/GameActivity.cpp")) |
21 |
| - .file(format!("{activity_basepath}/game-activity/GameActivityEvents.cpp")) |
| 25 | + .include("android-games-sdk/src/common") |
| 26 | + .file("android-games-sdk/src/common/system_utils.cpp") |
| 27 | + .extra_warnings(false) |
| 28 | + .cpp_link_stdlib("c++_static") |
| 29 | + .compile("libgame_common.a"); |
| 30 | + |
| 31 | + println!("cargo:rerun-if-changed=android-games-sdk/src/common/system_utils.cpp"); |
| 32 | + println!("cargo:rerun-if-changed=android-games-sdk/src/common/system_utils.h"); |
| 33 | + |
| 34 | + cc::Build::new() |
| 35 | + .cpp(true) |
| 36 | + .include("android-games-sdk/src/common") |
| 37 | + .include("android-games-sdk/game-activity/prefab-src/modules/game-activity/include") |
| 38 | + .file(activity_path("src", "GameActivity.cpp")) |
| 39 | + .file(activity_path("src", "GameActivityEvents.cpp")) |
22 | 40 | .extra_warnings(false)
|
23 | 41 | .cpp_link_stdlib("c++_static")
|
24 | 42 | .compile("libgame_activity.a");
|
25 | 43 |
|
26 |
| - for f in ["gamecommon.h", "gametextinput.h", "gametextinput.cpp"] { |
27 |
| - println!("cargo:rerun-if-changed={textinput_basepath}/game-text-input/{f}"); |
28 |
| - } |
| 44 | + println!( |
| 45 | + "cargo:rerun-if-changed={}", |
| 46 | + textinput_path("include", "gametextinput.h") |
| 47 | + ); |
| 48 | + println!( |
| 49 | + "cargo:rerun-if-changed={}", |
| 50 | + textinput_path("src", "gametextinput.cpp") |
| 51 | + ); |
| 52 | + |
29 | 53 | cc::Build::new()
|
30 | 54 | .cpp(true)
|
31 |
| - .include("android-games-sdk/include") |
32 |
| - .include(activity_basepath) |
33 |
| - .file(format!("{textinput_basepath}/game-text-input/gametextinput.cpp")) |
| 55 | + .include("android-games-sdk/src/common") |
| 56 | + .include("android-games-sdk/game-text-input/prefab-src/modules/game-text-input/include") |
| 57 | + .file(textinput_path("src", "gametextinput.cpp")) |
34 | 58 | .cpp_link_stdlib("c++_static")
|
35 | 59 | .compile("libgame_text_input.a");
|
36 | 60 |
|
37 |
| - for f in ["android_native_app_glue.h", "android_native_app_glue.c"] { |
38 |
| - println!("cargo:rerun-if-changed={activity_basepath}/game-activity/native_app_glue/{f}"); |
39 |
| - } |
40 |
| - |
| 61 | + println!( |
| 62 | + "cargo:rerun-if-changed={}", |
| 63 | + activity_path("src", "native_app_glue/android_native_app_glue.c") |
| 64 | + ); |
| 65 | + println!( |
| 66 | + "cargo:rerun-if-changed={}", |
| 67 | + activity_path("include", "native_app_glue/android_native_app_glue.h") |
| 68 | + ); |
| 69 | + |
41 | 70 | cc::Build::new()
|
42 |
| - .include("android-games-sdk/include") |
43 |
| - .include(activity_basepath) |
44 |
| - .include(format!("{activity_basepath}/game-activity/native_app_glue")) |
45 |
| - .file(format!("{activity_basepath}/game-activity/native_app_glue/android_native_app_glue.c")) |
| 71 | + .include("android-games-sdk/src/common") |
| 72 | + .include("android-games-sdk/game-activity/prefab-src/modules/game-activity/include") |
| 73 | + .include(activity_path("include", "")) |
| 74 | + .file(activity_path( |
| 75 | + "src", |
| 76 | + "native_app_glue/android_native_app_glue.c", |
| 77 | + )) |
46 | 78 | .extra_warnings(false)
|
47 | 79 | .cpp_link_stdlib("c++_static")
|
48 | 80 | .compile("libnative_app_glue.a");
|
|
0 commit comments