* Android: Determine feature availability at compile time.

Since assets are baked in to the APK, we can simply check for the existence of assets at compile time using CMake.
This commit is contained in:
iProgramInCpp
2023-11-05 21:30:33 +02:00
parent eae06f0500
commit 3b60855ad0
3 changed files with 45 additions and 1 deletions

View File

@@ -33,6 +33,23 @@ add_library( # Sets the name of the library.
${MC_ROOT}/platforms/android/main.cpp
${MC_ROOT}/thirdparty/stb_image_impl.c)
# Check for the presence of some optional asset based features.
if(NOT EXISTS "${MC_ROOT}/game/assets/gui/background/panorama_0.png")
target_compile_definitions(reminecraftpe PUBLIC FEATURE_MENU_BACKGROUND)
endif()
if(NOT EXISTS "${MC_ROOT}/game/assets/environment/clouds.png")
target_compile_definitions(reminecraftpe PUBLIC FEATURE_CLOUDS)
endif()
if(NOT EXISTS "${MC_ROOT}/game/assets/misc/grasscolor.png")
target_compile_definitions(reminecraftpe PUBLIC FEATURE_GRASS_COLOR)
endif()
if(NOT EXISTS "${MC_ROOT}/game/assets/misc/foliagecolor.png")
target_compile_definitions(reminecraftpe PUBLIC FEATURE_FOLIAGE_COLOR)
endif()
# Add the core as part of the library.
add_subdirectory(${MC_ROOT}/source source)
target_link_libraries(reminecraftpe reminecraftpe-core)