Skip to content

Commit

Permalink
head
Browse files Browse the repository at this point in the history
  • Loading branch information
bubio committed May 6, 2023
1 parent c30e17f commit 600749a
Show file tree
Hide file tree
Showing 173 changed files with 58,196 additions and 11 deletions.
24 changes: 16 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
.DS_Store

macOS/Brewfile.lock.json
Builder/macOS/Brewfile.lock.json

Linux/*.deb
Linux/xm8_linux_x86_64.appimage
Builder/Linux/xm8_linux_x86_64.appimage
linuxdeploy-x86_64.AppImage

Windows/.vs
Windows/Debug
Windows/Release
Windows/SDL
Windows/x64
Builder/Windows/.vs
Builder/Windows/Debug
Builder/Windows/Release
Builder/Windows/SDL/include
Builder/Windows/SDL/lib
Builder/Windows/x64
Builder/Windows/x86
Builder/Windows/XM8.vcxproj.user

build/
Builder/Android/app/jni/SDL/include
Builder/Android/app/jni/SDL/src
Builder/Android/app/jni/src/ePC-8801MA
Builder/Android/app/jni/src/UI
Builder/Android/app/CMakeCache.txt
Builder/Android/app/release
4 changes: 2 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/Cellar/sdl2/2.26.4/include/SDL2/**"
"${workspaceFolder}/Source/**"
// "/usr/local/Cellar/sdl2/2.26.4/include/SDL2/**"
],
"defines": [
"SDL",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "(lldb) Launch macOS",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/XM8.app/Contents/MacOS/XM8",
"program": "${workspaceFolder}/build/XM8.app/Contents/MacOS/xm8",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
Expand Down
14 changes: 14 additions & 0 deletions Builder/Android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Intellij
.idea/

# Gradle files
/.gradle/
build/

# Android
/app/.cxx/

# Local configuration file (sdk path, etc)
/local.properties

/app/src/main/assets/*
134 changes: 134 additions & 0 deletions Builder/Android/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.4.1)

# Get version from environment variable
#set(PROJECT_VERSION 1.7.2)

# Project Name
#project(XM8 VERSION ${PROJECT_VERSION})

set(SDL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/jni/SDL)
set(JNI_PATH ${CMAKE_CURRENT_SOURCE_DIR}/jni/src)
set(XM8_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source)

# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.

# SDL source files
file(GLOB SDL_SOURCE_FILES
${SDL_PATH}/src/*.c
${SDL_PATH}/src/audio/*.c
${SDL_PATH}/src/audio/android/*.c
${SDL_PATH}/src/audio/dummy/*.c
${SDL_PATH}/src/audio/aaudio/*.c
${SDL_PATH}/src/audio/openslES/*.c
${SDL_PATH}/src/atomic/*.c
# ${SDL_PATH}/src/atomic/SDL_atomic.c.arm
# ${SDL_PATH}/src/atomic/SDL_spinlock.c.arm
${SDL_PATH}/src/core/android/*.c
${SDL_PATH}/src/cpuinfo/*.c
${SDL_PATH}/src/dynapi/*.c
${SDL_PATH}/src/events/*.c
${SDL_PATH}/src/file/*.c
${SDL_PATH}/src/haptic/*.c
${SDL_PATH}/src/haptic/android/*.c
${SDL_PATH}/src/hidapi/*.c
${SDL_PATH}/src/hidapi/android/*.cpp
${SDL_PATH}/src/joystick/*.c
${SDL_PATH}/src/joystick/android/*.c
${SDL_PATH}/src/joystick/hidapi/*.c
${SDL_PATH}/src/joystick/virtual/*.c
${SDL_PATH}/src/loadso/dlopen/*.c
${SDL_PATH}/src/locale/*.c
${SDL_PATH}/src/locale/android/*.c
${SDL_PATH}/src/misc/*.c
${SDL_PATH}/src/misc/android/*.c
${SDL_PATH}/src/power/*.c
${SDL_PATH}/src/power/android/*.c
${SDL_PATH}/src/filesystem/android/*.c
${SDL_PATH}/src/sensor/*.c
${SDL_PATH}/src/sensor/android/*.c
${SDL_PATH}/src/render/*.c
${SDL_PATH}/src/render/*/*.c
${SDL_PATH}/src/stdlib/*.c
${SDL_PATH}/src/thread/*.c
${SDL_PATH}/src/thread/pthread/*.c
${SDL_PATH}/src/timer/*.c
${SDL_PATH}/src/timer/unix/*.c
${SDL_PATH}/src/video/*.c
${SDL_PATH}/src/video/android/*.c
${SDL_PATH}/src/video/yuv2rgb/*.c
${SDL_PATH}/src/test/*.c
${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c
)

include(AndroidNdkModules)
android_ndk_import_module_cpufeatures()

# add library for SDL
add_library(SDL2 SHARED ${SDL_SOURCE_FILES})

# include directories for SDL
target_include_directories(SDL2 PRIVATE
${SDL_PATH}/include
)

# definitions(-D option) for SDL
target_compile_definitions(SDL2 PRIVATE GL_GLEXT_PROTOTYPES)
target_compile_options(SDL2 PRIVATE
-Wall -Wextra
-Wdocumentation
-Wdocumentation-unknown-command
-Wmissing-prototypes
-Wunreachable-code-break
-Wunneeded-internal-declaration
-Wmissing-variable-declarations
-Wfloat-conversion
-Wshorten-64-to-32
-Wunreachable-code-return
-Wshift-sign-overflow
-Wstrict-prototypes
-Wkeyword-macro
-Wno-unused-parameter
-Wno-sign-compare
)

# link libraries for SDL
find_library(dl-lib dl)
find_library(GLESv1-lib GLESv1_CM)
find_library(GLESv2-lib GLESv2)
find_library(OpenSLES-lib OpenSLES)
find_library(log-lib log)
find_library(android-lib android)
target_link_libraries(SDL2 ${dl-lib} ${GLESv1-lib} ${GLESv2-lib} ${OpenSLES-lib} ${log-lib} ${android-lib})

# main source files
file(GLOB MAIN_SOURCE_FILES
${XM8_PATH}/ePC-8801MA/*.cpp
${XM8_PATH}/ePC-8801MA/vm/*.cpp
${XM8_PATH}/ePC-8801MA/vm/fmgen/*.cpp
${XM8_PATH}/ePC-8801MA/vm/pc8801/*.cpp
${XM8_PATH}/UI/*.cpp
${JNI_PATH}/*.c)

# add library for main
add_library(main SHARED ${MAIN_SOURCE_FILES})

# include directories for main
target_include_directories(main PRIVATE
${JNI_PATH}
${SDL_PATH}/include
${XM8_PATH}/UI
${XM8_PATH}/ePC-8801MA
${XM8_PATH}/ePC-8801MA/vm
${XM8_PATH}/ePC-8801MA/vm/fmgen
${XM8_PATH}/ePC-8801MA/vm/pc8801)

# definitions(-D option) for main
target_compile_definitions(main PRIVATE SDL _PC8801MA)
target_compile_options(main PRIVATE -Wno-narrowing)

# link libraries for main
target_link_libraries(main SDL2)
81 changes: 81 additions & 0 deletions Builder/Android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
def buildAsApplication = !buildAsLibrary
if (buildAsApplication) {
apply plugin: 'com.android.application'
}
else {
apply plugin: 'com.android.library'
}

android {
buildToolsVersion "33.0.2"
// ndkVersion '25.2.9519653'
// ndkVersion '24.0.8215888'
ndkVersion '23.2.8568313'
compileSdkVersion 33
defaultConfig {
if (buildAsApplication) {
applicationId "net.retropc.pi"
}
minSdkVersion 16
targetSdkVersion 33
versionCode 2
versionName "1.73"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-16"
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
}
// cmake {
// arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
// // abiFilters 'arm64-v8a'
// cppFlags "-fexceptions"
// }
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
namespace 'net.retropc.pi'
lint {
abortOnError false
}

if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
sourceSets.main {
jniLibs.srcDir 'libs'
}
externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
// cmake {
// path "CMakeLists.txt"
// }
}
}


if (buildAsLibrary) {
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith(".aar")) {
def fileName = "net.retropc.pi.aar";
output.outputFile = new File(outputFile.parent, fileName);
}
}
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "androidx.documentfile:documentfile:1.0.1"
}
1 change: 1 addition & 0 deletions Builder/Android/app/jni/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(call all-subdir-makefiles)
10 changes: 10 additions & 0 deletions Builder/Android/app/jni/Application.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# Uncomment this if you're using STL in your project
# You can find more information here:
# https://developer.android.com/ndk/guides/cpp-support
# APP_STL := c++_shared

APP_ABI := armeabi-v7a arm64-v8a x86 x86_64

# Min runtime API level
APP_PLATFORM=android-16
Loading

0 comments on commit 600749a

Please sign in to comment.