mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-19 18:31:14 +00:00
Merge pull request #4450 from BreadFish64/android3
android: build c++ native libraries
This commit is contained in:
commit
aa168b46a0
@ -187,6 +187,7 @@ if (NOT Boost_FOUND)
|
||||
message(STATUS "Boost 1.66.0 or newer not found, falling back to externals")
|
||||
|
||||
set(BOOST_ROOT "${PROJECT_SOURCE_DIR}/externals/boost")
|
||||
set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost")
|
||||
set(Boost_NO_SYSTEM_PATHS OFF)
|
||||
find_package(Boost QUIET REQUIRED)
|
||||
endif()
|
||||
|
58
CMakeModules/AndroidNdkModules.cmake
Normal file
58
CMakeModules/AndroidNdkModules.cmake
Normal 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()
|
51
bitrise.yml
51
bitrise.yml
@ -42,19 +42,31 @@ workflows:
|
||||
|
||||
The next change in your repository that matches any of your trigger map event will start **deploy** workflow.
|
||||
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: {}
|
||||
- script@1.1.5:
|
||||
title: Do anything with Script step
|
||||
- install-missing-android-tools@2.2.0:
|
||||
title: Install newer cmake
|
||||
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:
|
||||
- gradlew_path: "$PROJECT_LOCATION/gradlew"
|
||||
- change-android-versioncode-and-versionname@1.1.1:
|
||||
inputs:
|
||||
- build_gradle_path: "$PROJECT_LOCATION/$MODULE/build.gradle"
|
||||
- android-lint@0.9.4:
|
||||
- android-lint@0.9.5:
|
||||
inputs:
|
||||
- project_location: "$PROJECT_LOCATION"
|
||||
- module: "$MODULE"
|
||||
@ -71,17 +83,32 @@ workflows:
|
||||
- variant: "$BUILD_VARIANT"
|
||||
- sign-apk@1.2.3:
|
||||
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: {}
|
||||
primary:
|
||||
steps:
|
||||
- cache-pull@2.0.1: {}
|
||||
- script@1.1.5:
|
||||
title: Do anything with Script step
|
||||
- install-missing-android-tools@2.2.0:
|
||||
title: Install newer cmake
|
||||
inputs:
|
||||
- gradlew_path: "$PROJECT_LOCATION/gradlew"
|
||||
- android-lint@0.9.4:
|
||||
- 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:
|
||||
- gradlew_path: "$PROJECT_LOCATION/gradlew"
|
||||
- android-lint@0.9.5:
|
||||
inputs:
|
||||
- project_location: "$PROJECT_LOCATION"
|
||||
- module: "$MODULE"
|
||||
@ -90,7 +117,7 @@ workflows:
|
||||
inputs:
|
||||
- variant: Debug
|
||||
- project_location: "$PROJECT_LOCATION"
|
||||
- deploy-to-bitrise-io@1.3.15: {}
|
||||
- deploy-to-bitrise-io@1.3.18: {}
|
||||
- cache-push@2.0.5: {}
|
||||
app:
|
||||
envs:
|
||||
|
6
externals/cryptopp/CMakeLists.txt
vendored
6
externals/cryptopp/CMakeLists.txt
vendored
@ -242,3 +242,9 @@ target_include_directories(cryptopp INTERFACE .)
|
||||
|
||||
find_package(Threads)
|
||||
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()
|
||||
|
@ -14,6 +14,9 @@ endif()
|
||||
if (ENABLE_QT)
|
||||
add_subdirectory(citra_qt)
|
||||
endif()
|
||||
if (ANDROID)
|
||||
add_subdirectory(android/app)
|
||||
endif()
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
add_subdirectory(web_service)
|
||||
endif()
|
||||
|
@ -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_library(log-lib log)
|
||||
|
||||
target_link_libraries(citra-android ${log-lib} core common inih)
|
||||
|
@ -56,21 +56,20 @@ android {
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version getCmakeVersion()
|
||||
path "CMakeLists.txt"
|
||||
path "../../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
cppFlags "-std=c++17"
|
||||
arguments "-DENABLE_QT=0", // Don't use QT
|
||||
"-DENABLE_SDL2=0", // Don't use SDL
|
||||
"-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work
|
||||
"-DENABLE_CUBEB=0"
|
||||
"-DENABLE_CUBEB=0",
|
||||
"-DANDROID_STL=c++_shared"
|
||||
|
||||
abiFilters "arm64-v8a", "x86_64"
|
||||
abiFilters "arm64-v8a"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
3
src/android/app/src/main/cpp/dummy.cpp
Normal file
3
src/android/app/src/main/cpp/dummy.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
int dummy(int a, int b) {
|
||||
return a + b;
|
||||
}
|
@ -9,6 +9,9 @@ if ($ENV{CI})
|
||||
elseif($ENV{APPVEYOR})
|
||||
set(BUILD_REPOSITORY $ENV{APPVEYOR_REPO_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()
|
||||
# regex capture the string nightly or canary into CMAKE_MATCH_1
|
||||
string(REGEX MATCH "citra-emu/citra-?(.*)" OUTVAR ${BUILD_REPOSITORY})
|
||||
|
@ -17,6 +17,9 @@ class Process;
|
||||
|
||||
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
|
||||
* be mapped.
|
||||
|
Loading…
Reference in New Issue
Block a user