Skip to content

Commit

Permalink
Merge branch 'fix/gc_once_when_disposed' into feat-css-style-sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
andycall committed Nov 19, 2021
2 parents ec9126b + 473c453 commit bbaf7ca
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 5 deletions.
6 changes: 4 additions & 2 deletions bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ if (ENABLE_ASAN)
add_link_options(-fsanitize=address -fno-omit-frame-pointer)
endif ()

if (DEFINED ${PLATFORM} AND ${PLATFORM} STREQUAL "OS")
add_compile_options(-fno-aligned-allocation)
if (DEFINED PLATFORM)
if (${PLATFORM} STREQUAL "OS")
add_compile_options(-fno-aligned-allocation)
endif()
endif()

list(APPEND BRIDGE_SOURCE
Expand Down
1 change: 0 additions & 1 deletion bridge/bindings/qjs/js_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ JSContext::~JSContext() {
}
}

JS_RunGC(m_runtime);
JS_FreeValue(m_ctx, globalObject);
JS_FreeContext(m_ctx);
JS_RunGC(m_runtime);
Expand Down
46 changes: 44 additions & 2 deletions scripts/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,19 @@ function patchiOSFrameworkPList(frameworkPath) {

task(`build-ios-kraken-lib`, (done) => {
const buildType = (buildMode == 'Release' || buildMode === 'RelWithDebInfo') ? 'RelWithDebInfo' : 'Debug';
let externCmakeArgs = [];

if (process.env.ENABLE_ASAN === 'true') {
externCmakeArgs.push('-DENABLE_ASAN=true');
}

// generate build scripts for simulator
execSync(`cmake -DCMAKE_BUILD_TYPE=${buildType} \
-DCMAKE_TOOLCHAIN_FILE=${paths.bridge}/cmake/ios.toolchain.cmake \
-DPLATFORM=SIMULATOR64 \
-DDEPLOYMENT_TARGET=9.0 \
${isProfile ? '-DENABLE_PROFILE=TRUE \\' : '\\'}
${externCmakeArgs.join(' ')} \
-DENABLE_BITCODE=TRUE -G "Unix Makefiles" -B ${paths.bridge}/cmake-build-ios-x64 -S ${paths.bridge}`, {
cwd: paths.bridge,
stdio: 'inherit',
Expand All @@ -448,11 +454,13 @@ task(`build-ios-kraken-lib`, (done) => {
stdio: 'inherit'
});

// Generate builds scripts for ARMv7, ARMv7, ARM64
// Generate builds scripts for ARMv7s, ARMv7
execSync(`cmake -DCMAKE_BUILD_TYPE=${buildType} \
-DCMAKE_TOOLCHAIN_FILE=${paths.bridge}/cmake/ios.toolchain.cmake \
-DPLATFORM=OS \
-DARCHS="armv7;armv7s" \
-DDEPLOYMENT_TARGET=9.0 \
${externCmakeArgs.join(' ')} \
${isProfile ? '-DENABLE_PROFILE=TRUE \\' : '\\'}
-DENABLE_BITCODE=TRUE -G "Unix Makefiles" -B ${paths.bridge}/cmake-build-ios-arm -S ${paths.bridge}`, {
cwd: paths.bridge,
Expand All @@ -464,17 +472,44 @@ task(`build-ios-kraken-lib`, (done) => {
}
});

// Build for ARMv7
// Build for ARMv7, ARMv7s
execSync(`cmake --build ${paths.bridge}/cmake-build-ios-arm --target kraken kraken_static -- -j 12`, {
stdio: 'inherit'
});

// Generate builds scripts for ARMv7s, ARMv7
execSync(`cmake -DCMAKE_BUILD_TYPE=${buildType} \
-DCMAKE_TOOLCHAIN_FILE=${paths.bridge}/cmake/ios.toolchain.cmake \
-DPLATFORM=OS64 \
-DDEPLOYMENT_TARGET=9.0 \
${externCmakeArgs.join(' ')} \
${isProfile ? '-DENABLE_PROFILE=TRUE \\' : '\\'}
-DENABLE_BITCODE=TRUE -G "Unix Makefiles" -B ${paths.bridge}/cmake-build-ios-arm64 -S ${paths.bridge}`, {
cwd: paths.bridge,
stdio: 'inherit',
env: {
...process.env,
KRAKEN_JS_ENGINE: targetJSEngine,
LIBRARY_OUTPUT_DIR: path.join(paths.bridge, 'build/ios/lib/arm64')
}
});

// Build for ARM64
execSync(`cmake --build ${paths.bridge}/cmake-build-ios-arm64 --target kraken kraken_static -- -j 12`, {
stdio: 'inherit'
});

const targetSourceFrameworks = ['kraken_bridge', 'quickjs'];

targetSourceFrameworks.forEach(target => {
const armDynamicSDKPath = path.join(paths.bridge, `build/ios/lib/arm/${target}.framework`);
const arm64DynamicSDKPath = path.join(paths.bridge, `build/ios/lib/arm64/${target}.framework`);
const x64DynamicSDKPath = path.join(paths.bridge, `build/ios/lib/x86_64/${target}.framework`);

execSync(`lipo -create ${armDynamicSDKPath}/${target} ${arm64DynamicSDKPath}/${target} -output ${armDynamicSDKPath}/${target}`, {
stdio: 'inherit'
});

patchiOSFrameworkPList(x64DynamicSDKPath);
patchiOSFrameworkPList(armDynamicSDKPath);

Expand Down Expand Up @@ -582,6 +617,12 @@ task('build-android-kraken-lib', (done) => {
'armeabi-v7a': 'arm-linux-androideabi'
};
const buildType = (buildMode === 'Release' || buildMode == 'Relwithdebinfo') ? 'Relwithdebinfo' : 'Debug';
let externCmakeArgs = [];

if (process.env.ENABLE_ASAN === 'true') {
externCmakeArgs.push('-DENABLE_ASAN=true');
}


const cmakeGeneratorTemplate = platform == 'win32' ? 'Ninja' : 'Unix Makefiles';
archs.forEach(arch => {
Expand All @@ -595,6 +636,7 @@ task('build-android-kraken-lib', (done) => {
-DIS_ANDROID=TRUE \
-DANDROID_ABI="${arch}" \
${isProfile ? '-DENABLE_PROFILE=TRUE \\' : '\\'}
${externCmakeArgs.join(' ')} \
-DANDROID_PLATFORM="android-18" \
-DANDROID_STL=c++_shared \
-G "${cmakeGeneratorTemplate}" \
Expand Down

0 comments on commit bbaf7ca

Please sign in to comment.