diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e4d150..513ca63 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,14 @@ jobs: - name: Windows os: windows-latest + - name: Android32 + os: ubuntu-latest + target: Android32 + + - name: Android64 + os: ubuntu-latest + target: Android64 + name: Geode OpenHack runs-on: ${{ matrix.config.os }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 974ca4f..de29293 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,13 @@ endif() option(BUILD_STANDALONE "Build the standalone version" ON) option(BUILD_GEODE "Build the Geode version" ON) +# Android build +if (ANDROID) + message(STATUS "Android build detected, disabling standalone build") + set(BUILD_STANDALONE OFF) + set(BUILD_GEODE ON CACHE BOOL "Build the Geode version" FORCE) +endif() + # Get the latest abbreviated commit hash of the working branch execute_process( COMMAND git log -1 --format=%h diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index cdf1230..7b8fbfe 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -11,11 +11,18 @@ add_library( imgui/imgui_draw.cpp imgui/imgui_widgets.cpp imgui/imgui_tables.cpp - imgui/backends/imgui_impl_win32.cpp - imgui/backends/imgui_impl_opengl3.cpp imgui/misc/cpp/imgui_stdlib.cpp ) +if (WIN32) + # Windows specific files + target_sources( + imgui PRIVATE + imgui/backends/imgui_impl_win32.cpp + imgui/backends/imgui_impl_opengl3.cpp + ) +endif() + target_include_directories( imgui PUBLIC imgui @@ -30,7 +37,6 @@ target_link_libraries( # Other libraries add_subdirectory(gd.hpp) add_subdirectory(json) -add_subdirectory(glfw) add_subdirectory(discord-rpc) add_subdirectory(zephyrus) @@ -38,9 +44,17 @@ add_subdirectory(zephyrus) target_link_libraries( external_libs INTERFACE imgui - glfw gd.hpp nlohmann_json::nlohmann_json discord-rpc Zephyrus -) \ No newline at end of file +) + +if (WIN32) + # GLFW + add_subdirectory(glfw) + target_link_libraries( + external_libs INTERFACE + glfw + ) +endif() \ No newline at end of file diff --git a/mod.json b/mod.json index 9c79bef..13def06 100644 --- a/mod.json +++ b/mod.json @@ -1,7 +1,8 @@ { "geode": "2.0.0-beta.24", "gd": { - "win": "2.204" + "win": "2.204", + "android": "2.205" }, "version": "v2.2.2", "id": "prevter.openhack", diff --git a/src/shared/platform/android/android.hpp b/src/shared/platform/android/android.hpp new file mode 100644 index 0000000..9a2fb6e --- /dev/null +++ b/src/shared/platform/android/android.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +namespace openhack::utils { +} \ No newline at end of file diff --git a/src/shared/platform/platform.hpp b/src/shared/platform/platform.hpp index 5e51a1b..e02ca6f 100644 --- a/src/shared/platform/platform.hpp +++ b/src/shared/platform/platform.hpp @@ -2,13 +2,24 @@ #ifdef _WIN32 #define PLATFORM_WINDOWS +#define ON_WINDOWS(...) __VA_ARGS__ +#define ON_MACOS(...) +#define ON_ANDROID(...) #include "win32/win32.hpp" +#elif !defined(OPENHACK_GEODE) +#error "Standalone supports only Windows." #elif defined(__APPLE__) #define PLATFORM_MACOS -#error "MacOS is not supported yet" +#define ON_WINDOWS(...) +#define ON_MACOS(...) __VA_ARGS__ +#define ON_ANDROID(...) #include "macos/macos.hpp" #elif defined(__ANDROID__) #define PLATFORM_ANDROID -#error "Android is not supported yet" +#define ON_WINDOWS(...) +#define ON_MACOS(...) +#define ON_ANDROID(...) __VA_ARGS__ #include "android/android.hpp" -#endif \ No newline at end of file +#else +#error "Unsupported platform." +#endif