Skip to content

Commit bad564e

Browse files
committed
libs: capnp: fix java capnp file not found
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent b626c64 commit bad564e

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

libs/libvtrcapnproto/CMakeLists.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@ capnp_generate_cpp(CAPNP_SRCS CAPNP_HDRS
3434
if (VPR_ENABLE_INTERCHANGE)
3535
set(IC_DIR ${CMAKE_SOURCE_DIR}/libs/EXTERNAL/libinterchange/interchange)
3636
set(CAPNPC_SRC_PREFIX ${IC_DIR})
37+
38+
find_program(WGET wget REQUIRED)
39+
40+
# Add Java schema
41+
set(JAVA_SCHEMA ${CMAKE_CURRENT_BINARY_DIR}/schema/capnp/java.capnp)
42+
add_custom_command(
43+
OUTPUT ${JAVA_SCHEMA}
44+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/schema/capnp/
45+
COMMAND ${WGET}
46+
https://raw.githubusercontent.com/capnproto/capnproto-java/master/compiler/src/main/schema/capnp/java.capnp
47+
-O ${JAVA_SCHEMA}
48+
)
49+
50+
add_custom_target(
51+
get_java_capnp_schema
52+
DEPENDS ${JAVA_SCHEMA}
53+
)
54+
55+
set(CAPNPC_IMPORT_DIRS)
56+
list(APPEND CAPNPC_IMPORT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/schema)
57+
3758
set(IC_PROTOS
3859
LogicalNetlist.capnp
3960
PhysicalNetlist.capnp
@@ -50,8 +71,8 @@ if (VPR_ENABLE_INTERCHANGE)
5071
)
5172
list(APPEND IC_SRCS ${IC_SRC})
5273
list(APPEND IC_HDRS ${IC_HDR})
74+
list(APPEND CAPNP_DEFS ${IC_DIR}/${PROTO})
5375
endforeach()
54-
5576
endif()
5677

5778
install(FILES ${CAPNP_DEFS} DESTINATION ${CMAKE_INSTALL_DATADIR}/vtr)
@@ -64,6 +85,13 @@ add_library(libvtrcapnproto STATIC
6485
serdes_utils.h
6586
serdes_utils.cpp
6687
)
88+
89+
if (VPR_ENABLE_INTERCHANGE)
90+
add_dependencies(libvtrcapnproto
91+
get_java_capnp_schema
92+
)
93+
endif()
94+
6795
target_include_directories(libvtrcapnproto PUBLIC
6896
${CMAKE_CURRENT_SOURCE_DIR}
6997
${CMAKE_CURRENT_BINARY_DIR}

0 commit comments

Comments
 (0)