citra-emu
/
citra
Archived
1
0
Fork 0

android: set up cmake

This commit is contained in:
BreadFish64 2018-11-18 18:23:41 -06:00 committed by Weiyi Wang
parent cee7c0baa5
commit 6609ff83a7
8 changed files with 61 additions and 21 deletions

View File

@ -187,6 +187,7 @@ if (NOT Boost_FOUND)
message(STATUS "Boost 1.66.0 or newer not found, falling back to externals") message(STATUS "Boost 1.66.0 or newer not found, falling back to externals")
set(BOOST_ROOT "${PROJECT_SOURCE_DIR}/externals/boost") set(BOOST_ROOT "${PROJECT_SOURCE_DIR}/externals/boost")
set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost")
set(Boost_NO_SYSTEM_PATHS OFF) set(Boost_NO_SYSTEM_PATHS OFF)
find_package(Boost QUIET REQUIRED) find_package(Boost QUIET REQUIRED)
endif() endif()

View File

@ -47,12 +47,12 @@ macro(android_ndk_import_module_ndk_helper)
if(ANDROID) if(ANDROID)
android_ndk_import_module_cpufeatures() android_ndk_import_module_cpufeatures()
android_ndk_import_module_native_app_glue() android_ndk_import_module_native_app_glue()
include_directories(${ANDROID_NDK}/sources/android/ndk_helper) include_directories(${ANDROID_NDK}/sources/android/ndk_helper)
file(GLOB _NDK_HELPER_SRCS ${ANDROID_NDK}/sources/android/ndk_helper/*.cpp ${ANDROID_NDK}/sources/android/ndk_helper/gl3stub.c) file(GLOB _NDK_HELPER_SRCS ${ANDROID_NDK}/sources/android/ndk_helper/*.cpp ${ANDROID_NDK}/sources/android/ndk_helper/gl3stub.c)
add_library(ndk_helper ${_NDK_HELPER_SRCS}) add_library(ndk_helper ${_NDK_HELPER_SRCS})
target_link_libraries(ndk_helper log android EGL GLESv2 cpufeatures native_app_glue) target_link_libraries(ndk_helper log android EGL GLESv2 cpufeatures native_app_glue)
unset(_NDK_HELPER_SRCS) unset(_NDK_HELPER_SRCS)
endif() endif()
endmacro() endmacro()

View File

@ -42,19 +42,31 @@ workflows:
The next change in your repository that matches any of your trigger map event will start **deploy** workflow. The next change in your repository that matches any of your trigger map event will start **deploy** workflow.
steps: steps:
- activate-ssh-key@4.0.3:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@4.0.11: {}
- cache-pull@2.0.1: {} - cache-pull@2.0.1: {}
- script@1.1.5: - script@1.1.5:
title: Do anything with Script step title: Install newer cmake
- install-missing-android-tools@2.2.0: inputs:
- content: |-
#!/bin/bash
set -ex
sudo apt remove cmake -y
sudo apt purge --auto-remove cmake -y
sudo apt install ninja-build -y
version=3.8
build=2
mkdir ~/temp
cd ~/temp
wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh
sudo mkdir /opt/cmake
sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake --skip-license --exclude-subdir
envman add --key PATH --value "/opt/cmake/bin:$PATH"
- install-missing-android-tools@2.3.3:
inputs: inputs:
- gradlew_path: "$PROJECT_LOCATION/gradlew" - gradlew_path: "$PROJECT_LOCATION/gradlew"
- change-android-versioncode-and-versionname@1.1.1: - change-android-versioncode-and-versionname@1.1.1:
inputs: inputs:
- build_gradle_path: "$PROJECT_LOCATION/$MODULE/build.gradle" - build_gradle_path: "$PROJECT_LOCATION/$MODULE/build.gradle"
- android-lint@0.9.4: - android-lint@0.9.5:
inputs: inputs:
- project_location: "$PROJECT_LOCATION" - project_location: "$PROJECT_LOCATION"
- module: "$MODULE" - module: "$MODULE"
@ -71,17 +83,32 @@ workflows:
- variant: "$BUILD_VARIANT" - variant: "$BUILD_VARIANT"
- sign-apk@1.2.3: - sign-apk@1.2.3:
run_if: '{{getenv "BITRISEIO_ANDROID_KEYSTORE_URL" | ne ""}}' run_if: '{{getenv "BITRISEIO_ANDROID_KEYSTORE_URL" | ne ""}}'
- deploy-to-bitrise-io@1.3.15: {} - deploy-to-bitrise-io@1.3.18: {}
- cache-push@2.0.5: {} - cache-push@2.0.5: {}
primary: primary:
steps: steps:
- cache-pull@2.0.1: {} - cache-pull@2.0.1: {}
- script@1.1.5: - script@1.1.5:
title: Do anything with Script step title: Install newer cmake
- install-missing-android-tools@2.2.0:
inputs: inputs:
- gradlew_path: "$PROJECT_LOCATION/gradlew" - content: |-
- android-lint@0.9.4: #!/bin/bash
set -ex
sudo apt remove cmake -y
sudo apt purge --auto-remove cmake -y
sudo apt install ninja-build -y
version=3.8
build=2
mkdir ~/temp
cd ~/temp
wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh
sudo mkdir /opt/cmake
sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake --skip-license --exclude-subdir
envman add --key PATH --value "/opt/cmake/bin:$PATH"
- install-missing-android-tools@2.3.3:
inputs:
- gradlew_path: "$PROJECT_LOCATION/gradlew"
- android-lint@0.9.5:
inputs: inputs:
- project_location: "$PROJECT_LOCATION" - project_location: "$PROJECT_LOCATION"
- module: "$MODULE" - module: "$MODULE"
@ -90,7 +117,7 @@ workflows:
inputs: inputs:
- variant: Debug - variant: Debug
- project_location: "$PROJECT_LOCATION" - project_location: "$PROJECT_LOCATION"
- deploy-to-bitrise-io@1.3.15: {} - deploy-to-bitrise-io@1.3.18: {}
- cache-push@2.0.5: {} - cache-push@2.0.5: {}
app: app:
envs: envs:

View File

@ -14,6 +14,9 @@ endif()
if (ENABLE_QT) if (ENABLE_QT)
add_subdirectory(citra_qt) add_subdirectory(citra_qt)
endif() endif()
if (ANDROID)
add_subdirectory(android/app)
endif()
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)
add_subdirectory(web_service) add_subdirectory(web_service)
endif() endif()

View File

@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 3.6.0) cmake_minimum_required(VERSION 3.8)
# TODO: actually add files to compile add_library(citra-android STATIC
src/main/cpp/dummy.cpp
)
# find Android's log library # find Android's log library
find_library(log-lib log) find_library(log-lib log)
target_link_libraries(citra-android ${log-lib} core common inih)

View File

@ -56,21 +56,20 @@ android {
externalNativeBuild { externalNativeBuild {
cmake { cmake {
version getCmakeVersion() version getCmakeVersion()
path "CMakeLists.txt" path "../../../CMakeLists.txt"
} }
} }
defaultConfig { defaultConfig {
externalNativeBuild { externalNativeBuild {
cmake { cmake {
cppFlags "-std=c++17"
arguments "-DENABLE_QT=0", // Don't use QT arguments "-DENABLE_QT=0", // Don't use QT
"-DENABLE_SDL2=0", // Don't use SDL "-DENABLE_SDL2=0", // Don't use SDL
"-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work "-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work
"-DENABLE_CUBEB=0" "-DENABLE_CUBEB=0",
"-DANDROID_STL=c++_shared" "-DANDROID_STL=c++_shared"
abiFilters "arm64-v8a", "x86_64" abiFilters "arm64-v8a"
} }
} }
} }

View File

@ -0,0 +1,3 @@
int dummy(int a, int b) {
return a + b;
}

View File

@ -9,6 +9,9 @@ if ($ENV{CI})
elseif($ENV{APPVEYOR}) elseif($ENV{APPVEYOR})
set(BUILD_REPOSITORY $ENV{APPVEYOR_REPO_NAME}) set(BUILD_REPOSITORY $ENV{APPVEYOR_REPO_NAME})
set(BUILD_TAG $ENV{APPVEYOR_REPO_TAG_NAME}) set(BUILD_TAG $ENV{APPVEYOR_REPO_TAG_NAME})
elseif($ENV{BITRISE_IO})
set(BUILD_REPOSITORY "$ENV{BITRISEIO_GIT_REPOSITORY_OWNER}/$ENV{BITRISEIO_GIT_REPOSITORY_SLUG}")
set(BUILD_TAG $ENV{BITRISE_GIT_TAG})
endif() endif()
# regex capture the string nightly or canary into CMAKE_MATCH_1 # regex capture the string nightly or canary into CMAKE_MATCH_1
string(REGEX MATCH "citra-emu/citra-?(.*)" OUTVAR ${BUILD_REPOSITORY}) string(REGEX MATCH "citra-emu/citra-?(.*)" OUTVAR ${BUILD_REPOSITORY})