Files
nd-wfc/thirdparty/CMakeLists.txt
cdemeyer-teachx 2996ffedfc initial commit
2025-08-21 12:17:21 +09:00

73 lines
3.1 KiB
CMake

# RapidJSON - header-only library
if(ND_WFC_USE_SYSTEM_LIBS)
find_package(RapidJSON REQUIRED)
else()
# Use the git submodule
# Disable examples and tests to avoid compilation issues with newer GCC
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)
# Create a target for RapidJSON if not already created
if(NOT TARGET rapidjson)
add_library(rapidjson INTERFACE)
target_include_directories(rapidjson
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include
)
endif()
endif()
# Assimp - 3D model loading
if(ND_WFC_USE_SYSTEM_LIBS)
find_package(assimp REQUIRED)
else()
# Use the git submodule
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)
# Assimp target should be created by the assimp CMakeLists.txt
endif()
# SDL3 - for graphics and windowing
if(ND_WFC_USE_SYSTEM_LIBS)
find_package(SDL3 REQUIRED)
else()
# Use the git submodule
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)
set(SDL_VIDEO OFF CACHE BOOL "Enable video subsystem" FORCE) # Disable video for headless builds
set(SDL_GPU OFF CACHE BOOL "Enable GPU subsystem" FORCE)
set(SDL_RENDER OFF CACHE BOOL "Enable render subsystem" FORCE)
set(SDL_CAMERA OFF CACHE BOOL "Enable camera subsystem" FORCE)
set(SDL_UNIX_CONSOLE_BUILD ON CACHE BOOL "Build SDL for console (headless) applications" FORCE)
add_subdirectory(SDL)
# SDL3 target should be created by the SDL CMakeLists.txt
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()