File 0001-Use-system-rapidjson.patch of Package opentimelineio

From 2bd90edfb4730780b71fcacae9e492ff15a16268 Mon Sep 17 00:00:00 2001
From: Christophe Marin <christophe@krop.fr>
Date: Fri, 7 Mar 2025 10:42:48 +0100
Subject: [PATCH 1/2] Use system rapidjson

---
 CMakeLists.txt                    | 56 +++----------------------------
 src/opentimelineio/CMakeLists.txt |  5 ++-
 2 files changed, 7 insertions(+), 54 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 825ad9d..0a4d0ce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,7 @@ project(OpenTimelineIO VERSION ${OTIO_VERSION} LANGUAGES C CXX)
 # Installation options
 option(OTIO_CXX_INSTALL               "Install the C++ bindings" ON)
 option(OTIO_PYTHON_INSTALL            "Install the Python bindings" OFF)
-option(OTIO_DEPENDENCIES_INSTALL      "Install OTIO's C++ header dependencies (any and nonstd)" ON)
+option(OTIO_DEPENDENCIES_INSTALL      "Install OTIO's C++ header dependencies (any and nonstd)" OFF)
 option(OTIO_INSTALL_PYTHON_MODULES    "Install OTIO pure Python modules/files" ON)
 option(OTIO_INSTALL_COMMANDLINE_TOOLS "Install the OTIO command line tools" ON)
 option(OTIO_INSTALL_CONTRIB           "Install the opentimelineio_contrib Python package" ON)
@@ -149,63 +149,16 @@ endif()
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)
 
-if(OTIO_CXX_COVERAGE AND NOT MSVC)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
-    # this causes cmake to produce file.gcno instead of file.cpp.gcno
-    set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
-    message(STATUS "Building C++ with Coverage: ON")
-else()
-    message(STATUS "Building C++ with Coverage: OFF")
-endif()
 
-if(WIN32)
-    # Windows debug builds for Python require a d in order for the module to
-    # load. This also helps ensure that debug builds in general are matched
-    # to the Microsoft debug CRT.
-    set(OTIO_DEBUG_POSTFIX "d")
-endif()
+
+
 
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
 #------------------------------------------------------------------------------
 # Fetch or refresh submodules if requested
 #
-if (OTIO_AUTOMATIC_SUBMODULES)
-    # make sure that git submodules are up to date when building
-    find_package(Git QUIET)
-    if (GIT_FOUND)
-        message(STATUS "Checking git repo is available:")
-        execute_process(
-            # the following command returns true if cwd is in the repo
-            COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree
-            WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
-            RESULT_VARIABLE IN_A_GIT_REPO_RETCODE
-        )
-    endif()
 
-    if (GIT_FOUND AND IN_A_GIT_REPO_RETCODE EQUAL 0)
-        # you might want to turn this off if you're working in one of the submodules
-        # or trying it out with a different version of the submodule
-        option(GIT_UPDATE_SUBMODULES "Update submodules each build" ON)
-        if (GIT_UPDATE_SUBMODULES)
-            message(
-                STATUS "root: Updating git submodules to make sure they are up to date"
-            )
-            execute_process(
-                COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
-                WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
-                RESULT_VARIABLE GIT_UPDATE_SUBMODULES_RESULT
-            )
-            if (NOT GIT_UPDATE_SUBMODULES_RESULT EQUAL "0")
-                message(
-                    FATAL_ERROR
-                    "git submodule update --init --recursive failed with \
-                    ${GIT_UPDATE_SUBMODULES_RESULT}"
-                )
-            endif()
-        endif()
-    endif()
-endif()
 
 #------------------------------------------------------------------------------
 # Setup tests
@@ -245,7 +198,8 @@ else()
 endif()
 
 # set up the internally hosted dependencies
-add_subdirectory(src/deps)
+# add_subdirectory(src/deps)
+find_package(RapidJSON CONFIG REQUIRED)
 
 set (OTIO_IMATH_TARGETS
     # For OpenEXR/Imath 3.x:
diff --git a/src/opentimelineio/CMakeLists.txt b/src/opentimelineio/CMakeLists.txt
index 4b08e6d..e98828b 100644
--- a/src/opentimelineio/CMakeLists.txt
+++ b/src/opentimelineio/CMakeLists.txt
@@ -80,9 +80,8 @@ add_library(OTIO::opentimelineio ALIAS opentimelineio)
 target_include_directories(opentimelineio
     PRIVATE       "${IMATH_INCLUDES}"
                   "${PROJECT_SOURCE_DIR}/src"
-                  "${PROJECT_SOURCE_DIR}/src/deps"
-                  "${PROJECT_SOURCE_DIR}/src/deps/rapidjson/include"
-                  "${IMATH_INCLUDES}")
+                  "${IMATH_INCLUDES}"
+                  ${RapidJSON_INCLUDE_DIRS})
 
 target_link_libraries(opentimelineio 
     PUBLIC opentime ${OTIO_IMATH_TARGETS})
-- 
2.48.1

openSUSE Build Service is sponsored by