From 5c63332f469e4a39197adbc52198dc5ecbda3c7f Mon Sep 17 00:00:00 2001 From: johnche Date: Thu, 12 Sep 2024 11:07:12 +0800 Subject: [PATCH] =?UTF-8?q?[unity]native=5Fsrc=5Fil2cpp=E7=9A=84ci?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1unityenv=5Ffor=5Fpuerts.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unity/cli/make.mts | 12 +++++++++--- unity/cli/unityenv_for_puerts.h | 9 +++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 unity/cli/unityenv_for_puerts.h diff --git a/unity/cli/make.mts b/unity/cli/make.mts index f2d000467b..d4dfa028fc 100644 --- a/unity/cli/make.mts +++ b/unity/cli/make.mts @@ -265,9 +265,15 @@ async function runPuertsMake(cwd: string, options: BuildOptions) { const linkD = (BackendConfig['link-libraries'][options.platform]?.[options.arch] || []).join(';') const incD = (BackendConfig.include || []).join(';') - if ('native_src_il2cpp' == basename(cwd) && !existsSync(`${cwd}/Src/FunctionBridge.Gen.h`)) { - console.warn(`${cwd}/Src/FunctionBridge.Gen.h not existed! using default one`); - cp(join(cwd, '../cli/FunctionBridge.Gen.h'), join(cwd, 'Src/FunctionBridge.Gen.h')); + if ('native_src_il2cpp' == basename(cwd)) { + if (!existsSync(join(cwd, 'Src/FunctionBridge.Gen.h'))) { + console.warn(`${cwd}/Src/FunctionBridge.Gen.h not existed! using default one`); + cp(join(cwd, '../cli/FunctionBridge.Gen.h'), join(cwd, 'Src/FunctionBridge.Gen.h')); + } + if (!existsSync(join(cwd, '../Assets/core/upm/Plugins/puerts_il2cpp/unityenv_for_puerts.h'))) { + console.warn(`${join(cwd, '../Assets/core/upm/Plugins/puerts_il2cpp/unityenv_for_puerts.h')} not existed! using default one`); + cp(join(cwd, '../cli/unityenv_for_puerts.h'), join(cwd, 'Inc/unityenv_for_puerts.h')); + } } mkdir('-p', CMAKE_BUILD_PATH); diff --git a/unity/cli/unityenv_for_puerts.h b/unity/cli/unityenv_for_puerts.h new file mode 100644 index 0000000000..f6cbb8dc22 --- /dev/null +++ b/unity/cli/unityenv_for_puerts.h @@ -0,0 +1,9 @@ + +#ifndef UNITY_2021_1_OR_NEWER + #define UNITY_2021_1_OR_NEWER +#endif + +#ifndef PUERTS_SHARED + #define PUERTS_SHARED +#endif + \ No newline at end of file