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