Skip to content

Commit f8343e9

Browse files
committed
Add Gradle build. This time, we don't remove the old build system and we don't switch Travis.
1 parent f5c3b15 commit f8343e9

19 files changed

+429
-50
lines changed

.gitignore

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,18 @@ PPSSPPControls.dat
4747
# Qt Linguist files
4848
*.qm
4949

50-
#Android stuff
50+
# Gradle/Android Studio
51+
.gradle
5152
.idea
52-
android/.idea
53+
*.iml
54+
build
55+
build.ios
5356

5457
Logs
5558
Memstick
5659
memstick
5760
Cheats
5861

59-
bin
60-
gen
61-
libs
62-
obj
63-
build*/
6462
/git-version.cpp
6563

6664
.pspsh.hist

.travis.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ travis_script() {
119119
pushd android
120120
./ab.sh -j2 APP_ABI=$APP_ABI
121121
popd
122+
123+
# When we can get this to work...
124+
# chmod +x gradlew
125+
# ./gradlew assembleRelease
122126
fi
123127
if [ "$PPSSPP_BUILD_TYPE" = "iOS" ]; then
124128
./b.sh --ios

CMakeLists.txt

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ project(PPSSPP)
99
enable_language(ASM)
1010
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
1111

12-
add_definitions(-DPPSSPP)
1312
add_definitions(-D__STDC_CONSTANT_MACROS)
1413

1514
# Of the CMake platforms, we only support Vulkan on Android and Windows.
@@ -50,8 +49,10 @@ include(ccache)
5049
# Remove soon?
5150
set(USE_FFMPEG ON)
5251

53-
if(ARM OR SIMULATOR)
54-
set(USING_EGL ON)
52+
if(NOT ANDROID)
53+
if(ARM OR SIMULATOR)
54+
set(USING_EGL ON)
55+
endif()
5556
endif()
5657

5758
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@@ -168,21 +169,23 @@ if(X86_64)
168169
message("Generating for x86_64, ${CMAKE_BUILD_TYPE}")
169170
endif()
170171
if(ARM64)
171-
message("Generating for ARMv8, ${CMAKE_BUILD_TYPE}")
172+
message("Generating for ARMv8, ${CMAKE_BUILD_TYPE}")
172173
endif()
173-
174+
message("hello")
174175
if(NOT MSVC)
175-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
176-
if (NOT ANDROID)
177-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -D_DEBUG")
178-
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -D_NDEBUG")
179-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -D_NDEBUG")
180-
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -D_NDEBUG")
181-
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -D_DEBUG")
182-
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os -D_NDEBUG")
183-
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -D_NDEBUG")
184-
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O2 -g -D_NDEBUG")
185-
endif()
176+
if (NOT ANDROID)
177+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
178+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -D_DEBUG")
179+
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -D_NDEBUG")
180+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -D_NDEBUG")
181+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g -D_NDEBUG")
182+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -D_DEBUG")
183+
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -Os -D_NDEBUG")
184+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -D_NDEBUG")
185+
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O2 -g -D_NDEBUG")
186+
else()
187+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wno-switch -Wno-uninitialized")
188+
endif()
186189
#TODO: Remove this and include the file properly everywhere it makes sense
187190
# First step is too use the macros everywhere
188191
# Second step is to remove the compatibility defines
@@ -192,6 +195,7 @@ if(NOT MSVC)
192195

193196
# Disable some warnings
194197
add_definitions(-Wno-multichar)
198+
add_definitions(-Wno-deprecated-register)
195199

196200
# Don't compile with strict aliasing, we're not 100% aliasing-safe
197201
add_definitions(-fno-strict-aliasing)
@@ -206,17 +210,19 @@ if(NOT MSVC)
206210

207211
if(IOS)
208212
elseif(APPLE AND NOT CMAKE_CROSSCOMPILING)
209-
# We want C++11, so target 10.7+
210-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.7")
213+
# We want C++11, so target 10.7+
214+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.7")
211215
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -stdlib=libc++ -U__STRICT_ANSI__")
212216
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
213-
else()
217+
elseif(NOT ANDROID)
214218
if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
215219
add_definitions(-Wno-psabi)
216220
endif()
217221
add_definitions(-D_XOPEN_SOURCE=700)
218222
add_definitions(-D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1)
219223
add_definitions(-D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64)
224+
elseif(ANDROID)
225+
add_definitions(-fsigned-char)
220226
endif()
221227
else()
222228
# Disable warnings about MS-specific _s variants of libc functions
@@ -228,8 +234,10 @@ else()
228234
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_NDEBUG")
229235
endif()
230236

237+
if(NOT ANDROID)
231238
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
232239
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
240+
endif()
233241

234242
# This sets up the MSVC project dirs according to the physical project dirs
235243
macro(setup_target_project TargetName ProjectDir)
@@ -287,7 +295,7 @@ if(NOT (X86 OR ARM OR MIPS))
287295
set(CommonFake
288296
Common/FakeCPUDetect.cpp
289297
Common/FakeEmitter.h)
290-
source_group(Fake FILES ${CommonFake})
298+
source_group(Fake FILES ${CommonFake})
291299
endif()
292300

293301
set(CommonWindows
@@ -395,12 +403,12 @@ if(USE_FFMPEG)
395403
if(ANDROID)
396404
if(ARMV7)
397405
set(PLATFORM_ARCH "android/armv7")
398-
elseif(ARM)
399-
set(PLATFORM_ARCH "android/arm")
406+
elseif(ARM64)
407+
set(PLATFORM_ARCH "android/arm64")
408+
elseif(X86_64)
409+
set(PLATFORM_ARCH "android/x86_64")
400410
elseif(X86)
401411
set(PLATFORM_ARCH "android/x86")
402-
else()
403-
set(PLATFORM_ARCH "android/x86_64")
404412
endif()
405413
elseif(IOS)
406414
set(PLATFORM_ARCH "ios/universal")
@@ -417,7 +425,7 @@ if(USE_FFMPEG)
417425
set(PLATFORM_ARCH "linux/mips32")
418426
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
419427
set(PLATFORM_ARCH "linux/x86_64")
420-
else()
428+
elseif(X86)
421429
set(PLATFORM_ARCH "linux/x86")
422430
endif()
423431
elseif(WIN32)
@@ -439,7 +447,7 @@ if(USE_FFMPEG)
439447
endif(USE_FFMPEG)
440448

441449
find_package(ZLIB)
442-
if(ZLIB_FOUND)
450+
if(ZLIB_FOUND AND NOT ANDROID)
443451
include_directories(${ZLIB_INCLUDE_DIR})
444452
add_definitions(-DSHARED_ZLIB)
445453
else()
@@ -1569,6 +1577,8 @@ if(ANDROID)
15691577
set(CoreExtraLibs -Wl,--gc-sections -Wl,--exclude-libs,ALL)
15701578
endif()
15711579
endif()
1580+
1581+
set(CoreExtraLibs ${CoreExtraLibs} armips)
15721582

15731583
set(GlslangLibs glslang OGLCompiler OSDependent SPIRV SPVRemapper)
15741584

@@ -1773,9 +1783,10 @@ if (TargetBin)
17731783
endif()
17741784

17751785
# installs
1786+
if(NOT ANDROID)
17761787
file(INSTALL ${NativeAssets} DESTINATION assets)
17771788
file(INSTALL flash0 DESTINATION assets)
1778-
1789+
endif()
17791790
# packaging and code signing
17801791
if(IOS)
17811792
file(GLOB IOSAssets ios/assets/*.png)

Common/MipsCPUDetect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void CPUInfo::Detect()
158158
{
159159
// Set some defaults here
160160
HTT = false;
161-
#ifdef PPSSPP_ARCH(MIPS64)
161+
#if PPSSPP_ARCH(MIPS64)
162162
OS64bit = true;
163163
CPU64bit = true;
164164
Mode64bit = true;

Core/MIPS/MIPSAsm.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
#include "Common/CommonTypes.h"
99

1010
#if defined(_WIN32) || defined(__ANDROID__)
11+
// Temporarily turned off on Android
12+
#define USE_ARMIPS
13+
#endif
14+
15+
16+
#ifdef USE_ARMIPS
1117
// This has to be before basictypes to avoid a define conflict.
1218
#include "ext/armips/Core/Assembler.h"
1319
#endif
@@ -27,7 +33,7 @@ std::wstring GetAssembleError()
2733
return errorText;
2834
}
2935

30-
#if defined(_WIN32) || defined(__ANDROID__)
36+
#ifdef USE_ARMIPS
3137
class PspAssemblerFile: public AssemblerFile
3238
{
3339
public:
@@ -38,8 +44,7 @@ class PspAssemblerFile: public AssemblerFile
3844
bool open(bool onlyCheck) override{ return true; };
3945
void close() override { };
4046
bool isOpen() override { return true; };
41-
bool write(void* data, size_t length) override
42-
{
47+
bool write(void* data, size_t length) override {
4348
if (!Memory::IsValidAddress((u32)(address+length-1)))
4449
return false;
4550

@@ -55,8 +60,7 @@ class PspAssemblerFile: public AssemblerFile
5560
int64_t getVirtualAddress() override { return address; };
5661
int64_t getPhysicalAddress() override { return getVirtualAddress(); };
5762
int64_t getHeaderSize() override { return 0; }
58-
bool seekVirtual(int64_t virtualAddress) override
59-
{
63+
bool seekVirtual(int64_t virtualAddress) override {
6064
if (!Memory::IsValidAddress(virtualAddress))
6165
return false;
6266
address = virtualAddress;
@@ -72,7 +76,7 @@ class PspAssemblerFile: public AssemblerFile
7276

7377
bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address)
7478
{
75-
#if defined(_WIN32) || defined(__ANDROID__)
79+
#ifdef USE_ARMIPS
7680
PspAssemblerFile file;
7781
StringList errors;
7882

@@ -108,4 +112,4 @@ bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address)
108112
#endif
109113
}
110114

111-
}
115+
} // namespace

android/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
bin
12
gen
3+
libs
24
obj
5+
build*/
6+
gen
7+
obj
8+
.externalNativeBuild
39
android.iml
410
#ui_atlas.zim
511
ui_atlas.zim.png

android/build.gradle

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
signingConfigs {
5+
config {
6+
}
7+
}
8+
compileSdkVersion 25
9+
buildToolsVersion '25.0.0'
10+
defaultConfig {
11+
applicationId 'org.ppsspp.ppsspp'
12+
minSdkVersion 9
13+
targetSdkVersion 25
14+
ndk {
15+
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
16+
}
17+
signingConfig signingConfigs.config
18+
}
19+
buildTypes {
20+
release {
21+
minifyEnabled = false
22+
signingConfig signingConfigs.config
23+
}
24+
debug {
25+
minifyEnabled = false
26+
jniDebuggable true
27+
}
28+
}
29+
externalNativeBuild {
30+
cmake {
31+
path '../CMakeLists.txt'
32+
}
33+
}
34+
sourceSets {
35+
main {
36+
manifest.srcFile 'AndroidManifest.xml'
37+
res.srcDirs = ['res']
38+
java.srcDirs = ['src']
39+
aidl.srcDirs = ['src']
40+
resources.srcDirs = ['src']
41+
assets.srcDirs = [
42+
'assets',
43+
]
44+
jni.srcDirs = ['..']
45+
}
46+
47+
}
48+
productFlavors {
49+
normal {
50+
applicationId 'org.ppsspp.ppsspp'
51+
signingConfig signingConfigs.config
52+
externalNativeBuild {
53+
cmake {
54+
// Available arguments listed at https://developer.android.com/ndk/guides/cmake.html
55+
arguments '-DANDROID=true',
56+
'-DANDROID_PLATFORM=android-15',
57+
'-DANDROID_TOOLCHAIN=clang',
58+
'-DANDROID_CPP_FEATURES=',
59+
'-DANDROID_STL=gnustl_static',
60+
'-DANDROID_ARM_NEON=TRUE'
61+
}
62+
}
63+
}
64+
gold {
65+
applicationId 'org.ppsspp.ppssppgold'
66+
signingConfig signingConfigs.config
67+
externalNativeBuild {
68+
cmake {
69+
// Available arguments listed at https://developer.android.com/ndk/guides/cmake.html
70+
arguments '-DANDROID=true',
71+
'-DANDROID_PLATFORM=android-15',
72+
'-DANDROID_TOOLCHAIN=clang',
73+
'-DANDROID_CPP_FEATURES=',
74+
'-DANDROID_STL=gnustl_static',
75+
'-DANDROID_ARM_NEON=TRUE',
76+
'-DGOLD=TRUE'
77+
}
78+
}
79+
}
80+
}
81+
}
82+
afterEvaluate {
83+
android.sourceSets.main.assets.getSrcDirs().each { println it }
84+
}
85+
dependencies {
86+
compile project(':com.bda.controller')
87+
}

android/project.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# "ant.properties", and override values to adapt the script to your
88
# project structure.
99
#
10-
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11-
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
1210

1311
# Project target.
1412
target=android-25

build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
buildscript {
3+
repositories {
4+
jcenter()
5+
}
6+
dependencies {
7+
classpath 'com.android.tools.build:gradle:2.3.0'
8+
}
9+
}
10+
11+
allprojects {
12+
repositories {
13+
jcenter()
14+
}
15+
}

com.bda.controller/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
configurations.maybeCreate("default")
2+
artifacts.add("default", file('com.bda.controller.jar'))

0 commit comments

Comments
 (0)