Build yyjson into nwcore
All checks were successful
Source release / source-package (push) Successful in 1m8s
All checks were successful
Source release / source-package (push) Successful in 1m8s
This commit is contained in:
@@ -205,37 +205,13 @@ set(MARS_NWE_YYJSON_SOURCE_DIR
|
||||
"${CMAKE_SOURCE_DIR}/third_party/yyjson"
|
||||
CACHE PATH "Path to the bundled yyjson source tree")
|
||||
|
||||
if(NOT EXISTS "${MARS_NWE_YYJSON_SOURCE_DIR}/CMakeLists.txt")
|
||||
if(NOT EXISTS "${MARS_NWE_YYJSON_SOURCE_DIR}/src/yyjson.c" OR
|
||||
NOT EXISTS "${MARS_NWE_YYJSON_SOURCE_DIR}/src/yyjson.h")
|
||||
message(FATAL_ERROR
|
||||
"Bundled yyjson is required. Run: git submodule update --init --recursive third_party/yyjson")
|
||||
"Bundled yyjson source is required. Run: git submodule update --init --recursive third_party/yyjson")
|
||||
endif()
|
||||
|
||||
set(YYJSON_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_BUILD_FUZZER OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_BUILD_MISC OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_BUILD_DOC OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_ENABLE_COVERAGE OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_ENABLE_VALGRIND OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_ENABLE_FASTMATH OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_FORCE_32_BIT OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_SANITIZER "" CACHE STRING "" FORCE)
|
||||
set(YYJSON_DISABLE_READER OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_DISABLE_WRITER OFF CACHE BOOL "" FORCE)
|
||||
set(YYJSON_DISABLE_INCR_READER ON CACHE BOOL "" FORCE)
|
||||
set(YYJSON_DISABLE_UTILS ON CACHE BOOL "" FORCE)
|
||||
set(YYJSON_DISABLE_FAST_FP_CONV ON CACHE BOOL "" FORCE)
|
||||
set(YYJSON_DISABLE_NON_STANDARD ON CACHE BOOL "" FORCE)
|
||||
set(YYJSON_DISABLE_UTF8_VALIDATION OFF CACHE BOOL "" FORCE)
|
||||
|
||||
set(MARS_NWE_SAVED_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
add_subdirectory("${MARS_NWE_YYJSON_SOURCE_DIR}"
|
||||
"${CMAKE_BINARY_DIR}/third_party/yyjson"
|
||||
EXCLUDE_FROM_ALL)
|
||||
set(BUILD_SHARED_LIBS ${MARS_NWE_SAVED_BUILD_SHARED_LIBS})
|
||||
|
||||
message(STATUS "Salvage JSON backend: bundled static yyjson")
|
||||
message(STATUS "Salvage JSON backend: yyjson built into nwcore")
|
||||
|
||||
# mars-nwe private third-party stack. These are built with the nw namespace so
|
||||
# they can be installed next to system libraries and headers without collisions.
|
||||
|
||||
@@ -77,7 +77,7 @@ add_executable(ftrustee ftrustee.c tools.c nwfname.c unxfile.c nwvolume.c nwattr
|
||||
##############
|
||||
|
||||
target_link_libraries(nwserv ${CRYPT_LIBRARIES} )
|
||||
target_link_libraries(nwconn ${CRYPT_LIBRARIES} ${XATTR_LIBRARIES} yyjson )
|
||||
target_link_libraries(nwconn ${CRYPT_LIBRARIES} ${XATTR_LIBRARIES} mars_nwe::core )
|
||||
target_link_libraries(ncpserv ${CRYPT_LIBRARIES} )
|
||||
target_link_libraries(nwclient ${CRYPT_LIBRARIES} )
|
||||
target_link_libraries(nwbind ${CRYPT_LIBRARIES} ${GDBM_LIBRARIES} )
|
||||
|
||||
@@ -4,10 +4,19 @@ set(NWCORE_ZLOG_DIR
|
||||
"${CMAKE_SOURCE_DIR}/third_party/zlog"
|
||||
CACHE PATH "Path to bundled zlog source tree")
|
||||
|
||||
set(NWCORE_YYJSON_DIR
|
||||
"${MARS_NWE_YYJSON_SOURCE_DIR}"
|
||||
CACHE PATH "Path to bundled yyjson source tree")
|
||||
|
||||
if(NOT EXISTS "${NWCORE_ZLOG_DIR}/src/zlog.h")
|
||||
message(FATAL_ERROR "Bundled zlog is required. Run: git submodule update --init --recursive third_party/zlog")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${NWCORE_YYJSON_DIR}/src/yyjson.c" OR
|
||||
NOT EXISTS "${NWCORE_YYJSON_DIR}/src/yyjson.h")
|
||||
message(FATAL_ERROR "Bundled yyjson is required. Run: git submodule update --init --recursive third_party/yyjson")
|
||||
endif()
|
||||
|
||||
file(GLOB NWCORE_ZLOG_SOURCES CONFIGURE_DEPENDS
|
||||
"${NWCORE_ZLOG_DIR}/src/*.c")
|
||||
|
||||
@@ -26,10 +35,15 @@ configure_file(
|
||||
"${NWCORE_ZLOG_DIR}/src/zlog.h"
|
||||
"${NWCORE_BUILD_INCLUDE_DIR}/zlog.h"
|
||||
COPYONLY)
|
||||
configure_file(
|
||||
"${NWCORE_YYJSON_DIR}/src/yyjson.h"
|
||||
"${NWCORE_BUILD_INCLUDE_DIR}/yyjson.h"
|
||||
COPYONLY)
|
||||
|
||||
add_library(nwcore SHARED
|
||||
core.c
|
||||
${NWCORE_ZLOG_SOURCES})
|
||||
${NWCORE_ZLOG_SOURCES}
|
||||
"${NWCORE_YYJSON_DIR}/src/yyjson.c")
|
||||
add_library(mars_nwe::core ALIAS nwcore)
|
||||
|
||||
set_target_properties(nwcore PROPERTIES
|
||||
@@ -40,7 +54,11 @@ set_target_properties(nwcore PROPERTIES
|
||||
target_compile_features(nwcore PRIVATE c_std_99)
|
||||
target_compile_definitions(nwcore PRIVATE
|
||||
_GNU_SOURCE
|
||||
MARS_NWE_VERSION_STRING="${MARS_NWE_VERSION}")
|
||||
MARS_NWE_VERSION_STRING="${MARS_NWE_VERSION}"
|
||||
YYJSON_DISABLE_INCR_READER
|
||||
YYJSON_DISABLE_UTILS
|
||||
YYJSON_DISABLE_FAST_FP_CONV
|
||||
YYJSON_DISABLE_NON_STANDARD)
|
||||
|
||||
target_include_directories(nwcore
|
||||
PUBLIC
|
||||
@@ -48,7 +66,8 @@ target_include_directories(nwcore
|
||||
"$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
|
||||
PRIVATE
|
||||
"${NWCORE_ZLOG_DIR}/src")
|
||||
"${NWCORE_ZLOG_DIR}/src"
|
||||
"${NWCORE_YYJSON_DIR}/src")
|
||||
|
||||
target_link_libraries(nwcore PUBLIC Threads::Threads)
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <fnmatch.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
#include <yyjson.h>
|
||||
#include <nwcore/yyjson.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
Reference in New Issue
Block a user