Skip to content

Commit

Permalink
android: add forgotten CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Nov 20, 2024
1 parent 88f91d3 commit 22fef6f
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
48 changes: 48 additions & 0 deletions android/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
cmake_minimum_required(VERSION 3.6)

# Only used to build Android project

project(XASH_ANDROID)

# armeabi-v7a requires cpufeatures library
include(AndroidNdkModules)
android_ndk_import_module_cpufeatures()

find_package(PythonInterp 2.7 REQUIRED)

get_filename_component(C_COMPILER_ID ${CMAKE_C_COMPILER} NAME_WE)
get_filename_component(CXX_COMPILER_ID ${CMAKE_CXX_COMPILER} NAME_WE)

if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(BUILD_TYPE "debug")
else()
set(BUILD_TYPE "release")
endif()

if(CMAKE_SIZEOF_VOID_P MATCHES "8")
set(64BIT ON CACHE BOOL "" FORCE)
set(WAF_EXTRA_ARGS "-8")
endif()

set(CMAKE_VERBOSE_MAKEFILE ON)

set(WAF_CC "${CMAKE_C_COMPILER} --target=${CMAKE_C_COMPILER_TARGET}")
set(WAF_CXX "${CMAKE_CXX_COMPILER} --target=${CMAKE_CXX_COMPILER_TARGET}")

# not cleanest way to get upper directory
set(ENGINE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../")

execute_process(
COMMAND ${CMAKE_COMMAND} -E env
CC=${WAF_CC} CXX=${WAF_CXX}
AR=${CMAKE_AR} STRIP=${CMAKE_STRIP}
${PYTHON_EXECUTABLE} waf configure -vvv -T ${BUILD_TYPE} ${WAF_EXTRA_ARGS} cmake
--check-c-compiler=${C_COMPILER_ID} --check-cxx-compiler=${CXX_COMPILER_ID}
-s "${ENGINE_SOURCE_DIR}/SDL" --skip-sdl2-sanity-check
WORKING_DIRECTORY "${ENGINE_SOURCE_DIR}"
)

add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/hlsdk-portable" hlsdk-portable)
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/SDL" SDL)
add_subdirectory("${ENGINE_SOURCE_DIR}/" xash3d-fwgs)
add_subdirectory("${ENGINE_SOURCE_DIR}/3rdparty/mainui" mainui)
2 changes: 1 addition & 1 deletion android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {
externalNativeBuild {
cmake {
version = "3.22.1"
path = file("${project.projectDir}/CMakeLists.txt")
path = file("CMakeLists.txt")
}
}

Expand Down
12 changes: 8 additions & 4 deletions scripts/gha/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@ export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$AN

pushd android

./gradlew assembleContinuous
./gradlew assembleContinuous || exit 1

pushd app/build/outputs/apk/continuous

$ANDROID_HOME/build-tools/34.0.0/apksigner sign --ks $GITHUB_WORKSPACE/android/debug.keystore --ks-key-alias androiddebugkey \
--ks-pass pass:android --key-pass pass:android --out app-debug-signed.apk app-debug.apk
$ANDROID_HOME/build-tools/34.0.0/apksigner sign \
--ks $GITHUB_WORKSPACE/android/debug.keystore \
--ks-key-alias androiddebugkey \
--ks-pass pass:android \
--key-pass pass:android \
--out app-continuous-signed.apk app-continuous.apk || exit 1

popd
popd

mkdir -p artifacts/

mv android/app/build/outputs/apk/debug/app-debug-signed.apk artifacts/xash3d-fwgs-android.apk
mv android/app/build/outputs/apk/debug/app-continuous-signed.apk artifacts/xash3d-fwgs-android.apk

0 comments on commit 22fef6f

Please sign in to comment.