From bfcb32056c6efedd255e45fdc66b9022caceb430 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Tue, 7 Oct 2025 22:46:56 -0600 Subject: [PATCH 01/13] git submodule add https://github.com/externpro/externpro .devcontainer --- .devcontainer | 1 + .gitmodules | 3 +++ 2 files changed, 4 insertions(+) create mode 160000 .devcontainer diff --git a/.devcontainer b/.devcontainer new file mode 160000 index 000000000..97db0d6b7 --- /dev/null +++ b/.devcontainer @@ -0,0 +1 @@ +Subproject commit 97db0d6b7d00d8f33e52e646a1aef1395fa58931 diff --git a/.gitmodules b/.gitmodules index 5e41f7c97..8612e8ad7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "thirdparty/gtest"] path = thirdparty/gtest url = https://github.com/google/googletest.git +[submodule ".devcontainer"] + path = .devcontainer + url = https://github.com/externpro/externpro From 7cdccbcd217a94f3b90ee36cc3c04d5134aff5c5 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Tue, 7 Oct 2025 22:49:17 -0600 Subject: [PATCH 02/13] docker-compose links --- docker-compose.sh | 1 + docker-compose.yml | 1 + 2 files changed, 2 insertions(+) create mode 120000 docker-compose.sh create mode 120000 docker-compose.yml diff --git a/docker-compose.sh b/docker-compose.sh new file mode 120000 index 000000000..85f182f0b --- /dev/null +++ b/docker-compose.sh @@ -0,0 +1 @@ +.devcontainer/compose.pro.sh \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 120000 index 000000000..46c1f8918 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1 @@ +.devcontainer/compose.bld.yml \ No newline at end of file From 418b3146286a992e1df10c15ecb0c80bd82513ef Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 09:54:49 -0600 Subject: [PATCH 03/13] gitattributes: CMakePresets .json files as text, not binary --- .gitattributes | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index 6f598bb7f..fa97c8d06 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19,4 +19,9 @@ Dockerfile text # Denote all files that are truly binary and should not be modified. *.png binary *.jpg binary -*.json binary \ No newline at end of file +bin/**/*.json binary +library.json binary +package.json binary + +# Exceptions for JSON files that should be treated as text +CMakePresets*.json text eol=lf From 97cb48bb71999e7043400f614b555a7f181dbff0 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 10:16:02 -0600 Subject: [PATCH 04/13] add CMakePresets cp .devcontainer/cmake/presets/CMakePresets* . --- CMakePresets.json | 8 ++++++++ CMakePresetsBase.json | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 CMakePresets.json create mode 100644 CMakePresetsBase.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..f82cfdd2c --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,8 @@ +{ + "version": 8, + "include": [ + ".devcontainer/cmake/presets/xpLinuxNinja.json", + ".devcontainer/cmake/presets/xpDarwinNinja.json", + ".devcontainer/cmake/presets/xpWindowsVs2022.json" + ] +} diff --git a/CMakePresetsBase.json b/CMakePresetsBase.json new file mode 100644 index 000000000..085cdc3e3 --- /dev/null +++ b/CMakePresetsBase.json @@ -0,0 +1,16 @@ +{ + "version": 8, + "configurePresets": [ + { + "name": "config-base", + "hidden": true, + "binaryDir": "${sourceDir}/_bld-${presetName}" + } + ], + "buildPresets": [ + { + "name": "build-base", + "hidden": true + } + ] +} From 93fad35196db04e0d8d9c497dbbc3ba6a29cf074 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 10:18:21 -0600 Subject: [PATCH 05/13] gitignore: add externpro ignores --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index e7e8fba9b..27e4d7cfc 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,8 @@ Doxyfile Doxyfile.zh-cn DartConfiguration.tcl *.nupkg + +# externpro +.env +_bld*/ +docker-compose.override.yml From be7c84fa9801a4665b6bf7428b8ef49b32940ea3 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 10:20:38 -0600 Subject: [PATCH 06/13] externpro github/workflows @25.05.2 cp .devcontainer/.github/wf-templates/xp*.yml .github/workflows --- .github/workflows/xpbuild.yml | 30 ++++++++++++++++++++++++++++++ .github/workflows/xprelease.yml | 20 ++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .github/workflows/xpbuild.yml create mode 100644 .github/workflows/xprelease.yml diff --git a/.github/workflows/xpbuild.yml b/.github/workflows/xpbuild.yml new file mode 100644 index 000000000..f0192ca9a --- /dev/null +++ b/.github/workflows/xpbuild.yml @@ -0,0 +1,30 @@ +name: Build +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + workflow_dispatch: +jobs: + linux: + uses: externpro/externpro/.github/workflows/build-linux.yml@25.05.2 + with: + cmake-workflow-preset: Linux + runon: ubuntu-latest + secrets: inherit + linux-arm64: + uses: externpro/externpro/.github/workflows/build-linux.yml@25.05.2 + with: + cmake-workflow-preset: Linux + runon: ubuntu-24.04-arm + secrets: inherit + macos: + uses: externpro/externpro/.github/workflows/build-macos.yml@25.05.2 + with: + cmake-workflow-preset: Darwin + secrets: inherit + windows: + uses: externpro/externpro/.github/workflows/build-windows.yml@25.05.2 + with: + cmake-workflow-preset: Windows + secrets: inherit diff --git a/.github/workflows/xprelease.yml b/.github/workflows/xprelease.yml new file mode 100644 index 000000000..273199e97 --- /dev/null +++ b/.github/workflows/xprelease.yml @@ -0,0 +1,20 @@ +name: Release +on: + workflow_dispatch: + inputs: + workflow_run_url: + description: 'URL of the workflow run containing artifacts to upload (e.g., https://github.com/owner/repo/actions/runs/123456789)' + required: true + type: string +jobs: + # Upload build artifacts as release assets + release-from-build: + uses: externpro/externpro/.github/workflows/release-from-build.yml@25.05.2 + with: + workflow_run_url: ${{ github.event.inputs.workflow_run_url }} + artifact_pattern: "*.tar.xz" + permissions: + contents: write + id-token: write + attestations: write + secrets: inherit From 54f3f255499d7d362f1db2a5a8440c69a80e24c7 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 10:24:01 -0600 Subject: [PATCH 07/13] CMakePresetsBase: add cacheVariables XP_NAMESPACE --- CMakePresetsBase.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakePresetsBase.json b/CMakePresetsBase.json index 085cdc3e3..4489d79c3 100644 --- a/CMakePresetsBase.json +++ b/CMakePresetsBase.json @@ -4,7 +4,10 @@ { "name": "config-base", "hidden": true, - "binaryDir": "${sourceDir}/_bld-${presetName}" + "binaryDir": "${sourceDir}/_bld-${presetName}", + "cacheVariables": { + "XP_NAMESPACE": "xpro" + } } ], "buildPresets": [ From d105401106afc27fd80954e7429c1f8d4166b261 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 11:46:35 -0600 Subject: [PATCH 08/13] externpro dependency provider --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec7632782..d8ab59504 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() +set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES .devcontainer/cmake/xproinc.cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules) PROJECT(RapidJSON CXX) From 25ca078a16869ea381490820b746f464acb82c1c Mon Sep 17 00:00:00 2001 From: Philipp A Hartmann Date: Sun, 15 Jul 2018 16:02:03 +0200 Subject: [PATCH 09/13] Suppress -Wformat-overflow warning/error GCC 7 and later warn about overflow/truncation when using sprintf and related functions with fixed-size buffers. Suppress the warning in schematest.cpp. --- test/perftest/schematest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/perftest/schematest.cpp b/test/perftest/schematest.cpp index 468f5fe6f..7d27344b5 100644 --- a/test/perftest/schematest.cpp +++ b/test/perftest/schematest.cpp @@ -11,6 +11,11 @@ using namespace rapidjson; +RAPIDJSON_DIAG_PUSH +#if defined(__GNUC__) && __GNUC__ >= 7 +RAPIDJSON_DIAG_OFF(format-overflow) +#endif + template static char* ReadFile(const char* filename, Allocator& allocator) { const char *paths[] = { @@ -42,6 +47,8 @@ static char* ReadFile(const char* filename, Allocator& allocator) { return json; } +RAPIDJSON_DIAG_POP + class Schema : public PerfTest { public: Schema() {} From 5bedf9696065a8cbed3141edd4fdaee885498f3b Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 12:51:26 -0600 Subject: [PATCH 10/13] xpbuild: cmake-workflow-preset Release --- .github/workflows/xpbuild.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/xpbuild.yml b/.github/workflows/xpbuild.yml index f0192ca9a..b9166a830 100644 --- a/.github/workflows/xpbuild.yml +++ b/.github/workflows/xpbuild.yml @@ -9,22 +9,22 @@ jobs: linux: uses: externpro/externpro/.github/workflows/build-linux.yml@25.05.2 with: - cmake-workflow-preset: Linux + cmake-workflow-preset: LinuxRelease runon: ubuntu-latest secrets: inherit linux-arm64: uses: externpro/externpro/.github/workflows/build-linux.yml@25.05.2 with: - cmake-workflow-preset: Linux + cmake-workflow-preset: LinuxRelease runon: ubuntu-24.04-arm secrets: inherit macos: uses: externpro/externpro/.github/workflows/build-macos.yml@25.05.2 with: - cmake-workflow-preset: Darwin + cmake-workflow-preset: DarwinRelease secrets: inherit windows: uses: externpro/externpro/.github/workflows/build-windows.yml@25.05.2 with: - cmake-workflow-preset: Windows + cmake-workflow-preset: WindowsRelease secrets: inherit From dac7d4d9acdc119bff686bf6bedfff66d491cf8b Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 12:51:57 -0600 Subject: [PATCH 11/13] cmake_minimum_required 2.8...3.31 (was 3.24) --- example/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 36e0fd9d1..d44c72670 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8...3.24) +cmake_minimum_required(VERSION 2.8...3.31) if(POLICY CMP0054) cmake_policy(SET CMP0054 NEW) From de7d75b15be2ee876628062a0e06ce1a8931a050 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 13:37:06 -0600 Subject: [PATCH 12/13] externpro devel package --- CMakeLists.txt | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8ab59504..e5e548456 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,10 +14,6 @@ PROJECT(RapidJSON CXX) include(GNUInstallDirs) include(xpflags) -if(DEFINED XP_NAMESPACE) - set(nameSpace NAMESPACE ${XP_NAMESPACE}::) - set(XP_OPT_INSTALL EXCLUDE_FROM_ALL) -endif() set(LIB_MAJOR_VERSION "1") set(LIB_MINOR_VERSION "1") @@ -114,9 +110,24 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) string(TOLOWER ${PROJECT_NAME} lib_name) add_library(${lib_name} INTERFACE) target_include_directories(${lib_name} INTERFACE $) + +function(callPackageDevel) + set(lib ${lib_name}) + string(PREPEND lib "${XP_NAMESPACE}::") + set(CMAKE_PROJECT_NAME ${lib_name}) + xpPackageDevel(TARGETS_FILE ${targetsFile} LIBRARIES ${lib}) +endfunction() + set(targetsFile ${lib_name}-targets) -install(TARGETS ${lib_name} EXPORT ${targetsFile}) -install(EXPORT ${targetsFile} DESTINATION ${CMAKE_INSTALL_DIR} ${nameSpace}) +if(DEFINED XP_NAMESPACE) + set(nameSpace NAMESPACE ${XP_NAMESPACE}::) + callPackageDevel() + set(RAPIDJSON_COMPONENT devel) +else() + set(RAPIDJSON_COMPONENT dev) +endif() +install(TARGETS ${lib_name} EXPORT ${targetsFile} COMPONENT devel) +install(EXPORT ${targetsFile} DESTINATION ${CMAKE_INSTALL_DIR} ${nameSpace} COMPONENT devel) if(RAPIDJSON_BUILD_DOC) add_subdirectory(doc) @@ -145,22 +156,19 @@ IF (UNIX OR CYGWIN) ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY) INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc - ${XP_OPT_INSTALL} DESTINATION "${LIB_INSTALL_DIR}/pkgconfig" COMPONENT pkgconfig) ENDIF() install(FILES readme.md - ${XP_OPT_INSTALL} DESTINATION "${DOC_INSTALL_DIR}" COMPONENT doc) install(DIRECTORY include/rapidjson DESTINATION "${INCLUDE_INSTALL_DIR}" - COMPONENT dev) + COMPONENT ${RAPIDJSON_COMPONENT}) install(DIRECTORY example/ - ${XP_OPT_INSTALL} DESTINATION "${DOC_INSTALL_DIR}/examples" COMPONENT examples # Following patterns are for excluding the intermediate/object files @@ -184,6 +192,5 @@ CONFIGURE_FILE(${PROJECT_NAME}ConfigVersion.cmake.in INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake - ${XP_OPT_INSTALL} DESTINATION "${CMAKE_INSTALL_DIR}" COMPONENT dev) From 0abdae3a6ce7c868b48dda62496c14bca8b46f08 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Wed, 8 Oct 2025 15:51:42 -0600 Subject: [PATCH 13/13] use googletest devel package instead of out-of-date GTestSrc --- test/CMakeLists.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 11c1b04c7..7f407e06b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,17 @@ -find_package(GTestSrc) +if(COMMAND xpFindPkg) + xpFindPkg(PKGS googletest) + enable_testing() + get_target_property(GTEST_INCLUDE_DIR xpro::gtest INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${GTEST_INCLUDE_DIR}) + set(TEST_LIBRARIES xpro::gtest xpro::gtest_main) + if(FALSE) # doesn't build with googletest-v1.16.0.1 + add_custom_target(tests ALL) + add_subdirectory(perftest) + add_subdirectory(unittest) + endif() +else() + find_package(GTestSrc) +endif() IF(GTESTSRC_FOUND) enable_testing()