aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2023-09-24 12:43:27 +0200
committerJan200101 <sentrycraft123@gmail.com>2023-09-24 12:43:27 +0200
commitb92f3d1d6ad49881eb31ac911a8ad368743af108 (patch)
tree60d8ad809d19a5c392349f4dd38e4b818796150b /cmake
parent13df46ba41efe2d94e3dbec240ff0889ac054eb7 (diff)
downloadSouthRPC-b92f3d1d6ad49881eb31ac911a8ad368743af108.tar.gz
SouthRPC-b92f3d1d6ad49881eb31ac911a8ad368743af108.zip
implement RPC
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindRapidJSON.cmake16
-rw-r--r--cmake/Findjson-c.cmake99
2 files changed, 16 insertions, 99 deletions
diff --git a/cmake/FindRapidJSON.cmake b/cmake/FindRapidJSON.cmake
new file mode 100644
index 0000000..857bc9e
--- /dev/null
+++ b/cmake/FindRapidJSON.cmake
@@ -0,0 +1,16 @@
+### Get same spdlog as Northstar
+
+if (RapidJSON_FOUND)
+ return()
+endif()
+
+find_package(NorthstarPluginABI REQUIRED)
+
+check_init_submodule(${NS_LAUNCHER_DIR}/thirdparty/rapidjson)
+
+add_library(rapidjson_header INTERFACE)
+target_include_directories(rapidjson_header INTERFACE "${NS_LAUNCHER_DIR}/thirdparty")
+target_include_directories(rapidjson_header INTERFACE "${NS_LAUNCHER_DIR}/thirdparty/rapidjson")
+
+set(RapidJSON_FOUND 1)
+
diff --git a/cmake/Findjson-c.cmake b/cmake/Findjson-c.cmake
deleted file mode 100644
index 80a82dc..0000000
--- a/cmake/Findjson-c.cmake
+++ /dev/null
@@ -1,99 +0,0 @@
-#
-# Tries to find json-c through the config
-# before trying to query for it
-#
-
-if (json-c_FOUND)
- return()
-endif()
-
-#find_package(json-c CONFIG)
-
-if (json-c_FOUND)
- return()
-endif()
-
-if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
- find_package(PkgConfig QUIET)
- if (PKG_CONFIG_FOUND)
- pkg_check_modules(_JSONC json-c)
- endif()
-endif()
-
-if (_JSONC_FOUND) # we can rely on pkg-config
- set(json-c_LINK_LIBRARIES ${_JSONC_LINK_LIBRARIES})
- if (NOT BUILD_STATIC)
- set(json-c_INCLUDE_DIRS ${_JSONC_INCLUDE_DIRS})
- set(json-c_CFLAGS ${_JSONC_CFLAGS_OTHER})
- else()
- set(json-c_INCLUDE_DIRS ${_JSONC_STATIC_INCLUDE_DIRS})
- set(json-c_CFLAGS ${_JSONC_STATIC_CFLAGS_OTHER})
- endif()
- set(json-c_FOUND 1)
-else()
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(_lib_suffix 64)
- else()
- set(_lib_suffix 32)
- endif()
-
- find_path(JSONC_INC
- NAMES json.h
- HINTS
- ENV jsoncPath${_lib_suffix}
- ENV jsoncPath
- ${_JSONC_INCLUDE_DIRS}
- )
-
- find_library(JSONC_LIB
- NAMES ${_JSONC_LIBRARIES} jsonc json-c
- HINTS
- ENV jsoncPath${_lib_suffix}
- ENV jsoncPath
- ${_JSONC_LIBRARY_DIRS}
- ${_JSONC_STATIC_LIBRARY_DIRS}
- )
-
- include(FindPackageHandleStandardArgs)
- #find_package_handle_standard_args(json-c DEFAULT_MSG JSONC_LIB JSONC_INC)
- mark_as_advanced(JSONC_INC JSONC_LIB)
-
- if(json-c_FOUND)
- set(json-c_INCLUDE_DIRS ${JSONC_INC})
- set(json-c_LINK_LIBRARIES ${JSONC_LIB})
- if (BUILD_STATIC)
- set(json-c_LINK_LIBRARIES ${json-c_LINK_LIBRARIES} ${_JSONC_STATIC_LIBRARIES})
- endif()
- endif()
-endif()
-
-
-if (json-c_FOUND)
- # Reconstruct the official interface
- add_library(json-c::json-c UNKNOWN IMPORTED)
- set_target_properties(json-c::json-c PROPERTIES
- IMPORTED_LOCATION "${json-c_LINK_LIBRARIES}"
- )
- target_compile_definitions(json-c::json-c INTERFACE ${json-c_CFLAGS})
- target_include_directories(json-c::json-c INTERFACE ${json-c_INCLUDE_DIRS})
-else()
- include(FetchContent)
- cmake_policy(SET CMP0077 NEW)
-
- message(STATUS "Downloading json-c...")
- FetchContent_Declare(
- jsonc
- GIT_REPOSITORY https://github.com/json-c/json-c
- GIT_TAG json-c-0.17
- GIT_SHALLOW TRUE
- )
-
- set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
- set(BUILD_STATIC_LIBS ON CACHE INTERNAL "")
- FetchContent_MakeAvailable(jsonc)
-
- # Only the config file includes the namespace
- add_library(json-c::json-c ALIAS json-c)
-
- set(json-c_FOUND 1)
-endif()