Skip to content

Commit e63df3d

Browse files
committed
build: apply the release compile flags to nativescript-regular
The non-optimized branch of the runtime CMakeLists was treated as a local-debug-only path, but it is also what builds runtime-regular-release.aar, published as nativescript-regular.aar. test-app/app/build.gradle switches an app onto that artifact whenever its package.json sets android.useV8Symbols or any NativeScript dependency declares nativescript.useV8Symbols, so apps that need V8's symbols exported were shipping a runtime built without -fvisibility=hidden, -ffunction-sections or -fno-data-sections. Gate the branch on CMAKE_BUILD_TYPE instead: AGP passes Debug for the debug variant and RelWithDebInfo for release, so local native debugging keeps plain -g while every shipped flavour gets the release flags. Also drops the stale commented-out duplicate of the optimized flag line.
1 parent 55a357a commit e63df3d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

test-app/runtime/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ include_directories(
5858
src/main/cpp/ada
5959
)
6060

61-
if (OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)
61+
# This branch also produces runtime-regular-release.aar, shipped as
62+
# nativescript-regular.aar and selected for apps that set useV8Symbols, so it
63+
# must carry the release flags. Only a local Debug build keeps plain -g.
64+
if (OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD OR NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
6265
set(CMAKE_CXX_FLAGS "${COMMON_CMAKE_ARGUMENTS} -O3 -fvisibility=hidden -ffunction-sections -fno-data-sections")
6366
else ()
6467
set(CMAKE_CXX_FLAGS "${COMMON_CMAKE_ARGUMENTS} -g")
65-
# set(CMAKE_CXX_FLAGS "${COMMON_CMAKE_ARGUMENTS} -O3 -fvisibility=hidden -ffunction-sections -fno-data-sections")
6668
endif ()
6769

6870
if (NOT OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)

0 commit comments

Comments
 (0)