Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
Because YggdrasilRapidJSON continues to merge updates from RapidJSON, the RapidJSON version is used with the addition of a EXTEN version after the PATCH version (i.e. MAJOR.MINOR.PATCH.EXTEN) to indicate the YggdrasilRapidJSON version. The EXTEN version will restart at 0 when/if RapidJSON increments their version.

## 1.1.0.6 - 2026-07-10

### Bug fixes
* Fix bug in YggdrasilRapidJSONConfig where Python embedding library was loaded as a dependency for Python extensions resulting in cmake warning about unsupported dynamic linking
* Change how YGGDRASIL_RAPIDJSON_VERSION is set from git tags so that it is cached

### Features
* Add YggdrasilRapidJSONTools.cmake to contain utilities for downstream packages, particularly for building/testing against a local YggdrasilRapidJSON passed via -DYGGDRASIL_RAPIDJSON_REPO_DIR:PATH=/path/to/repo or acquiring YggdrasilRapidJSON via git if -DYGGDRASIL_RAPIDJSON_CLONE_IF_MISSING:BOOL=ON is passed and an installation cannot be located.
* Disable build of tests, examples, documentation etc if the project is being included as a subdirectory
* Add local build flags based on cmake options to the YggdrasilRapidJSON interface if the project is being included as a subdirectory

## 1.1.0.5 - 2026-07-08

### Bug fixes
Expand All @@ -11,6 +22,7 @@ Because YggdrasilRapidJSON continues to merge updates from RapidJSON, the RapidJ

### Features
* NPY_TYPE2STRING utility for getting a numpy type enumerator name during debugging
* Disable YGGDRASIL_RAPIDJSON_ENABLE_INSTRUMENTATION_OPT cmake option by default for use by other packages

## 1.1.0.4 - 2026-07-06

Expand Down
25 changes: 16 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ endif()
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
include(${CMAKE_CURRENT_SOURCE_DIR}/YggdrasilRapidJSONMacros.cmake)

set(YGGDRASIL_RAPIDJSON_VERSION "" CACHE STRING "Version to use instead of the git tag version")
yggdrasil_rapidjson_gitversion(DEFAULT_YGGDRASIL_RAPIDJSON_VERSION "1.1.0.2")
set(YGGDRASIL_RAPIDJSON_VERSION "${DEFAULT_YGGDRASIL_RAPIDJSON_VERSION}" CACHE STRING "Version to use instead of the git tag version")

if(NOT YGGDRASIL_RAPIDJSON_VERSION)
yggdrasil_rapidjson_gitversion(YGGDRASIL_RAPIDJSON_VERSION "1.1.0.2")
endif()
message(STATUS "YGGDRASIL_RAPIDJSON_VERSION = ${YGGDRASIL_RAPIDJSON_VERSION}")

PROJECT(YggdrasilRapidJSON VERSION "${YGGDRASIL_RAPIDJSON_VERSION}" LANGUAGES C CXX)
Expand All @@ -38,15 +36,21 @@ SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
include(${CMAKE_CURRENT_SOURCE_DIR}/YggdrasilRapidJSONMacros.cmake)
yggdrasil_rapidjson_options_create()

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(IS_TOP_LEVEL_BUILD ON)
else()
set(IS_TOP_LEVEL_BUILD OFF)
endif()

