Add Android and iOS CI (not tested).

This commit is contained in:
Martín Lucas Golini
2025-12-31 14:45:27 -03:00
parent c08687c9fe
commit 2ce608ff09
7 changed files with 79 additions and 13 deletions

View File

@@ -0,0 +1,35 @@
name: Android
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- uses: android-actions/setup-android@v3
- name: Accept licenses
run: yes | sdkmanager --licenses > /dev/null
- name: Install SDK + NDK components
run: |
sdkmanager "platform-tools" \
"platforms;android-34" \
"build-tools;34.0.0" \
"ndk;28.1.13356709"
- name: Configure local properties
run: |
cd make/android-project
{
echo "sdk.dir=$ANDROID_SDK_ROOT"
echo "ndk.dir=$ANDROID_SDK_ROOT/ndk/28.1.13356709"
} > local.properties
- name: Build
run: |
cd make/android-project
./gradlew assembleEcodeRelease -Pandroid.injected.ndk.abiFilters=arm64-v8a

View File

@@ -0,0 +1,18 @@
name: iOS
on: [push, pull_request]
jobs:
MacOS:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
brew install cmake premake
- name: Build
run: |
cd project/ios
sh ./compile-all.sh

5
.gitignore vendored
View File

@@ -75,3 +75,8 @@ ecode.dmg
/projects/linux/ecode/polyfill-glibc
/bin/crashes/*
/bin/config/*
/projects/android-project/.settings/*
/projects/android-project/app/.settings/*
/projects/android-project/app/.classpath
/projects/android-project/.project
/projects/android-project/app/.project

View File

@@ -575,8 +575,8 @@ click in the plus icon (+), then go to _Add Other..._ and locate and select the
This script can be used to build the SDL2 and eepp as two fat static libraries
with arm64 and x86_64 architectures in it (arm64 for iPhone/iPad and x86_64 for
the simulators). To generate a release build pass `config=release` as a parameter
for the script (`sh compile-all.sh config=release`). The built files will be
the simulators). To generate a release build pass `config=release_arm64` as a parameter
for the script (`sh compile-all.sh config=release_arm64`). The built files will be
located in `libs/ios/`, as `libSDL2.a` and `libeepp.a` (or `libeepp-debug.a` for
debug build). This two files can be integrated in your project.

View File

@@ -121,7 +121,7 @@ public class HIDDeviceManager {
// If our context is an activity, exit rather than crashing when we can't
// call our native functions.
Activity activity = (Activity)context;
activity.finish();
}
catch (ClassCastException cce) {
@@ -133,7 +133,7 @@ public class HIDDeviceManager {
return;
}
HIDDeviceRegisterCallback();
mSharedPreferences = mContext.getSharedPreferences("hidapi", Context.MODE_PRIVATE);
@@ -199,7 +199,7 @@ public class HIDDeviceManager {
Log.i(TAG," Interface protocol: " + mUsbInterface.getInterfaceProtocol());
Log.i(TAG," Endpoint count: " + mUsbInterface.getEndpointCount());
// Get endpoint details
// Get endpoint details
for (int epi = 0; epi < mUsbInterface.getEndpointCount(); epi++)
{
UsbEndpoint mEndpoint = mUsbInterface.getEndpoint(epi);
@@ -533,7 +533,7 @@ public class HIDDeviceManager {
for (HIDDevice device : mDevicesById.values()) {
device.setFrozen(frozen);
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -568,7 +568,11 @@ public class HIDDeviceManager {
if (usbDevice != null && !mUsbManager.hasPermission(usbDevice)) {
HIDDeviceOpenPending(deviceID);
try {
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), 0));
int flags = 0;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { // Android 12+
flags |= PendingIntent.FLAG_MUTABLE;
}
mUsbManager.requestPermission(usbDevice, PendingIntent.getBroadcast(mContext, 0, new Intent(HIDDeviceManager.ACTION_USB_PERMISSION), flags));
} catch (Exception e) {
Log.v(TAG, "Couldn't request permission for USB device " + usbDevice);
HIDDeviceOpenResult(deviceID, false);

View File

@@ -50,11 +50,15 @@ std::string ClipboardSDL::getText() {
}
bool ClipboardSDL::hasPrimarySelection() const {
#if SDL_VERSION_ATLEAST( 2, 26, 0 )
return SDL_HasPrimarySelectionText();
#else
return false;
#endif
}
std::string ClipboardSDL::getPrimarySelectionText() {
#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN && SDL_VERSION_ATLEAST( 2, 26, 0 )
#if SDL_VERSION_ATLEAST( 2, 26, 0 )
if ( SDL_HasPrimarySelectionText() ) {
char* text = SDL_GetPrimarySelectionText();
std::string str( text );
@@ -67,7 +71,7 @@ std::string ClipboardSDL::getPrimarySelectionText() {
}
void ClipboardSDL::setPrimarySelectionText( const std::string& text ) {
#if EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN && SDL_VERSION_ATLEAST( 2, 26, 0 )
#if SDL_VERSION_ATLEAST( 2, 26, 0 )
if ( SDL_HasPrimarySelectionText() ) {
SDL_SetPrimarySelectionText( text.c_str() );
}

View File

@@ -4145,22 +4145,22 @@ inline namespace literals {
inline namespace string_view_literals {
constexpr std::string_view operator "" _sv( const char* str, size_t len ) noexcept // (1)
constexpr std::string_view operator""_sv( const char* str, size_t len ) noexcept // (1)
{
return std::string_view{ str, len };
}
constexpr std::u16string_view operator "" _sv( const char16_t* str, size_t len ) noexcept // (2)
constexpr std::u16string_view operator""_sv( const char16_t* str, size_t len ) noexcept // (2)
{
return std::u16string_view{ str, len };
}
constexpr std::u32string_view operator "" _sv( const char32_t* str, size_t len ) noexcept // (3)
constexpr std::u32string_view operator""_sv( const char32_t* str, size_t len ) noexcept // (3)
{
return std::u32string_view{ str, len };
}
constexpr std::wstring_view operator "" _sv( const wchar_t* str, size_t len ) noexcept // (4)
constexpr std::wstring_view operator""_sv( const wchar_t* str, size_t len ) noexcept // (4)
{
return std::wstring_view{ str, len };
}