Skip to content

CMake: add initial interchange schema sources compilation #1870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ option(VTR_ENABLE_CAPNPROTO "Enable capnproto binary serialization support in VP
#Allow the user to enable/disable VPR analytic placement
#VPR option --enable_analytic_placer is also required for Analytic Placement
option(VPR_ANALYTIC_PLACE "Enable analytic placement in VPR." ON)
option(VPR_ENABLE_INTERCHANGE "Enable FPGA interchange." ON)

option(WITH_BLIFEXPLORER "Enable build with blifexplorer" OFF)

Expand Down Expand Up @@ -366,7 +367,6 @@ if (VPR_USE_EZGL STREQUAL "auto")
endif()
endif()


#Add the various sub-projects
if(${WITH_ABC})
add_subdirectory(abc)
Expand Down
2 changes: 1 addition & 1 deletion libs/EXTERNAL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ add_subdirectory(libsdcparse)
add_subdirectory(libblifparse)
add_subdirectory(libtatum)

#VPR_USE_EZGL is initialized in the root CMakeLists.
#VPR_USE_EZGL is initialized in the root CMakeLists.
#compile libezgl only if the user asks for or has its dependencies installed.
if(VPR_USE_EZGL STREQUAL "on")
add_subdirectory(libezgl)
Expand Down
13 changes: 10 additions & 3 deletions libs/libarchfpga/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@ list(REMOVE_ITEM LIB_SOURCES ${EXEC_SOURCES})

#Create the library
add_library(libarchfpga STATIC
${LIB_HEADERS}
${LIB_SOURCES})
${LIB_HEADERS}
${LIB_SOURCES}
)

target_include_directories(libarchfpga PUBLIC ${LIB_INCLUDE_DIRS})

set_target_properties(libarchfpga PROPERTIES PREFIX "") #Avoid extra 'lib' prefix

#Specify link-time dependancies
target_link_libraries(libarchfpga
libvtrutil
libpugixml
libpugiutil)
libpugiutil
libvtrcapnproto
)

target_compile_definitions(libarchfpga PUBLIC ${INTERCHANGE_SCHEMA_HEADERS})

#Create the test executable
add_executable(read_arch ${EXEC_SOURCES})
Expand Down
57 changes: 55 additions & 2 deletions libs/libvtrcapnproto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,73 @@ set(CAPNP_DEFS
gen/rr_graph_uxsdcxx.capnp
map_lookahead.capnp
extended_map_lookahead.capnp
)
)

capnp_generate_cpp(CAPNP_SRCS CAPNP_HDRS
${CAPNP_DEFS}
)

if (VPR_ENABLE_INTERCHANGE)
set(IC_DIR ${CMAKE_SOURCE_DIR}/libs/EXTERNAL/libinterchange/interchange)
set(CAPNPC_SRC_PREFIX ${IC_DIR})

find_program(WGET wget REQUIRED)

# Add Java schema
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(IC_PROTOS
LogicalNetlist.capnp
PhysicalNetlist.capnp
DeviceResources.capnp
References.capnp
)
set(IC_SRCS)
set(IC_HDRS)
foreach(PROTO ${IC_PROTOS})
capnp_generate_cpp(
IC_SRC
IC_HDR
${IC_DIR}/${PROTO}
)
list(APPEND IC_SRCS ${IC_SRC})
list(APPEND IC_HDRS ${IC_HDR})
list(APPEND CAPNP_DEFS ${IC_DIR}/${PROTO})
endforeach()
endif()

install(FILES ${CAPNP_DEFS} DESTINATION ${CMAKE_INSTALL_DATADIR}/vtr)

add_library(libvtrcapnproto STATIC
${CAPNP_SRCS}
${IC_SRCS}
mmap_file.h
mmap_file.cpp
serdes_utils.h
serdes_utils.cpp
)

if (VPR_ENABLE_INTERCHANGE)
add_dependencies(libvtrcapnproto
get_java_capnp_schema
)
endif()

target_include_directories(libvtrcapnproto PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
Expand All @@ -47,4 +100,4 @@ target_include_directories(libvtrcapnproto PUBLIC
target_link_libraries(libvtrcapnproto
libvtrutil
CapnProto::capnp
)
)