option(YGGDRASIL_RAPIDJSON_NEST_HEADERS "Nest the headers during install under the package name (in addition to the directly containing the headers)" OFF)
option(YGGDRASIL_RAPIDJSON_CREATE_METASCHEMA "Re-create the metaschema" OFF)
option(YGGDRASIL_RAPIDJSON_CREATE_METASCHEMA_FULL "Re-create the metaschema and the full_schema.yaml file" OFF)
option(YGGDRASIL_RAPIDJSON_SCHEMA_TESTS "Build tests using the yggdrasil schema" OFF)
option(YGGDRASIL_RAPIDJSON_BUILD_DOC "Build yggdrasil_rapidjson documentation." ON)
option(YGGDRASIL_RAPIDJSON_BUILD_EXAMPLES "Build yggdrasil_rapidjson examples." ON)
option(YGGDRASIL_RAPIDJSON_BUILD_TESTS "Build yggdrasil_rapidjson perftests and unittests." ON)
option(YGGDRASIL_RAPIDJSON_BUILD_UNITTESTS "Build yggdrasil_rapidjson unittests." ON)
option(YGGDRASIL_RAPIDJSON_BUILD_PERFTESTS "Build yggdrasil_rapidjson perftests." ON)
option(YGGDRASIL_RAPIDJSON_BUILD_DOC "Build yggdrasil_rapidjson documentation." ${IS_TOP_LEVEL_BUILD})
option(YGGDRASIL_RAPIDJSON_BUILD_EXAMPLES "Build yggdrasil_rapidjson examples." ${IS_TOP_LEVEL_BUILD})
option(YGGDRASIL_RAPIDJSON_BUILD_TESTS "Build yggdrasil_rapidjson perftests and unittests." ${IS_TOP_LEVEL_BUILD})
option(YGGDRASIL_RAPIDJSON_BUILD_UNITTESTS "Build yggdrasil_rapidjson unittests." ${IS_TOP_LEVEL_BUILD})
option(YGGDRASIL_RAPIDJSON_BUILD_PERFTESTS "Build yggdrasil_rapidjson perftests." ${IS_TOP_LEVEL_BUILD})
option(YGGDRASIL_RAPIDJSON_BUILD_THIRDPARTY_GTEST
"Use gtest installation in `thirdparty/gtest` by default if available" OFF)

Expand Down Expand Up @@ -265,6 +269,9 @@ else()
endif()

yggdrasil_rapidjson_target_config(${PROJECT_NAME} INTERFACE INTERFACE)
if(NOT IS_TOP_LEVEL_BUILD)
yggdrasil_rapidjson_target_config(${PROJECT_NAME} INTERFACE LOCAL)
endif()

link_libraries(${PROJECT_NAME})
yggdrasil_rapidjson_global_config(CXX LOCAL)
Expand Down
6 changes: 5 additions & 1 deletion YggdrasilRapidJSONConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ list(GET @PROJECT_NAME@_INCLUDE_DIR 0 @PROJECT_NAME@_INCLUDE_DIR)

if(NOT (YGGDRASIL_DISABLE_PYTHON_C_API OR DISABLE_YGGDRASIL_RAPIDJSON))
include(CMakeFindDependencyMacro)
find_dependency(Python3 COMPONENTS Interpreter Development NumPy)
if(YGGDRASIL_RAPIDJSON_PYTHON_WRAPPER)
find_dependency(Python3 COMPONENTS Interpreter Development.Module NumPy)
else()
find_dependency(Python3 COMPONENTS Interpreter Development NumPy)
endif()
endif()

yggdrasil_rapidjson_config_init(@PROJECT_NAME@_INTERFACE)
Expand Down
150 changes: 150 additions & 0 deletions YggdrasilRapidJSONTools.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# This file contains some useful macros for use by packages using
# yggdrasil-rapidjson as a dependency via find_package

macro(include_yggdrasil_rapidjson_macros)
if(POLICY CMP0169)
# Allows FetchContent_Populate to be called directly so that the
# macros from a YggdrasilRapidJSON repository can be used without
# including the subdirectory and initializing the YggdrasilRapidJSON
# target with properties based on current option values
cmake_policy(SET CMP0169 OLD)
endif()
if(NOT COMMAND yggdrasil_rapidjson_options)
option(YGGDRASIL_RAPIDJSON_CLONE_IF_MISSING "Clone the YggdrasilRapidJSON library from GitHub if it cannot be located locally" OFF)
set(YGGDRASIL_RAPIDJSON_REPO_DIR "" CACHE PATH "Existing directory containing the yggdrasil-rapidjson repository")
set(YGGDRASIL_RAPIDJSON_REPO_BUILD_DIR "")
set(YGGDRASIL_RAPIDJSON_MACROS_FILE "")

