Skip to content

Commit 8d05fc4

Browse files
committed
Support using the system rapidjson to build
We have a bundled copy of rapidjson in runtime, but some Linux distributions also ship with another version of that library. Support using that too, optionally. This does not change the default behaviour - the bundled copy of rapidjson is used. A cmake argument of CLR_CMAKE_USE_SYSTEM_RAPIDJSON=true needs to be set to use the system version of rapidjson.
1 parent 752558f commit 8d05fc4

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

src/native/corehost/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ add_library(fxr_resolver INTERFACE)
8383
target_sources(fxr_resolver INTERFACE fxr_resolver.cpp)
8484
target_include_directories(fxr_resolver INTERFACE fxr)
8585

86+
if ((NOT DEFINED CLR_CMAKE_USE_SYSTEM_RAPIDJSON) OR (NOT CLR_CMAKE_USE_SYSTEM_RAPIDJSON))
87+
include_directories(${CLR_SRC_NATIVE_DIR}/external/)
88+
endif()
89+
8690
add_subdirectory(hostcommon)
8791
add_subdirectory(hostmisc)
8892
add_subdirectory(fxr)

src/native/corehost/apphost/static/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ add_subdirectory(../../hostmisc hostmisc)
2727
configure_file(${CLR_SRC_NATIVE_DIR}/corehost/configure.h.in ${GENERATED_INCLUDE_DIR}/corehost/configure.h)
2828
target_include_directories(hostmisc PUBLIC ${GENERATED_INCLUDE_DIR}/corehost)
2929

30+
if ((NOT DEFINED CLR_CMAKE_USE_SYSTEM_RAPIDJSON) OR (NOT CLR_CMAKE_USE_SYSTEM_RAPIDJSON))
31+
include_directories(${CLR_SRC_NATIVE_DIR}/external/)
32+
endif()
33+
3034
set(SOURCES
3135
../bundle_marker.cpp
3236
./hostfxr_resolver.cpp

src/native/corehost/json_parser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define RAPIDJSON_ERROR_STRING(x) _X(x)
1111

1212
#include <json_parser.h>
13-
#include <external/rapidjson/error/en.h>
13+
#include <rapidjson/error/en.h>
1414
#include "utils.h"
1515
#include <cassert>
1616
#include <cstdint>

src/native/corehost/json_parser.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#endif
1818

1919
#include "pal.h"
20-
#include <external/rapidjson/document.h>
21-
#include <external/rapidjson/fwd.h>
20+
#include <rapidjson/document.h>
21+
#include <rapidjson/fwd.h>
2222
#include <vector>
2323
#include "bundle/info.h"
2424

src/native/corehost/runtime_config.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "json_parser.h"
55
#include "pal.h"
6-
#include <external/rapidjson/writer.h>
6+
#include <rapidjson/writer.h>
77
#include "roll_fwd_on_no_candidate_fx_option.h"
88
#include "runtime_config.h"
99
#include "trace.h"

0 commit comments

Comments
 (0)