citra-emu
/
citra
Archived
1
0
Fork 0

Merge pull request #4450 from BreadFish64/android3

android: build c++ native libraries
This commit is contained in:
Weiyi Wang 2018-11-20 14:41:22 -05:00 committed by GitHub
commit aa168b46a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 125 additions and 18 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

@ -0,0 +1,58 @@
# Copyright (c) 2014, Pavel Rojtberg
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
macro(android_ndk_import_module_cpufeatures)
if(ANDROID)
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
add_library(cpufeatures ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
target_link_libraries(cpufeatures dl)
endif()
endmacro()
macro(android_ndk_import_module_native_app_glue)
if(ANDROID)
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
add_library(native_app_glue ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
target_link_libraries(native_app_glue log)
endif()
endmacro()
macro(android_ndk_import_module_ndk_helper)
if(ANDROID)
android_ndk_import_module_cpufeatures()
android_ndk_import_module_native_app_glue()
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)
add_library(ndk_helper ${_NDK_HELPER_SRCS})
target_link_libraries(ndk_helper log android EGL GLESv2 cpufeatures native_app_glue)
unset(_NDK_HELPER_SRCS)
endif()
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

@ -242,3 +242,9 @@ target_include_directories(cryptopp INTERFACE .)
find_package(Threads) find_package(Threads)
target_link_libraries(cryptopp PRIVATE ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(cryptopp PRIVATE ${CMAKE_THREAD_LIBS_INIT})
if(ANDROID)
include(AndroidNdkModules)
android_ndk_import_module_cpufeatures()
target_link_libraries(cryptopp PRIVATE cpufeatures)
endif()

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})

View File

@ -17,6 +17,9 @@ class Process;
namespace Memory { namespace Memory {
// Are defined in a system header
#undef PAGE_SIZE
#undef PAGE_MASK
/** /**
* Page size used by the ARM architecture. This is the smallest granularity with which memory can * Page size used by the ARM architecture. This is the smallest granularity with which memory can
* be mapped. * be mapped.