|
| 1 | +cmake_minimum_required(VERSION 3.18) |
| 2 | +project(ShulkerPreview LANGUAGES C CXX) |
| 3 | + |
| 4 | +set(CMAKE_CXX_STANDARD 20) |
| 5 | +set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 6 | + |
| 7 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fvisibility=hidden -ffunction-sections -fdata-sections -fexceptions -w") |
| 8 | +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -fvisibility=hidden -ffunction-sections -fdata-sections -w") |
| 9 | +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections,--strip-all -s") |
| 10 | + |
| 11 | +include(FetchContent) |
| 12 | + |
| 13 | +FetchContent_Declare( |
| 14 | + fmt |
| 15 | + GIT_REPOSITORY https://github.com/fmtlib/fmt.git |
| 16 | + GIT_TAG 10.2.1 |
| 17 | +) |
| 18 | +FetchContent_MakeAvailable(fmt) |
| 19 | + |
| 20 | +FetchContent_Declare( |
| 21 | + preloader_android |
| 22 | + GIT_REPOSITORY https://github.com/LiteLDev/preloader-android.git |
| 23 | + GIT_TAG main |
| 24 | +) |
| 25 | +FetchContent_GetProperties(preloader_android) |
| 26 | +if(NOT preloader_android_POPULATED) |
| 27 | + FetchContent_Populate(preloader_android) |
| 28 | + |
| 29 | + file(READ "${preloader_android_SOURCE_DIR}/src/pl/Logger.h" LOGGER_CONTENT) |
| 30 | + string(REPLACE "#include <format>" "#include <fmt/format.h>" LOGGER_CONTENT "${LOGGER_CONTENT}") |
| 31 | + string(REPLACE "std::vformat" "fmt::vformat" LOGGER_CONTENT "${LOGGER_CONTENT}") |
| 32 | + string(REPLACE "std::make_format_args" "fmt::make_format_args" LOGGER_CONTENT "${LOGGER_CONTENT}") |
| 33 | + file(WRITE "${preloader_android_SOURCE_DIR}/src/pl/Logger.h" "${LOGGER_CONTENT}") |
| 34 | + |
| 35 | + add_subdirectory(${preloader_android_SOURCE_DIR} ${preloader_android_BINARY_DIR}) |
| 36 | +endif() |
| 37 | + |
| 38 | +target_link_libraries(preloader PUBLIC fmt::fmt) |
| 39 | + |
| 40 | +FetchContent_Declare( |
| 41 | + glm |
| 42 | + GIT_REPOSITORY https://github.com/g-truc/glm.git |
| 43 | + GIT_TAG 0.9.9.8 |
| 44 | +) |
| 45 | +FetchContent_MakeAvailable(glm) |
| 46 | + |
| 47 | +FetchContent_Declare( |
| 48 | + simpleini |
| 49 | + GIT_REPOSITORY https://github.com/brofield/simpleini.git |
| 50 | + GIT_TAG master |
| 51 | +) |
| 52 | +FetchContent_MakeAvailable(simpleini) |
| 53 | + |
| 54 | +include_directories( |
| 55 | + ${CMAKE_SOURCE_DIR}/src |
| 56 | + ${CMAKE_SOURCE_DIR}/src/ImGui |
| 57 | + ${CMAKE_SOURCE_DIR}/src/ImGui/backends |
| 58 | + ${simpleini_SOURCE_DIR} |
| 59 | +) |
| 60 | + |
| 61 | +file(GLOB_RECURSE GAME_SOURCES |
| 62 | + src/*.cpp |
| 63 | +) |
| 64 | +# Exclude ImGui demo (not needed in release) |
| 65 | +list(FILTER GAME_SOURCES EXCLUDE REGEX ".*imgui_demo\\.cpp$") |
| 66 | + |
| 67 | +add_library(ShulkerPreview SHARED ${GAME_SOURCES}) |
| 68 | +target_include_directories(ShulkerPreview PRIVATE |
| 69 | + ${CMAKE_SOURCE_DIR}/src |
| 70 | + ${CMAKE_SOURCE_DIR}/src/ImGui |
| 71 | + ${CMAKE_SOURCE_DIR}/src/ImGui/backends |
| 72 | + ${simpleini_SOURCE_DIR} |
| 73 | +) |
| 74 | +target_link_libraries(ShulkerPreview |
| 75 | + preloader |
| 76 | + glm::glm |
| 77 | + log |
| 78 | + android |
| 79 | + EGL |
| 80 | + GLESv3 |
| 81 | + GLESv2 |
| 82 | +) |
0 commit comments