Skip to content

Commit c280b3f

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

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
@@ -32,6 +32,27 @@ capnp_generate_cpp(CAPNP_SRCS CAPNP_HDRS
3232
if (VPR_ENABLE_INTERCHANGE)
3333
set(IC_DIR ${CMAKE_SOURCE_DIR}/libs/EXTERNAL/libinterchange/interchange)
3434
set(CAPNPC_SRC_PREFIX ${IC_DIR})
35+
36+
find_program(WGET wget REQUIRED)
37+
38+
# Add Java schema
39+
set(JAVA_SCHEMA ${CMAKE_CURRENT_BINARY_DIR}/schema/capnp/java.capnp)
40+
add_custom_command(
41+
OUTPUT ${JAVA_SCHEMA}
42+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/schema/capnp/
43+
COMMAND ${WGET}
44+
https://raw.githubusercontent.com/capnproto/capnproto-java/master/compiler/src/main/schema/capnp/java.capnp
45+
-O ${JAVA_SCHEMA}
46+
)
47+
48+
add_custom_target(
49+
get_java_capnp_schema
50+
DEPENDS ${JAVA_SCHEMA}
51+
)
52+
53+
set(CAPNPC_IMPORT_DIRS)
54+
list(APPEND CAPNPC_IMPORT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/schema)
55+
3556
set(IC_PROTOS
3657
LogicalNetlist.capnp
3758
PhysicalNetlist.capnp
@@ -48,8 +69,8 @@ if (VPR_ENABLE_INTERCHANGE)
4869
)
4970
list(APPEND IC_SRCS ${IC_SRC})
5071
list(APPEND IC_HDRS ${IC_HDR})
72+
list(APPEND CAPNP_DEFS ${IC_DIR}/${PROTO})
5173
endforeach()
52-
5374
endif()
5475

5576
install(FILES ${CAPNP_DEFS} DESTINATION ${CMAKE_INSTALL_DATADIR}/vtr)
@@ -62,6 +83,13 @@ add_library(libvtrcapnproto STATIC
6283
serdes_utils.h
6384
serdes_utils.cpp
6485
)
86+
87+
if (VPR_ENABLE_INTERCHANGE)
88+
add_dependencies(libvtrcapnproto
89+
get_java_capnp_schema
90+
)
91+
endif()
92+
6593
target_include_directories(libvtrcapnproto PUBLIC
6694
${CMAKE_CURRENT_SOURCE_DIR}
6795
${CMAKE_CURRENT_BINARY_DIR}

0 commit comments

Comments
 (0)