From: =?utf-8?q?Sandro_Knau=C3=9F?= Date: Fri, 8 Aug 2025 08:21:35 +0200 Subject: fix arch-all build. --- CMakeLists.txt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bef528..411b9df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,7 @@ option(DRAW_HIGHWAY_TERRAIN "Draw highway debug information." OFF) option(DRAW_ROAD_NETWORK_IDS "Draw road network IDs for debugging." OFF) option(DRAW_TILE_COORDS "Draw tile coordinates." OFF) option(SYSTEM_LIBS "Use system libraries when available." ON) +option(ARCH_ALL_ONLY "Arch all only build" OFF) if(${TARGET_PLATFORM} STREQUAL "vita" AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) if(DEFINED ENV{VITASDK}) @@ -780,14 +781,15 @@ elseif(${TARGET_PLATFORM} STREQUAL "android") set(SDL2_LIBRARY SDL2::SDL2) set(SDL2_MIXER_LIBRARY SDL2::SDL2_mixer) else() - find_package(SDL2 REQUIRED) - find_package(SDL2_mixer REQUIRED) + find_package(SDL2) + find_package(SDL2_mixer) endif() + if(${TARGET_PLATFORM} STREQUAL "android") add_library(${SHORT_NAME} SHARED ${SOURCE_FILES}) -else() - add_executable(${SHORT_NAME} WIN32 ${SOURCE_FILES}) + elseif(NOT ARCH_ALL_ONLY) + add_executable(${SHORT_NAME} WIN32 ${SOURCE_FILES}) endif() if(${TARGET_PLATFORM} STREQUAL "emscripten") @@ -895,10 +897,11 @@ if(SYSTEM_LIBS) find_package(EXPAT) endif() + if(ZLIB_FOUND) include_directories(${ZLIB_INCLUDE_DIRS}) target_link_libraries(${SHORT_NAME} ${ZLIB_LIBRARIES}) -else() +elseif(NOT ARCH_ALL_ONLY) include_directories("ext/zlib") target_sources(${SHORT_NAME} PRIVATE "${ZLIB_FILES}") endif() @@ -906,7 +909,7 @@ endif() if(PNG_FOUND) include_directories(SYSTEM ${PNG_INCLUDE_DIRS}) target_link_libraries(${SHORT_NAME} ${PNG_LIBRARIES}) -else() +elseif(NOT ARCH_ALL_ONLY) if(SYSTEM_LIBS) message(STATUS "PNG was not found but that's ok: falling back to internal version") endif() @@ -917,7 +920,7 @@ endif() if(EXPAT_FOUND) include_directories(${EXPAT_INCLUDE_DIRS}) target_link_libraries(${SHORT_NAME} ${EXPAT_LIBRARIES}) -else() +elseif(NOT ARCH_ALL_ONLY) include_directories("ext/expat") target_sources(${SHORT_NAME} PRIVATE "${EXPAT_FILES}") if(NOT WIN32) @@ -1003,6 +1006,7 @@ nx_create_nro (${PROJECT_NAME} ) else() + if (NOT ARCH_ALL_ONLY) if (UNIX AND NOT APPLE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")) target_link_libraries(${SHORT_NAME} m) endif() @@ -1016,6 +1020,7 @@ else() if(NOT APPLE AND NOT ${TARGET_PLATFORM} STREQUAL "android") install(TARGETS ${SHORT_NAME} RUNTIME DESTINATION bin) endif() + endif() if(WIN32) target_link_libraries(${SHORT_NAME} dbghelp shlwapi)