diff --git a/CMakeLists.txt b/CMakeLists.txt index 40179ed4552..a2483280e79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -366,7 +367,6 @@ if (VPR_USE_EZGL STREQUAL "auto") endif() endif() - #Add the various sub-projects if(${WITH_ABC}) add_subdirectory(abc) diff --git a/libs/EXTERNAL/CMakeLists.txt b/libs/EXTERNAL/CMakeLists.txt index 548cc45551f..a0d0842ac82 100644 --- a/libs/EXTERNAL/CMakeLists.txt +++ b/libs/EXTERNAL/CMakeLists.txt @@ -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) diff --git a/libs/libarchfpga/CMakeLists.txt b/libs/libarchfpga/CMakeLists.txt index 37a07f0a771..74523097ef9 100644 --- a/libs/libarchfpga/CMakeLists.txt +++ b/libs/libarchfpga/CMakeLists.txt @@ -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}) diff --git a/libs/libvtrcapnproto/CMakeLists.txt b/libs/libvtrcapnproto/CMakeLists.txt index a362da39df0..b3246c66086 100644 --- a/libs/libvtrcapnproto/CMakeLists.txt +++ b/libs/libvtrcapnproto/CMakeLists.txt @@ -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} @@ -47,4 +100,4 @@ target_include_directories(libvtrcapnproto PUBLIC target_link_libraries(libvtrcapnproto libvtrutil CapnProto::capnp - ) +)