Skip to content

Commit

Permalink
Update NDK, Gradle and dependencies + Improve Settings API + Migrate …
Browse files Browse the repository at this point in the history
…to PugiXML
  • Loading branch information
PixelyIon committed Mar 5, 2021
1 parent 1f48fdd commit 80302cf
Show file tree
Hide file tree
Showing 30 changed files with 176 additions and 198 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "app/libraries/tinyxml2"]
path = app/libraries/tinyxml2
url = https://github.com/leethomason/tinyxml2
[submodule "app/libraries/fmt"]
path = app/libraries/fmt
url = https://github.com/fmtlib/fmt
Expand All @@ -17,3 +14,6 @@
[submodule "app/libraries/frozen"]
path = app/libraries/frozen
url = https://github.com/serge-sans-paille/frozen
[submodule "app/libraries/pugixml"]
path = app/libraries/pugixml
url = https://github.com/zeux/pugixml.git
10 changes: 10 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/scopes/SkylineKotlin.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.16)
project(Skyline LANGUAGES CXX ASM VERSION 0.3)

set(BUILD_TESTS OFF)
set(BUILD_TESTING OFF)
set(BUILD_TESTS OFF CACHE BOOL "Build Tests" FORCE)
set(BUILD_TESTING OFF CACHE BOOL "Build Testing" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

set(source_DIR ${CMAKE_SOURCE_DIR}/src/main/cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -flto=full -fno-stack-protector -Wno-unused-command-line-argument")
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
add_compile_definitions(NDEBUG)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif ()

set(CMAKE_POLICY_DEFAULT_CMP0048 OLD)
add_subdirectory("libraries/tinyxml2")
add_subdirectory("libraries/fmt")

add_subdirectory("libraries/oboe")
add_subdirectory("libraries/lz4/contrib/cmake_unofficial")
include_directories("libraries/lz4/lib")
include_directories("libraries/oboe/include")

set(LZ4_BUILD_CLI OFF CACHE BOOL "Build LZ4 CLI" FORCE)
add_subdirectory("libraries/lz4/build/cmake")
include_directories("libraries/lz4/lib")

include_directories("libraries/vkhpp/include")
include_directories("libraries/pugixml/src") # We use PugiXML in header-only mode
include_directories("libraries/frozen/include")
set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)

find_package(mbedtls REQUIRED CONFIG)

Expand Down Expand Up @@ -163,7 +166,5 @@ add_library(skyline SHARED
${source_DIR}/skyline/services/ssl/ISslContext.cpp
${source_DIR}/skyline/services/prepo/IPrepoService.cpp
)

target_link_libraries(skyline vulkan android fmt tinyxml2 oboe lz4_static mbedtls::mbedcrypto)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=c++2a")
target_compile_options(skyline PRIVATE -Wno-c++17-extensions -Wall -Wno-reorder -Wno-missing-braces -Wno-unused-variable -Wno-unused-private-field)
target_link_libraries(skyline vulkan android fmt lz4_static oboe mbedtls::mbedcrypto)
target_compile_options(skyline PRIVATE -Wall -Wno-unknown-attributes -Wno-c++20-extensions -Wno-c++17-extensions -Wno-c99-designator -Wno-reorder -Wno-missing-braces -Wno-unused-variable -Wno-unused-private-field)
69 changes: 46 additions & 23 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,32 @@ apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
buildToolsVersion '30.0.3'
defaultConfig {
applicationId "skyline.emu"

minSdkVersion 26
targetSdkVersion 30

versionCode 3
versionName "0.3"

ndk {
abiFilters "arm64-v8a"
}
}
lintOptions {
disable 'IconLocation'

/* JVM Bytecode Options */
def javaVersion = JavaVersion.VERSION_11
compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = javaVersion.toString()
}

/* Build Options */
buildTypes {
release {
debuggable true
Expand All @@ -34,43 +43,57 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}

debug {
debuggable true
minifyEnabled false
shrinkResources false
}
}
buildFeatures {
prefab true
viewBinding false
}

/* Android Extensions */
androidExtensions {
/* TODO: Remove this after migrating to View Bindings */
experimental = true
}

/* Linting */
lintOptions {
disable 'IconLocation'
}

/* NDK */
ndkVersion '22.0.7026061'
externalNativeBuild {
cmake {
version "3.10.2+"
version '3.18.1+'
path "CMakeLists.txt"
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
ndkVersion '21.3.6528147'
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
/* Filetrees */
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

/* Google */
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.preference:preference:1.1.1'
implementation 'com.google.android.material:material:1.3.0-alpha02'
implementation "androidx.core:core-ktx:1.3.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.material:material:1.3.0-rc01'
implementation 'androidx.documentfile:documentfile:1.0.1'
implementation 'info.debatty:java-string-similarity:1.2.1'
implementation(name: 'mbedtls', ext: 'aar')
}
repositories {
mavenCentral()
flatDir {
dirs 'libraries'
}

/* Kotlin */
implementation "androidx.core:core-ktx:1.3.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

/* Other Java */
implementation 'info.debatty:java-string-similarity:2.0.0'

/* NDK */
implementation files("libraries/mbedtls.aar")
}
2 changes: 1 addition & 1 deletion app/libraries/fmt
Submodule fmt updated 102 files
2 changes: 1 addition & 1 deletion app/libraries/lz4
Submodule lz4 updated 69 files
+1 −1 .cirrus.yml
+32 −0 .github/ISSUE_TEMPLATE/bug_report.md
+20 −0 .github/ISSUE_TEMPLATE/feature_request.md
+25 −9 .travis.yml
+10 −5 Makefile
+36 −0 NEWS
+1 −13 README.md
+21 −15 appveyor.yml
+0 −0 build/.gitignore
+10 −8 build/README.md
+0 −0 build/VS2010/datagen/datagen.vcxproj
+0 −0 build/VS2010/frametest/frametest.vcxproj
+0 −0 build/VS2010/fullbench-dll/fullbench-dll.vcxproj
+0 −0 build/VS2010/fullbench/fullbench.vcxproj
+0 −0 build/VS2010/fuzzer/fuzzer.vcxproj
+0 −0 build/VS2010/liblz4-dll/liblz4-dll.rc
+0 −0 build/VS2010/liblz4-dll/liblz4-dll.vcxproj
+0 −0 build/VS2010/liblz4/liblz4.vcxproj
+0 −0 build/VS2010/lz4.sln
+0 −0 build/VS2010/lz4/lz4.rc
+0 −0 build/VS2010/lz4/lz4.vcxproj
+0 −0 build/VS2017/datagen/datagen.vcxproj
+0 −0 build/VS2017/frametest/frametest.vcxproj
+0 −0 build/VS2017/fullbench-dll/fullbench-dll.vcxproj
+0 −0 build/VS2017/fullbench/fullbench.vcxproj
+0 −0 build/VS2017/fuzzer/fuzzer.vcxproj
+0 −0 build/VS2017/liblz4-dll/liblz4-dll.rc
+0 −0 build/VS2017/liblz4-dll/liblz4-dll.vcxproj
+0 −0 build/VS2017/liblz4/liblz4.vcxproj
+0 −0 build/VS2017/lz4.sln
+0 −0 build/VS2017/lz4/lz4.rc
+0 −0 build/VS2017/lz4/lz4.vcxproj
+0 −0 build/cmake/.gitignore
+13 −6 build/cmake/CMakeLists.txt
+2 −2 contrib/debian/copyright
+1 −2 contrib/debian/rules
+2 −3 contrib/gen_manual/gen_manual.cpp
+2 −3 contrib/meson/meson/meson.build
+30 −19 doc/lz4_Frame_format.md
+83 −46 doc/lz4_manual.html
+7 −5 doc/lz4frame_manual.html
+1 −1 examples/Makefile
+1 −1 lib/Makefile
+27 −10 lib/README.md
+313 −220 lib/lz4.c
+80 −70 lib/lz4.h
+93 −54 lib/lz4frame.c
+22 −14 lib/lz4frame.h
+189 −112 lib/lz4hc.c
+15 −40 lib/lz4hc.h
+12 −8 ossfuzz/Makefile
+2 −2 ossfuzz/compress_frame_fuzzer.c
+2 −2 ossfuzz/fuzz_data_producer.c
+6 −1 ossfuzz/travisoss.sh
+1 −0 programs/.gitignore
+21 −7 programs/Makefile
+19 −9 programs/lz4cli.c
+316 −248 programs/lz4io.c
+9 −9 programs/lz4io.h
+3 −3 programs/platform.h
+55 −17 programs/util.h
+1 −0 tests/.gitignore
+150 −85 tests/Makefile
+1 −9 tests/checkFrame.c
+49 −0 tests/decompress-partial.c
+60 −24 tests/frametest.c
+64 −15 tests/fullbench.c
+243 −60 tests/fuzzer.c
+1 −1 tests/test_install.sh
2 changes: 1 addition & 1 deletion app/libraries/oboe
Submodule oboe updated 440 files
1 change: 1 addition & 0 deletions app/libraries/pugixml
Submodule pugixml added at 08b343
1 change: 0 additions & 1 deletion app/libraries/tinyxml2
Submodule tinyxml2 deleted from 61a4c7
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
<application
android:name=".SkylineApplication"
android:allowBackup="true"
android:extractNativeLibs="true"
android:extractNativeLibs="false"
android:fullBackupContent="@xml/backup_descriptor"
android:icon="@drawable/logo_skyline"
android:isGame="true"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/cpp/emu_jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ extern "C" JNIEXPORT void Java_emu_skyline_EmulationActivity_executeApplication(
close(preferenceFd);

auto appFilesPath{env->GetStringUTFChars(appFilesPathJstring, nullptr)};
auto logger{std::make_shared<skyline::Logger>(std::string(appFilesPath) + "skyline.log", static_cast<skyline::Logger::LogLevel>(std::stoi(settings->GetString("log_level"))))};
//settings->List(logger); // (Uncomment when you want to print out all settings strings)
auto logger{std::make_shared<skyline::Logger>(std::string(appFilesPath) + "skyline.log", static_cast<skyline::Logger::LogLevel>(settings->logLevel))};

auto start{std::chrono::steady_clock::now()};

Expand Down
15 changes: 8 additions & 7 deletions app/src/main/cpp/skyline/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <span>
#include <list>
#include <vector>
#include <span>
#include <fstream>
#include <mutex>
#include <shared_mutex>
Expand Down Expand Up @@ -292,8 +293,8 @@ namespace skyline {
using std::span<T, Extent>::span;
using std::span<T, Extent>::operator=;

typedef typename std::span<T, Extent>::element_type elementType;
typedef typename std::span<T, Extent>::index_type indexType;
typedef typename std::span<T, Extent>::element_type element_type;
typedef typename std::span<T, Extent>::size_type size_type;

constexpr span(const std::span<T, Extent> &spn) : std::span<T, Extent>(spn) {}

Expand Down Expand Up @@ -329,7 +330,7 @@ namespace skyline {
* @param amount The amount of elements that need to be copied (in terms of the supplied span), 0 will try to copy the entirety of the other span
*/
template<typename In, size_t InExtent>
constexpr void copy_from(const span<In, InExtent> spn, indexType amount = 0) {
constexpr void copy_from(const span<In, InExtent> spn, size_type amount = 0) {
auto size{amount ? amount * sizeof(In) : spn.size_bytes()};
if (span::size_bytes() < size)
throw exception("Data being copied is larger than this span");
Expand All @@ -340,7 +341,7 @@ namespace skyline {
* @brief Implicit type conversion for copy_from, this allows passing in std::vector/std::array in directly is automatically passed by reference which is important for any containers
*/
template<typename In>
constexpr void copy_from(const In &in, indexType amount = 0) {
constexpr void copy_from(const In &in, size_type amount = 0) {
copy_from(span<typename std::add_const<typename In::value_type>::type>(in), amount);
}

Expand All @@ -355,11 +356,11 @@ namespace skyline {
return std::span<T, Extent>::template last<Count>();
}

constexpr span<elementType, std::dynamic_extent> first(indexType count) const noexcept {
constexpr span<element_type, std::dynamic_extent> first(size_type count) const noexcept {
return std::span<T, Extent>::first(count);
}

constexpr span<elementType, std::dynamic_extent> last(indexType count) const noexcept {
constexpr span<element_type, std::dynamic_extent> last(size_type count) const noexcept {
return std::span<T, Extent>::last(count);
}

Expand All @@ -368,7 +369,7 @@ namespace skyline {
return std::span<T, Extent>::template subspan<Offset, Count>();
}

constexpr span<T, std::dynamic_extent> subspan(indexType offset, indexType count = std::dynamic_extent) const noexcept {
constexpr span<T, std::dynamic_extent> subspan(size_type offset, size_type count = std::dynamic_extent) const noexcept {
return std::span<T, Extent>::subspan(offset, count);
}
};
Expand Down
Loading

0 comments on commit 80302cf

Please sign in to comment.