Commit 5628f30b authored by Branislav Katreniak's avatar Branislav Katreniak

json: integrate to build

parent c242a3a0
......@@ -109,6 +109,9 @@ if(NOT MSVC) # Don't install pkg-config files when building with MSVC
configure_file(capnp-rpc.pc.in "${CMAKE_CURRENT_BINARY_DIR}/capnp-rpc.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capnp-rpc.pc" DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
configure_file(capnp-json.pc.in "${CMAKE_CURRENT_BINARY_DIR}/capnp-json.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/capnp-json.pc" DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
endif()
unset(STDLIB_FLAG)
......
......@@ -74,7 +74,8 @@ public_capnpc_inputs = \
src/capnp/schema.capnp \
src/capnp/rpc.capnp \
src/capnp/rpc-twoparty.capnp \
src/capnp/persistent.capnp
src/capnp/persistent.capnp \
src/capnp/compat/json.capnp
capnpc_inputs = \
$(public_capnpc_inputs) \
......@@ -92,12 +93,15 @@ capnpc_outputs = \
src/capnp/rpc-twoparty.capnp.h \
src/capnp/persistent.capnp.c++ \
src/capnp/persistent.capnp.h \
src/capnp/compat/json.capnp.h \
src/capnp/compat/json.capnp.c++ \
src/capnp/compiler/lexer.capnp.c++ \
src/capnp/compiler/lexer.capnp.h \
src/capnp/compiler/grammar.capnp.c++ \
src/capnp/compiler/grammar.capnp.h
includecapnpdir = $(includedir)/capnp
includecapnpcompatdir = $(includecapnpdir)/compat
includekjdir = $(includedir)/kj
includekjparsedir = $(includekjdir)/parse
includekjstddir = $(includekjdir)/std
......@@ -183,10 +187,14 @@ includecapnp_HEADERS = \
src/capnp/persistent.capnp.h \
src/capnp/ez-rpc.h
includecapnpcompat_HEADERS = \
src/capnp/compat/json.h \
src/capnp/compat/json.capnp.h
if LITE_MODE
lib_LTLIBRARIES = libkj.la libkj-test.la libcapnp.la
else
lib_LTLIBRARIES = libkj.la libkj-test.la libkj-async.la libcapnp.la libcapnp-rpc.la libcapnpc.la
lib_LTLIBRARIES = libkj.la libkj-test.la libkj-async.la libcapnp.la libcapnp-rpc.la libcapnp-json.la libcapnpc.la
endif
# Don't include security release in soname -- we want to replace old binaries
......@@ -266,6 +274,12 @@ libcapnp_rpc_la_SOURCES= \
src/capnp/persistent.capnp.c++ \
src/capnp/ez-rpc.c++
libcapnp_json_la_LIBADD = libcapnp.la libkj-async.la libkj.la $(PTHREAD_LIBS)
libcapnp_json_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
libcapnp_json_la_SOURCES= \
src/capnp/compat/json.c++ \
src/capnp/compat/json.capnp.c++
libcapnpc_la_LIBADD = libcapnp.la libkj.la $(PTHREAD_LIBS)
libcapnpc_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
libcapnpc_la_SOURCES= \
......@@ -388,9 +402,16 @@ heavy_tests = \
src/capnp/rpc-test.c++ \
src/capnp/rpc-twoparty-test.c++ \
src/capnp/ez-rpc-test.c++ \
src/capnp/compat/json-test.c++ \
src/capnp/compiler/lexer-test.c++ \
src/capnp/compiler/md5-test.c++
capnp_test_LDADD = libcapnpc.la libcapnp-rpc.la libcapnp.la libkj-async.la libkj-test.la libkj.la
capnp_test_LDADD = libcapnpc.la \
libcapnp-rpc.la \
libcapnp-json.la \
libcapnp.la \
libkj-async.la \
libkj-test.la \
libkj.la
endif !LITE_MODE
......
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Cap'n Proto JSON
Description: JSON encoder and decoder for Cap'n Proto objects
Version: @VERSION@
Libs: -L${libdir} -lcapnp-json
Requires: capnp = @VERSION@ kj-async = @VERSION@
Cflags: -I${includedir}
......@@ -134,6 +134,7 @@ endfunction()
find_package(PkgConfig QUIET)
pkg_check_modules(PKGCONFIG_CAPNP capnp)
pkg_check_modules(PKGCONFIG_CAPNP_RPC capnp-rpc QUIET)
pkg_check_modules(PKGCONFIG_CAPNP_JSON capnp-json QUIET)
find_library(CAPNP_LIB_KJ kj
HINTS "${PKGCONFIG_CAPNP_LIBDIR}" ${PKGCONFIG_CAPNP_LIBRARY_DIRS}
......@@ -147,12 +148,16 @@ find_library(CAPNP_LIB_CAPNP capnp
find_library(CAPNP_LIB_CAPNP-RPC capnp-rpc
HINTS "${PKGCONFIG_CAPNP_RPC_LIBDIR}" ${PKGCONFIG_CAPNP_RPC_LIBRARY_DIRS}
)
mark_as_advanced(CAPNP_LIB_KJ CAPNP_LIB_KJ-ASYNC CAPNP_LIB_CAPNP CAPNP_LIB_CAPNP-RPC)
find_library(CAPNP_LIB_CAPNP-JSON capnp-json
HINTS "${PKGCONFIG_CAPNP_JSON_LIBDIR}" ${PKGCONFIG_CAPNP_JSON_LIBRARY_DIRS}
)
mark_as_advanced(CAPNP_LIB_KJ CAPNP_LIB_KJ-ASYNC CAPNP_LIB_CAPNP CAPNP_LIB_CAPNP-RPC CAPNP_LIB_CAPNP-JSON)
set(CAPNP_LIBRARIES_LITE
${CAPNP_LIB_CAPNP}
${CAPNP_LIB_KJ}
)
set(CAPNP_LIBRARIES
${CAPNP_LIB_CAPNP-JSON}
${CAPNP_LIB_CAPNP-RPC}
${CAPNP_LIB_CAPNP}
${CAPNP_LIB_KJ-ASYNC}
......
......@@ -101,5 +101,5 @@ AC_SUBST([STDLIB_FLAG])
LIBS="$PTHREAD_LIBS $LIBS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
AC_CONFIG_FILES([Makefile capnp.pc capnp-rpc.pc kj.pc kj-async.pc])
AC_CONFIG_FILES([Makefile capnp.pc capnp-rpc.pc capnp-json.pc kj.pc kj-async.pc])
AC_OUTPUT
......@@ -7,4 +7,5 @@ export PATH=$PWD/bin:$PWD:$PATH
capnp compile -Isrc --no-standard-import --src-prefix=src -oc++:src \
src/capnp/c++.capnp src/capnp/schema.capnp \
src/capnp/compiler/lexer.capnp src/capnp/compiler/grammar.capnp \
src/capnp/rpc.capnp src/capnp/rpc-twoparty.capnp src/capnp/persistent.capnp
src/capnp/rpc.capnp src/capnp/rpc-twoparty.capnp src/capnp/persistent.capnp \
src/capnp/compat/json.capnp
......@@ -94,6 +94,26 @@ if(NOT CAPNP_LITE)
install(FILES ${capnp-rpc_headers} ${capnp-rpc_schemas} DESTINATION "${INCLUDE_INSTALL_DIR}/capnp")
endif()
# capnp-json ========================================================================
set(capnp-json_sources
compat/json.c++
compat/json.capnp.c++
)
set(capnp-json_headers
compat/json.h
compat/json.capnp.h
)
set(capnp-json_schemas
compat/json.capnp
)
if(NOT CAPNP_LITE)
add_library(capnp-json ${capnp-json_sources})
target_link_libraries(capnp-json capnp kj-async kj)
install(TARGETS capnp-json ARCHIVE DESTINATION "${LIB_INSTALL_DIR}")
install(FILES ${capnp-json_headers} ${capnp-json_schemas} DESTINATION "${INCLUDE_INSTALL_DIR}/capnp/compat")
endif()
# Tools/Compilers ==============================================================
set(capnpc_sources
......@@ -185,7 +205,7 @@ if(BUILD_TESTING)
if(CAPNP_LITE)
set(test_libraries capnp kj-test kj)
else()
set(test_libraries capnp-rpc capnp capnpc kj-async kj-test kj)
set(test_libraries capnp-json capnp-rpc capnp capnpc kj-async kj-test kj)
endif()
add_executable(capnp-tests
......@@ -227,6 +247,7 @@ if(BUILD_TESTING)
compiler/lexer-test.c++
compiler/md5-test.c++
test-util.c++
compat/json-test.c++
${test_capnp_cpp_files}
${test_capnp_h_files}
)
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment