Commit 9bca44e4 authored by Harris Hancock's avatar Harris Hancock Committed by Kenton Varda

Remove CAPNP_BUILD_TOOLS

This option was only useful when MSVC couldn't build the capnp command
line tools, so let's back it out.
parent f21d3819
......@@ -29,31 +29,11 @@ option(BUILD_TESTING "Build unit tests and enable CTest 'check' target." ON)
option(EXTERNAL_CAPNP "Use the system capnp binary, or the one specified in $CAPNP, instead of using the compiled one." OFF)
option(CAPNP_LITE "Compile Cap'n Proto in 'lite mode', in which all reflection APIs (schema.h, dynamic.h, etc.) are not included. Produces a smaller library at the cost of features. All programs built against the library must be compiled with -DCAPNP_LITE. Requires EXTERNAL_CAPNP." OFF)
if(MSVC)
option(CAPNP_BUILD_TOOLS "Build Cap'n Proto tools" OFF)
else()
option(CAPNP_BUILD_TOOLS "Build Cap'n Proto tools" ON)
endif()
mark_as_advanced(CAPNP_BUILD_TOOLS)
# TODO(msvc): This option exists purely to ease the MSVC port. As of this writing, the latest
# stable version of Visual C++ (VS2015U3) cannot build the Cap'n Proto tools, so this option
# defaults to OFF in that case. In all other cases it defaults to ON.
# Check for invalid combinations of build options
if(CAPNP_LITE AND BUILD_TESTING AND NOT EXTERNAL_CAPNP)
message(SEND_ERROR "You must set EXTERNAL_CAPNP when using CAPNP_LITE and BUILD_TESTING.")
endif()
if(NOT CAPNP_BUILD_TOOLS AND BUILD_TESTING AND NOT EXTERNAL_CAPNP)
message(SEND_ERROR "You must set EXTERNAL_CAPNP when using BUILD_TESTING but not CAPNP_BUILD_TOOLS")
if(MSVC)
message(SEND_ERROR "Note: CAPNP_BUILD_TOOLS is off because you are using MSVC, which cannot build the tools")
# If we're using MSVC, then we know the reason why CAPNP_BUILD_TOOLS is off and should help the
# user out. If we're NOT using MSVC, then the user must have explicitly set CAPNP_BUILD_TOOLS
# off, so they're on their own.
endif()
endif()
if(CAPNP_LITE)
set(CAPNP_LITE_FLAG "-DCAPNP_LITE")
# This flag is attached as PUBLIC target_compile_definition to kj target
......
......@@ -12,10 +12,8 @@
set(CapnProto_VERSION @VERSION@)
if(@CAPNP_BUILD_TOOLS@)
set(CAPNP_EXECUTABLE $<TARGET_FILE:CapnProto::capnp_tool>)
set(CAPNPC_CXX_EXECUTABLE $<TARGET_FILE:CapnProto::capnpc_cpp>)
endif()
set(CAPNP_EXECUTABLE $<TARGET_FILE:CapnProto::capnp_tool>)
set(CAPNPC_CXX_EXECUTABLE $<TARGET_FILE:CapnProto::capnpc_cpp>)
set(CAPNP_INCLUDE_DIRECTORY "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
# work around http://public.kitware.com/Bug/view.php?id=15258
......
......@@ -124,60 +124,58 @@ endif()
# Tools/Compilers ==============================================================
if(CAPNP_BUILD_TOOLS)
set(capnpc_sources
compiler/md5.c++
compiler/error-reporter.c++
compiler/lexer.capnp.c++
compiler/lexer.c++
compiler/grammar.capnp.c++
compiler/parser.c++
compiler/node-translator.c++
compiler/compiler.c++
schema-parser.c++
serialize-text.c++
)
if(NOT CAPNP_LITE)
add_library(capnpc ${capnpc_sources})
target_link_libraries(capnpc capnp kj)
install(TARGETS capnpc ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES ${capnpc_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/capnp")
endif()
set(capnpc_sources
compiler/md5.c++
compiler/error-reporter.c++
compiler/lexer.capnp.c++
compiler/lexer.c++
compiler/grammar.capnp.c++
compiler/parser.c++
compiler/node-translator.c++
compiler/compiler.c++
schema-parser.c++
serialize-text.c++
)
if(NOT CAPNP_LITE)
add_library(capnpc ${capnpc_sources})
target_link_libraries(capnpc capnp kj)
install(TARGETS capnpc ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES ${capnpc_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/capnp")
endif()
if(NOT CAPNP_LITE)
add_executable(capnp_tool
compiler/module-loader.c++
compiler/capnp.c++
)
target_link_libraries(capnp_tool capnpc capnp kj)
set_target_properties(capnp_tool PROPERTIES OUTPUT_NAME capnp)
set_target_properties(capnp_tool PROPERTIES CAPNP_INCLUDE_DIRECTORY
$<JOIN:$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>,$<INSTALL_INTERFACE:${CMAKE_INSTALL_BINDIR}/..>>
)
if(NOT CAPNP_LITE)
add_executable(capnp_tool
compiler/module-loader.c++
compiler/capnp.c++
)
target_link_libraries(capnp_tool capnpc capnp kj)
set_target_properties(capnp_tool PROPERTIES OUTPUT_NAME capnp)
set_target_properties(capnp_tool PROPERTIES CAPNP_INCLUDE_DIRECTORY
$<JOIN:$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>,$<INSTALL_INTERFACE:${CMAKE_INSTALL_BINDIR}/..>>
)
add_executable(capnpc_cpp
compiler/capnpc-c++.c++
)
target_link_libraries(capnpc_cpp capnp kj)
set_target_properties(capnpc_cpp PROPERTIES OUTPUT_NAME capnpc-c++)
#Capnp tool needs capnpc_cpp location. But cmake deprecated LOCATION property.
#So we use custom property to pass location
set_target_properties(capnpc_cpp PROPERTIES CAPNPC_CXX_EXECUTABLE
$<TARGET_FILE:capnpc_cpp>
)
add_executable(capnpc_cpp
compiler/capnpc-c++.c++
)
target_link_libraries(capnpc_cpp capnp kj)
set_target_properties(capnpc_cpp PROPERTIES OUTPUT_NAME capnpc-c++)
#Capnp tool needs capnpc_cpp location. But cmake deprecated LOCATION property.
#So we use custom property to pass location
set_target_properties(capnpc_cpp PROPERTIES CAPNPC_CXX_EXECUTABLE
$<TARGET_FILE:capnpc_cpp>
)
add_executable(capnpc_capnp
compiler/capnpc-capnp.c++
)
target_link_libraries(capnpc_capnp capnp kj)
set_target_properties(capnpc_capnp PROPERTIES OUTPUT_NAME capnpc-capnp)
add_executable(capnpc_capnp
compiler/capnpc-capnp.c++
)
target_link_libraries(capnpc_capnp capnp kj)
set_target_properties(capnpc_capnp PROPERTIES OUTPUT_NAME capnpc-capnp)
install(TARGETS capnp_tool capnpc_cpp capnpc_capnp ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS capnp_tool capnpc_cpp capnpc_capnp ${INSTALL_TARGETS_DEFAULT_ARGS})
# Symlink capnpc -> capnp
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink capnp \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/capnpc\")")
endif() # NOT CAPNP_LITE
endif() # CAPNP_BUILD_TOOLS
# Symlink capnpc -> capnp
install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink capnp \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/capnpc\")")
endif() # NOT CAPNP_LITE
# Tests ========================================================================
......@@ -195,12 +193,10 @@ if(BUILD_TESTING)
capnp_generate_cpp(test_capnp_cpp_files test_capnp_h_files ${test_capnp_files})
set(test_libraries capnp kj-test kj)
if(NOT CAPNP_LITE)
list(APPEND test_libraries capnp-json capnp-rpc kj-async)
endif()
if(CAPNP_BUILD_TOOLS)
list(APPEND test_libraries capnpc)
if(CAPNP_LITE)
set(test_libraries capnp kj-test kj)
else()
set(test_libraries capnp-json capnp-rpc capnp capnpc kj-async kj-test kj)
endif()
add_executable(capnp-tests
......@@ -232,12 +228,16 @@ if(BUILD_TESTING)
membrane-test.c++
schema-test.c++
schema-loader-test.c++
schema-parser-test.c++
dynamic-test.c++
stringify-test.c++
serialize-async-test.c++
serialize-text-test.c++
rpc-test.c++
rpc-twoparty-test.c++
ez-rpc-test.c++
compiler/lexer-test.c++
compiler/md5-test.c++
test-util.c++
compat/json-test.c++
${test_capnp_cpp_files}
......@@ -253,29 +253,9 @@ if(BUILD_TESTING)
add_dependencies(check capnp-heavy-tests)
add_test(NAME capnp-heavy-tests-run COMMAND capnp-heavy-tests)
if(CAPNP_BUILD_TOOLS)
add_executable(capnp-parse-tests
schema-parser-test.c++
serialize-text-test.c++
compiler/md5-test.c++
compiler/lexer-test.c++
test-util.c++
${test_capnp_cpp_files}
${test_capnp_h_files}
)
target_link_libraries(capnp-parse-tests ${test_libraries})
if(NOT MSVC)
set_target_properties(capnp-parse-tests
PROPERTIES COMPILE_FLAGS "-Wno-deprecated-declarations"
)
endif()
add_dependencies(check capnp-parse-tests)
add_test(NAME capnp-parse-tests-run COMMAND capnp-parse-tests)
add_executable(capnp-evolution-tests compiler/evolution-test.c++)
target_link_libraries(capnp-evolution-tests capnpc capnp kj)
add_dependencies(check capnp-evolution-tests)
add_test(NAME capnp-evolution-tests-run COMMAND capnp-evolution-tests)
endif() # CAPNP_BUILD_TOOLS
add_executable(capnp-evolution-tests compiler/evolution-test.c++)
target_link_libraries(capnp-evolution-tests capnpc capnp kj)
add_dependencies(check capnp-evolution-tests)
add_test(NAME capnp-evolution-tests-run COMMAND capnp-evolution-tests)
endif() # NOT CAPNP_LITE
endif() # BUILD_TESTING
......@@ -19,16 +19,12 @@ set(kj_sources_heavy
units.c++
refcount.c++
string-tree.c++
)
set(kj-parse_sources
parse/char.c++
)
set(kj_sources ${kj_sources_lite})
if(NOT CAPNP_LITE)
list(APPEND kj_sources ${kj_sources_heavy})
endif()
if(CAPNP_BUILD_TOOLS)
list(APPEND kj_sources ${kj-parse_sources})
set(kj_sources ${kj_sources_lite} ${kj_sources_heavy})
else()
set(kj_sources ${kj_sources_lite})
endif()
set(kj_headers
......@@ -177,20 +173,12 @@ if(BUILD_TESTING)
one-of-test.c++
function-test.c++
threadlocal-pthread-test.c++
parse/common-test.c++
parse/char-test.c++
compat/http-test.c++
)
target_link_libraries(kj-heavy-tests kj-http kj-async kj-test kj)
add_dependencies(check kj-heavy-tests)
add_test(NAME kj-heavy-tests-run COMMAND kj-heavy-tests)
if(CAPNP_BUILD_TOOLS)
add_executable(kj-parse-tests
parse/common-test.c++
parse/char-test.c++
)
target_link_libraries(kj-parse-tests kj-test kj)
add_dependencies(check kj-parse-tests)
add_test(NAME kj-parse-tests-run COMMAND kj-parse-tests)
endif() # CAPNP_BUILD_TOOLS
endif() # NOT CAPNP_LITE
endif() # BUILD_TESTING
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