Skip to content

Commit 1259d3e

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 350aa16 commit 1259d3e

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
@@ -19,6 +19,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES GNU)
1919
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-use-cxa-atexit>)
2020
endif()
2121

22+
if ((NOT DEFINED CLR_CMAKE_USE_SYSTEM_RAPIDJSON) OR (NOT CLR_CMAKE_USE_SYSTEM_RAPIDJSON))
23+
include_directories(${CLR_SRC_NATIVE_DIR}/external/)
24+
endif()
25+
2226
add_subdirectory(hostcommon)
2327
add_subdirectory(fxr)
2428
add_subdirectory(hostpolicy)

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

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ include_directories(../../json)
2121
include_directories(${CLR_SRC_NATIVE_DIR}/libs/System.IO.Compression.Native)
2222
include_directories(${CLR_SRC_NATIVE_DIR}/libs/Common)
2323

24+
if ((NOT DEFINED CLR_CMAKE_USE_SYSTEM_RAPIDJSON) OR (NOT CLR_CMAKE_USE_SYSTEM_RAPIDJSON))
25+
include_directories(${CLR_SRC_NATIVE_DIR}/external/)
26+
endif()
27+
2428
set(SOURCES
2529
../bundle_marker.cpp
2630
./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)