if(YggdrasilRapidJSON_FOUND)
message(FATAL_ERROR "YggdrasilRapidJSON_FOUND, but yggdrasil_rapidjson_options not defined")
elseif(NOT YGGDRASIL_RAPIDJSON_REPO_DIR)
if(WIN32)
set(YGGDRASIL_RAPIDJSON_CONFIG_FILE_PATH_SUFFIXES "Library/cmake")
else()
set(YGGDRASIL_RAPIDJSON_CONFIG_FILE_PATH_SUFFIXES "lib/cmake/YggdrasilRapidJSON")
endif()
find_file(
YGGDRASIL_RAPIDJSON_CONFIG_FILE
YggdrasilRapidJSONConfig.cmake
PATHS "${YggdrasilRapidJSON_DIR}"
PATH_SUFFIXES "${YGGDRASIL_RAPIDJSON_CONFIG_FILE_PATH_SUFFIXES}"
)
unset(YGGDRASIL_RAPIDJSON_CONFIG_FILE_PATH_SUFFIXES)
if(YGGDRASIL_RAPIDJSON_CONFIG_FILE)
message(DEBUG "Located YggdrasilRapidJSON config file at ${YGGDRASIL_RAPIDJSON_CONFIG_FILE}")
cmake_path(
GET YGGDRASIL_RAPIDJSON_CONFIG_FILE
PARENT_PATH YGGDRASIL_RAPIDJSON_MACROS_FILE
)
cmake_path(
APPEND YGGDRASIL_RAPIDJSON_MACROS_FILE
YggdrasilRapidJSONMacros.cmake
)
else()
find_file(
YGGDRASIL_RAPIDJSON_CONFIG_FILE
YggdrasilRapidJSONConfig.cmake.in
PATHS "${YggdrasilRapidJSON_DIR}"
)
if(YGGDRASIL_RAPIDJSON_CONFIG_FILE)
message(DEBUG "Located YggdrasilRapidJSON config template file at ${YGGDRASIL_RAPIDJSON_CONFIG_FILE}")
cmake_path(
GET YGGDRASIL_RAPIDJSON_CONFIG_FILE
PARENT_PATH YGGDRASIL_RAPIDJSON_REPO_DIR
)
endif()
endif()
unset(YGGDRASIL_RAPIDJSON_CONFIG_FILE)
endif()
if(YGGDRASIL_RAPIDJSON_REPO_DIR)
if(NOT EXISTS "${YGGDRASIL_RAPIDJSON_REPO_DIR}")
message(FATAL_ERROR "Directory specified by option YGGDRASIL_RAPIDJSON_REPO_DIR=\"${YGGDRASIL_RAPIDJSON_REPO_DIR}\" does not exist")
endif()
if(NOT IS_ABSOLUTE "${YGGDRASIL_RAPIDJSON_REPO_DIR}")
cmake_path(
ABSOLUTE_PATH YGGDRASIL_RAPIDJSON_REPO_DIR
NORMALIZE
)
endif()
include(FetchContent)
FetchContent_Declare(
YggdrasilRapidJSON
SOURCE_DIR "${YGGDRASIL_RAPIDJSON_REPO_DIR}"
EXCLUDE_FROM_ALL
OVERRIDE_FIND_PACKAGE
)
FetchContent_Populate(YggdrasilRapidJSON)
cmake_path(
APPEND YGGDRASIL_RAPIDJSON_REPO_DIR "_build_for_${PROJECT_NAME}"
OUTPUT_VARIABLE YGGDRASIL_RAPIDJSON_REPO_BUILD_DIR
)
elseif(NOT YGGDRASIL_RAPIDJSON_MACROS_FILE)
if(YGGDRASIL_RAPIDJSON_CLONE_IF_MISSING)
set(YGGDRASIL_RAPIDJSON_CLONE_MSG_LEVEL WARNING)
else()
set(YGGDRASIL_RAPIDJSON_CLONE_MSG_LEVEL FATAL_ERROR)
endif()
message(
${YGGDRASIL_RAPIDJSON_CLONE_MSG_LEVEL}
"Could not locate the YggdrasilRapidJSON package via find_file (YggdrasilRapidJSON_DIR=${YggdrasilRapidJSON_DIR}), importing it from github as an external project..."
)
unset(YGGDRASIL_RAPIDJSON_CLONE_MSG_LEVEL)
include(FetchContent)
FetchContent_Declare(
YggdrasilRapidJSON
GIT_REPOSITORY https://github.com/cropsinsilico/yggdrasil-rapidjson.git
GIT_TAG origin/yggdrasil
EXCLUDE_FROM_ALL
OVERRIDE_FIND_PACKAGE
)
FetchContent_Populate(YggdrasilRapidJSON)
set(YGGDRASIL_RAPIDJSON_REPO_DIR "${yggdrasilrapidjson_SOURCE_DIR}")
set(YGGDRASIL_RAPIDJSON_REPO_BUILD_DIR "${yggdrasilrapidjson_BINARY_DIR}")
endif()
if(NOT YGGDRASIL_RAPIDJSON_MACROS_FILE)
cmake_path(
APPEND YGGDRASIL_RAPIDJSON_REPO_DIR
YggdrasilRapidJSONMacros.cmake
OUTPUT_VARIABLE YGGDRASIL_RAPIDJSON_MACROS_FILE
)
endif()
message(STATUS "Including YggdrasilRapidJSON macros from \"${YGGDRASIL_RAPIDJSON_MACROS_FILE}\" (REPO_DIR=${YGGDRASIL_RAPIDJSON_REPO_DIR})")
include("${YGGDRASIL_RAPIDJSON_MACROS_FILE}")
endif()
endmacro()

