Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions scripts/build_gc_release_android.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@rem Android Boehm, static, for programs compiled with -mtriple=<arch>-linux-android29.
@rem
@rem scripts\build_gc_release_android.bat [arm64-v8a|x86_64] (no argument: both)
@rem
@rem Needs the Android NDK (tested with r30) in ANDROID_NDK_HOME, and Ninja. Installs into
@rem 3rdParty\gc\android\<abi>\release. API level 29 is the floor the default library needs
@rem (timespec_get).
@echo off
setlocal

if "%ANDROID_NDK_HOME%"=="" (
echo ANDROID_NDK_HOME is not set: point it at the Android NDK, e.g. C:\Android\android-ndk-r30
exit /b 1
)
if not exist "%ANDROID_NDK_HOME%\build\cmake\android.toolchain.cmake" (
echo "%ANDROID_NDK_HOME%" is not an Android NDK: build\cmake\android.toolchain.cmake is missing
exit /b 1
)

if "%~1"=="" (
call "%~f0" arm64-v8a || exit /b 1
call "%~f0" x86_64 || exit /b 1
exit /b 0
)

set ABI=%~1
set ROOT=%~dp0..
set BUILD_DIR=%ROOT%\__build\gc\android\%ABI%\release

cmake -S "%ROOT%\3rdParty\gc-8.2.12" -B "%BUILD_DIR%" -G Ninja -Wno-dev ^
-DCMAKE_TOOLCHAIN_FILE="%ANDROID_NDK_HOME%\build\cmake\android.toolchain.cmake" ^
-DANDROID_ABI=%ABI% -DANDROID_PLATFORM=android-29 ^
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON ^
-DCMAKE_INSTALL_PREFIX="%ROOT%\3rdParty\gc\android\%ABI%\release" ^
-Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF -Dbuild_tests=OFF -Dbuild_cord=OFF || exit /b 1
cmake --build "%BUILD_DIR%" -j 8 || exit /b 1
cmake --install "%BUILD_DIR%" || exit /b 1
36 changes: 36 additions & 0 deletions scripts/build_tslang_runtime_release_android.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@rem TypeScriptAsyncRuntime for Android, linked into programs compiled with
@rem -mtriple=<arch>-linux-android29.
@rem
@rem scripts\build_tslang_runtime_release_android.bat [arm64-v8a|x86_64] (no argument: both)
@rem
@rem Needs the Android NDK in ANDROID_NDK_HOME, Ninja, the Android gc
@rem (scripts\build_gc_release_android.bat) for gc.h, and 3rdParty\llvm\x64\release\include for
@rem the one header-only MLIR file (see tslang\runtime\CMakeLists.txt). Installs
@rem libTypeScriptAsyncRuntime.a into __build\tslang-runtime\release\android\<abi>.
@echo off
setlocal

if "%ANDROID_NDK_HOME%"=="" (
echo ANDROID_NDK_HOME is not set: point it at the Android NDK, e.g. C:\Android\android-ndk-r30
exit /b 1
)

if "%~1"=="" (
call "%~f0" arm64-v8a || exit /b 1
call "%~f0" x86_64 || exit /b 1
exit /b 0
)

set ABI=%~1
set ROOT=%~dp0..
set BUILD_DIR=%ROOT%\__build\tslang-runtime\ninja\android\%ABI%\release

cmake -S "%ROOT%\tslang\runtime" -B "%BUILD_DIR%" -G Ninja -Wno-dev ^
-DCMAKE_TOOLCHAIN_FILE="%ANDROID_NDK_HOME%\build\cmake\android.toolchain.cmake" ^
-DANDROID_ABI=%ABI% -DANDROID_PLATFORM=android-29 ^
-DCMAKE_BUILD_TYPE=Release ^
-DTSLANG_GC_INCLUDE="%ROOT%\3rdParty\gc\android\%ABI%\release\include" ^
-DTSLANG_MLIR_INCLUDE="%ROOT%\3rdParty\llvm\x64\release\include" ^
-DCMAKE_INSTALL_PREFIX="%ROOT%\__build\tslang-runtime\release\android\%ABI%" || exit /b 1
cmake --build "%BUILD_DIR%" -j 8 || exit /b 1
cmake --install "%BUILD_DIR%" || exit /b 1
8 changes: 7 additions & 1 deletion tslang/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ if (NOT EXISTS "${TSLANG_MLIR_INCLUDE}/mlir/ExecutionEngine/AsyncRuntime.h")
endif()

set(SRC "${CMAKE_CURRENT_SOURCE_DIR}/../lib/TypeScriptAsyncRuntime")
add_library(TypeScriptAsyncRuntime STATIC "${SRC}/AsyncRuntime.cpp" "${SRC}/DynamicRuntime.cpp")
# The same sources as lib/TypeScriptAsyncRuntime/CMakeLists.txt: without AsyncGCThreads.cpp a `gc`
# program using async does not link (GC_enable_threads); ProcessHeap.cpp is empty off Windows.
add_library(TypeScriptAsyncRuntime STATIC
"${SRC}/AsyncRuntime.cpp"
"${SRC}/AsyncGCThreads.cpp"
"${SRC}/ProcessHeap.cpp"
"${SRC}/DynamicRuntime.cpp")
target_include_directories(TypeScriptAsyncRuntime PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../include"
"${CMAKE_CURRENT_SOURCE_DIR}/../lib"
Expand Down
Loading