Commit 7fae9544 authored by Philip Quinn's avatar Philip Quinn

Support installing with CMake.

parent f393c0e2
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# kj ==============================================================
add_library(kj add_library(kj
kj/common.c++ kj/common.c++
kj/units.c++ kj/units.c++
...@@ -18,12 +20,47 @@ add_library(kj ...@@ -18,12 +20,47 @@ add_library(kj
kj/main.c++ kj/main.c++
kj/parse/char.c++ kj/parse/char.c++
) )
set(kj_headers
kj/common.h
kj/units.h
kj/memory.h
kj/refcount.h
kj/array.h
kj/vector.h
kj/string.h
kj/string-tree.h
kj/exception.h
kj/debug.h
kj/arena.h
kj/io.h
kj/tuple.h
kj/one-of.h
kj/function.h
kj/mutex.h
kj/thread.h
kj/threadlocal.h
kj/time.h
kj/main.h
)
set(kj-parse_headers
kj/parse/common.h
kj/parse/char.h
)
add_library(kj-async add_library(kj-async
kj/async.c++ kj/async.c++
kj/async-unix.c++ kj/async-unix.c++
kj/async-io.c++ kj/async-io.c++
) )
set(kj-async_headers
kj/async-prelude.h
kj/async.h
kj/async-inl.h
kj/async-unix.h
kj/async-io.h
)
# capnp ==============================================================
add_library(capnp add_library(capnp
capnp/c++.capnp.c++ capnp/c++.capnp.c++
...@@ -41,6 +78,29 @@ add_library(capnp ...@@ -41,6 +78,29 @@ add_library(capnp
capnp/serialize.c++ capnp/serialize.c++
capnp/serialize-packed.c++ capnp/serialize-packed.c++
) )
set(capnp_headers
capnp/c++.capnp.h
capnp/common.h
capnp/blob.h
capnp/endian.h
capnp/layout.h
capnp/orphan.h
capnp/list.h
capnp/any.h
capnp/message.h
capnp/capability.h
capnp/schema.capnp.h
capnp/schema.h
capnp/schema-loader.h
capnp/schema-parser.h
capnp/dynamic.h
capnp/pretty-print.h
capnp/serialize.h
capnp/serialize-async.h
capnp/serialize-packed.h
capnp/pointer-helpers.h
capnp/generated-header-support.h
)
add_library(capnp-rpc add_library(capnp-rpc
capnp/serialize-async.c++ capnp/serialize-async.c++
...@@ -52,6 +112,16 @@ add_library(capnp-rpc ...@@ -52,6 +112,16 @@ add_library(capnp-rpc
capnp/rpc-twoparty.capnp.c++ capnp/rpc-twoparty.capnp.c++
capnp/ez-rpc.c++ capnp/ez-rpc.c++
) )
set(capnp-rpc_headers
capnp/rpc-prelude.h
capnp/rpc.h
capnp/rpc-twoparty.h
capnp/rpc.capnp.h
capnp/rpc-twoparty.capnp.h
capnp/ez-rpc.h
)
# Tools/Compilers ==============================================================
add_library(capnpc add_library(capnpc
capnp/compiler/md5.c++ capnp/compiler/md5.c++
...@@ -64,6 +134,12 @@ add_library(capnpc ...@@ -64,6 +134,12 @@ add_library(capnpc
capnp/compiler/compiler.c++ capnp/compiler/compiler.c++
capnp/schema-parser.c++ capnp/schema-parser.c++
) )
set(capnpc_headers
capnp/c++.capnp
capnp/schema.capnp
capnp/rpc.capnp
capnp/rpc-twoparty.capnp
)
add_executable(capnp-tool add_executable(capnp-tool
capnp/compiler/module-loader.c++ capnp/compiler/module-loader.c++
...@@ -84,6 +160,32 @@ add_executable(capnpc_capnp ...@@ -84,6 +160,32 @@ add_executable(capnpc_capnp
target_link_libraries(capnpc_capnp capnp kj) target_link_libraries(capnpc_capnp capnp kj)
set_target_properties(capnpc_capnp PROPERTIES OUTPUT_NAME capnpc-capnp) set_target_properties(capnpc_capnp PROPERTIES OUTPUT_NAME capnpc-capnp)
export(TARGETS capnp capnp-tool capnp-rpc capnpc capnpc_cpp capnpc_capnp kj kj-async
FILE ${CMAKE_CURRENT_BINARY_DIR}/capnp-config.cmake
)
export(PACKAGE capnp)
# Install ==============================================================
install(TARGETS capnp capnp-tool capnp-rpc capnpc capnpc_cpp capnpc_capnp kj kj-async
EXPORT capnp
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(EXPORT capnp DESTINATION lib/cmake/capnp)
# Symlink capnpc -> capnp
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink capnp ${CMAKE_INSTALL_PREFIX}/bin/capnpc)")
install(FILES ${kj_headers} DESTINATION include/kj)
install(FILES ${kj-async_headers} DESTINATION include/kj)
install(FILES ${kj-parse_headers} DESTINATION include/kj/parse)
install(FILES ${capnp_headers} DESTINATION include/capnp)
install(FILES ${capnp-rpc_headers} DESTINATION include/capnp)
install(FILES ${capnpc_headers} DESTINATION include/capnp)
# Tests ============================================================== # Tests ==============================================================
# Setup googletest build and library targets (gtest and gtest_main) # Setup googletest build and library targets (gtest and gtest_main)
......
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