Files
nd-wfc/thirdparty/CMakeLists.txt
2025-08-21 13:00:00 +09:00

81 lines
3.3 KiB
CMake

# Third-party dependencies - optional components for future features
# For now, we'll make these optional since the core WFC doesn't need them
# RapidJSON - header-only library (optional)
if(ND_WFC_USE_SYSTEM_LIBS)
find_package(RapidJSON QUIET)
if(RapidJSON_FOUND)
message(STATUS "Found system RapidJSON")
endif()
else()
# Check if rapidjson submodule exists
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/CMakeLists.txt")
set(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "Build RapidJSON examples" FORCE)
set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Build RapidJSON tests" FORCE)
set(RAPIDJSON_BUILD_DOC OFF CACHE BOOL "Build RapidJSON documentation" FORCE)
add_subdirectory(rapidjson)
message(STATUS "Using bundled RapidJSON")
else()
message(STATUS "RapidJSON not found - skipping (optional dependency)")
endif()
endif()
# Assimp - 3D model loading (optional)
if(ND_WFC_USE_SYSTEM_LIBS)
find_package(assimp QUIET)
if(assimp_FOUND)
message(STATUS "Found system Assimp")
endif()
else()
# Check if assimp submodule exists
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/assimp/CMakeLists.txt")
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "Build Assimp tests" FORCE)
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE BOOL "Build Assimp tools" FORCE)
set(ASSIMP_BUILD_SAMPLES OFF CACHE BOOL "Build Assimp samples" FORCE)
set(ASSIMP_BUILD_DOCS OFF CACHE BOOL "Build Assimp documentation" FORCE)
set(ASSIMP_INSTALL OFF CACHE BOOL "Install Assimp" FORCE)
add_subdirectory(assimp)
message(STATUS "Using bundled Assimp")
else()
message(STATUS "Assimp not found - skipping (optional dependency)")
endif()
endif()
# SDL3 - for graphics and windowing (optional)
if(ND_WFC_USE_SYSTEM_LIBS)
find_package(SDL3 QUIET)
if(SDL3_FOUND)
message(STATUS "Found system SDL3")
endif()
else()
# Check if SDL submodule exists
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/SDL/CMakeLists.txt")
set(SDL_SHARED OFF CACHE BOOL "Build SDL as a shared library" FORCE)
set(SDL_STATIC ON CACHE BOOL "Build SDL as a static library" FORCE)
set(SDL_TEST OFF CACHE BOOL "Build SDL tests" FORCE)
add_subdirectory(SDL)
message(STATUS "Using bundled SDL3")
else()
message(STATUS "SDL3 not found - skipping (optional dependency)")
endif()
endif()
# SDL_image - for image loading (temporarily disabled due to SDL3 dependency issue)
# TODO: Re-enable SDL_image once SDL3 dependency resolution is fixed
# if(ND_WFC_USE_SYSTEM_LIBS)
# find_package(SDL3_image REQUIRED)
# else()
# # Use the git submodule
# # SDL_image should automatically find the SDL3 targets we just built
# set(SDL3IMAGE_SHARED OFF CACHE BOOL "Build SDL_image as a shared library" FORCE)
# set(SDL3IMAGE_STATIC ON CACHE BOOL "Build SDL_image as a static library" FORCE)
# set(SDL3IMAGE_TESTS OFF CACHE BOOL "Build SDL_image tests" FORCE)
# set(SDL3IMAGE_SAMPLES OFF CACHE BOOL "Build SDL_image samples" FORCE)
# set(SDL3IMAGE_DEPS_SHARED OFF CACHE BOOL "Build SDL_image dependencies as shared libraries" FORCE)
# set(SDL3IMAGE_VENDORED OFF CACHE BOOL "Use vendored libraries" FORCE)
#
# add_subdirectory(SDL_image)
#
# # SDL_image target should be created by the SDL_image CMakeLists.txt
# endif()