macro(find_yggdrasil_rapidjson)
include_yggdrasil_rapidjson_macros()
if(YGGDRASIL_RAPIDJSON_REPO_DIR)
# TODO: Move this into a generated dummy config file that can be
# used by find_package
foreach(suffix BUILD_EXAMPLES BUILD_TESTS BUILD_DOC)
if(NOT YGGDRASIL_RAPIDJSON_${suffix})
set(YGGDRASIL_RAPIDJSON_${suffix} OFF)
endif()
endforeach()
add_subdirectory(
"${YGGDRASIL_RAPIDJSON_REPO_DIR}"
"${YGGDRASIL_RAPIDJSON_REPO_BUILD_DIR}"
EXCLUDE_FROM_ALL
)
# Required for cmake <3.28 when EXCLUDE_FROM_ALL was added to
# FetchContent_Declare
set_property(
DIRECTORY "${YGGDRASIL_RAPIDJSON_REPO_DIR}"
PROPERTY EXCLUDE_FROM_ALL ON
)
set(YggdrasilRapidJSON_VERSION "${YGGDRASIL_RAPIDJSON_VERSION}")
cmake_path(
APPEND YGGDRASIL_RAPIDJSON_REPO_DIR "include"
OUTPUT_VARIABLE YggdrasilRapidJSON_INCLUDE_DIRS
)
if(YggdrasilRapidJSON_VERSION VERSION_LESS "1.1.0.6")
yggdrasil_rapidjson_options_config(LOCAL)
yggdrasil_rapidjson_target_config(YggdrasilRapidJSON INTERFACE LOCAL)
endif()
else()
find_package(YggdrasilRapidJSON REQUIRED)
endif()

endmacro()
2 changes: 1 addition & 1 deletion conda.recipe/recipe.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
context:
version: "1.1.0.5"
version: "1.1.0.6"

package:
name: yggdrasil-rapidjson
Expand Down
2 changes: 1 addition & 1 deletion include/yggdrasil_rapidjson/yggdrasil_rapidjson_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#define YGGDRASIL_RAPIDJSON_MAJOR_VERSION 1
#define YGGDRASIL_RAPIDJSON_MINOR_VERSION 1
#define YGGDRASIL_RAPIDJSON_PATCH_VERSION 0
#define YGGDRASIL_RAPIDJSON_EXTEN_VERSION 5
#define YGGDRASIL_RAPIDJSON_EXTEN_VERSION 6
#define YGGDRASIL_RAPIDJSON_VERSION_STRING \
YGGDRASIL_RAPIDJSON_STRINGIFY(YGGDRASIL_RAPIDJSON_MAJOR_VERSION.YGGDRASIL_RAPIDJSON_MINOR_VERSION.YGGDRASIL_RAPIDJSON_PATCH_VERSION.YGGDRASIL_RAPIDJSON_EXTEN_VERSION)

Expand Down
Loading