diff options
author | litghost <537074+litghost@users.noreply.github.com> | 2021-02-15 09:06:43 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-15 09:06:43 -0800 |
commit | 17ab90f8cd3f3407ebbcd8be946e25bac22488db (patch) | |
tree | c3d4db2336a886a2ebb07295d45c117e7cb415dc | |
parent | 6d450bd3e14fdbf180f64e4f3585ec3c7427ddb3 (diff) | |
parent | e9ebc16e84a352fdbe1738085294b9469dccc857 (diff) | |
download | fpga-interchange-schema-17ab90f8cd3f3407ebbcd8be946e25bac22488db.tar.gz fpga-interchange-schema-17ab90f8cd3f3407ebbcd8be946e25bac22488db.tar.bz2 fpga-interchange-schema-17ab90f8cd3f3407ebbcd8be946e25bac22488db.zip |
Merge pull request #6 from litghost/add_cmake_for_schema_files
Add CMake file to build static library.
-rw-r--r-- | cmake/cxx_static/CMakeLists.txt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cmake/cxx_static/CMakeLists.txt b/cmake/cxx_static/CMakeLists.txt new file mode 100644 index 0000000..99c9482 --- /dev/null +++ b/cmake/cxx_static/CMakeLists.txt @@ -0,0 +1,35 @@ +find_package(CapnProto REQUIRED) +set(PROTOS LogicalNetlist.capnp PhysicalNetlist.capnp References.capnp) + +set(INTERCHANGE_SCHEMA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../interchange) + +find_program(WGET wget REQUIRED) + +set(JAVA_SCHEMA ${CMAKE_CURRENT_BINARY_DIR}/schema/capnp/java.capnp) +add_custom_command( + OUTPUT ${JAVA_SCHEMA} + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/schema/capnp/ + COMMAND ${WGET} + https://raw.githubusercontent.com/capnproto/capnproto-java/master/compiler/src/main/schema/capnp/java.capnp + -O ${JAVA_SCHEMA} + ) +add_custom_target( + get_java_capnp_schema + DEPENDS ${JAVA_SCHEMA}) + +set(CAPNPC_IMPORT_DIRS) +list(APPEND CAPNPC_IMPORT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/schema) + +set(CAPNPC_SRC_PREFIX ${INTERCHANGE_SCHEMA_DIR}) +set(CAPNP_SRCS) +set(CAPNP_HDRS) +foreach (proto ${PROTOS}) + capnp_generate_cpp(CAPNP_SRC CAPNP_HDR ${INTERCHANGE_SCHEMA_DIR}/${proto}) + list(APPEND CAPNP_HDRS ${CAPNP_HDR}) + list(APPEND CAPNP_SRCS ${CAPNP_SRC}) +endforeach() +add_library(fpga_interchange_capnp STATIC ${CAPNP_SRCS}) +add_dependencies(fpga_interchange_capnp get_java_capnp_schema) +target_link_libraries(fpga_interchange_capnp PRIVATE CapnProto::capnp) + +set(FPGA_INTERCHANGE_CAPNP_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/../../interchange) |