mirror of
https://github.com/akheron/jansson.git
synced 2025-04-21 12:39:33 +00:00
Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
|
96d160df90 | ||
|
aef13f87f1 | ||
|
c16ac732e4 | ||
|
05a10aa8af | ||
|
4d7ac97b89 | ||
|
23905f372c | ||
|
0f9c18dd12 |
5 changed files with 31 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required (VERSION 3.1)
|
||||
cmake_minimum_required (VERSION 3.10)
|
||||
project(jansson C)
|
||||
|
||||
# Options
|
||||
|
@ -266,18 +266,15 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/jansson_config.h.cmake
|
|||
file (COPY ${CMAKE_CURRENT_SOURCE_DIR}/src/jansson.h
|
||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/include/)
|
||||
|
||||
add_definitions(-DJANSSON_USING_CMAKE)
|
||||
|
||||
# configure the private config file
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/cmake/jansson_private_config.h.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/private_include/jansson_private_config.h)
|
||||
|
||||
# and tell the source code to include it
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
|
||||
include_directories (${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
include_directories (${CMAKE_CURRENT_BINARY_DIR}/private_include)
|
||||
|
||||
# Configuration flags will be set on project later once we have defined the target
|
||||
|
||||
|
||||
# Add the lib sources.
|
||||
file(GLOB JANSSON_SRC src/*.c)
|
||||
if (NOT USE_DTOA)
|
||||
|
@ -356,6 +353,20 @@ else()
|
|||
POSITION_INDEPENDENT_CODE true)
|
||||
endif()
|
||||
|
||||
|
||||
# Now target jansson is declared, set per-target values
|
||||
|
||||
target_compile_definitions(jansson PUBLIC JANSSON_USING_CMAKE)
|
||||
target_compile_definitions(jansson PRIVATE HAVE_CONFIG_H)
|
||||
|
||||
target_include_directories(jansson
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||
INTERFACE $<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
add_library( jansson::jansson ALIAS jansson )
|
||||
|
||||
|
||||
if (JANSSON_EXAMPLES)
|
||||
add_executable(simple_parse "${CMAKE_CURRENT_SOURCE_DIR}/examples/simple_parse.c")
|
||||
target_link_libraries(simple_parse jansson)
|
||||
|
|
9
doc/.readthedocs.yaml
Normal file
9
doc/.readthedocs.yaml
Normal file
|
@ -0,0 +1,9 @@
|
|||
version: 2
|
||||
|
||||
build:
|
||||
os: ubuntu-22.04
|
||||
tools:
|
||||
python: "3.12"
|
||||
|
||||
sphinx:
|
||||
configuration: doc/conf.py
|
|
@ -26,7 +26,7 @@
|
|||
#define MAX_INTEGER_STR_LENGTH 25
|
||||
#define MAX_REAL_STR_LENGTH 25
|
||||
|
||||
#define FLAGS_TO_INDENT(f) ((f)&0x1F)
|
||||
#define FLAGS_TO_INDENT(f) ((f) & 0x1F)
|
||||
#define FLAGS_TO_PRECISION(f) (((f) >> 11) & 0x1F)
|
||||
|
||||
struct buffer {
|
||||
|
|
|
@ -379,14 +379,14 @@ json_t *json_load_callback(json_load_callback_t callback, void *data, size_t fla
|
|||
/* encoding */
|
||||
|
||||
#define JSON_MAX_INDENT 0x1F
|
||||
#define JSON_INDENT(n) ((n)&JSON_MAX_INDENT)
|
||||
#define JSON_INDENT(n) ((n) & JSON_MAX_INDENT)
|
||||
#define JSON_COMPACT 0x20
|
||||
#define JSON_ENSURE_ASCII 0x40
|
||||
#define JSON_SORT_KEYS 0x80
|
||||
#define JSON_PRESERVE_ORDER 0x100
|
||||
#define JSON_ENCODE_ANY 0x200
|
||||
#define JSON_ESCAPE_SLASH 0x400
|
||||
#define JSON_REAL_PRECISION(n) (((n)&0x1F) << 11)
|
||||
#define JSON_REAL_PRECISION(n) (((n) & 0x1F) << 11)
|
||||
#define JSON_EMBED 0x10000
|
||||
|
||||
typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#define STRBUFFER_MIN_SIZE 16
|
||||
#define STRBUFFER_FACTOR 2
|
||||
#define STRBUFFER_SIZE_MAX ((size_t)-1)
|
||||
#define STRBUFFER_SIZE_MAX ((size_t)(-1))
|
||||
|
||||
int strbuffer_init(strbuffer_t *strbuff) {
|
||||
strbuff->size = STRBUFFER_MIN_SIZE;
|
||||
|
|
Loading…
Add table
Reference in a new issue