diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 index 1001ffffbf271f344cc8709bea10faa96edfe6d7..00d934e7c53a47ac409bab4165930a0a15621733 100644 --- a/entry/build-profile.json5 +++ b/entry/build-profile.json5 @@ -1,13 +1,26 @@ +// [Start json5_start2] +// [StartExclude json5_start2] { "apiType": "stageMode", + // [EndExclude json5_start2] "buildOption": { + // [StartExclude json5_start2] "externalNativeOptions": { "path": "./src/main/cpp/CMakeLists.txt", "arguments": "", "cppFlags": "", "abiFilters": ["x86_64","arm64-v8a"] + }, + // [EndExclude json5_start2] + "arkOptions" : { + "runtimeOnly" : { + "packages": [ + "static_module" + ] + } } }, + // [StartExclude json5_start2] "buildOptionSet": [ { "name": "release", @@ -37,4 +50,6 @@ "name": "ohosTest", } ] -} \ No newline at end of file +} +// [EndExclude json5_start2] +// [End json5_start2] \ No newline at end of file diff --git a/entry/oh_modules/static_module/src/main/cpp/napi_har.h b/entry/oh_modules/static_module/src/main/cpp/napi_har.h new file mode 100644 index 0000000000000000000000000000000000000000..84d15a739d7454ead9636d845b8139114e3bff35 --- /dev/null +++ b/entry/oh_modules/static_module/src/main/cpp/napi_har.h @@ -0,0 +1,26 @@ +/* +* Copyright (C) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// [Start har_start] +// staticModule\src\main\cpp\napi_har.h +#ifndef CROSSMODULEREFERENCE_NAPI_HAR_H +#define CROSSMODULEREFERENCE_NAPI_HAR_H +#include +napi_env g_main_env; +void setHarEnv(napi_env env); +double harNativeAdd(double a, double b); +napi_value harArkTSAdd(double a, double b); +#endif //CROSSMODULEREFERENCE_NAPI_HAR_H +// [End har_start] \ No newline at end of file diff --git a/entry/oh_modules/static_module/src/main/cpp/napi_har1.h b/entry/oh_modules/static_module/src/main/cpp/napi_har1.h new file mode 100644 index 0000000000000000000000000000000000000000..8c9cf7ad9c8112819d897d93c9a5300aaa830cf8 --- /dev/null +++ b/entry/oh_modules/static_module/src/main/cpp/napi_har1.h @@ -0,0 +1,23 @@ +/* +* Copyright (C) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// [Start napi_har_start] +// staticModule\src\main\cpp\napi_har.h +#ifndef CROSSMODULEREFERENCE_NAPI_HAR_H +#define CROSSMODULEREFERENCE_NAPI_HAR_H +#include +double harNativeAdd(double a, double b); +#endif //CROSSMODULEREFERENCE_NAPI_HAR_H +// [End napi_har_start] \ No newline at end of file diff --git a/staticModule/build-profile.json5 b/staticModule/build-profile.json5 index 0ff9b0d5d189892e84ad83b0f669e5aaf09298ae..0b4401e771ecf9ccd5e9f214c5803f5c79cec5f9 100644 --- a/staticModule/build-profile.json5 +++ b/staticModule/build-profile.json5 @@ -1,4 +1,5 @@ // [Start json5_start] +// [Start json5_start1] { "apiType": "stageMode", "buildOption": { @@ -12,6 +13,7 @@ "nativeLib": { "headerPath": "./src/main/cpp" }, + // [StartExclude json5_start1] // [EndExclude json5_start] "arkOptions" : { "runtimeOnly" : { @@ -54,6 +56,10 @@ "name": "ohosTest" } ], + // [EndExclude json5_start1] // [EndExclude json5_start] } +// [End json5_start1] // [End json5_start] + +