@@ -27,9 +27,10 @@ endif ()
2727
2828# The VTR root CMakeFile initializes the WITH_PARMYS
2929if (${WITH_PARMYS} )
30- # building Surelog and UHDM in a custom target to avoid any target conflict with VTR targets
31- if (${YOSYS_F4PGA_PLUGINS} )
32- set (SURELOG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} /Surelog)
30+
31+ if (${WITH_PARMYS} )
32+
33+ set (SURELOG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} /Surelog)
3334 set (SURELOG_BINARY_DIR ${SURELOG_SOURCE_DIR} /build )
3435 set (YOSYS_F4PGA_PLUGINS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} /yosys-f4pga-plugins)
3536
@@ -65,71 +66,86 @@ if (${WITH_PARMYS})
6566 DEPENDS yosys
6667 )
6768
68- ExternalProject_Add(f4pga-plugins
69- # root directory for the Yosys-F4PGA-Plugins project
70- PREFIX "f4pga-plugins"
71-
72- GIT_REPOSITORY https://github.com/chipsalliance/yosys-f4pga-plugins.git
73- GIT_TAG v1.20230808
74- GIT_PROGRESS TRUE
75- GIT_SHALLOW TRUE
76-
77- # setting source, build and install directories
78- SOURCE_DIR "${YOSYS_F4PGA_PLUGINS_SOURCE_DIR} "
79- BUILD_IN_SOURCE FALSE
80- INSTALL_DIR ""
81-
82- INSTALL_COMMAND ""
83- CONFIGURE_COMMAND ""
84- BUILD_COMMAND ${MAKE_PROGRAM} -C ${YOSYS_F4PGA_PLUGINS_SOURCE_DIR}
85- PATH =${CMAKE_BINARY_DIR} /bin/:$ENV{PATH}
86- UHDM_INSTALL_DIR=${CMAKE_BINARY_DIR}
87- BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR} /f4pga-plugins/$(NAME ) # NAME will be resolved by yosys-f4pga-plugins Make
88- YOSYS_PATH=${CMAKE_BINARY_DIR}
89- install -j${CUSTOM_BUILD_PARALLEL_LEVEL}
90-
91- # redirect logs to a logfile
92- LOG_BUILD ON
93- LOG_UPDATE ON
94- LOG_INSTALL ON
95- LOG_CONFIGURE OFF
96- LOG_OUTPUT_ON_FAILURE ON
97-
98- # dependency
99- DEPENDS surelog yosys
100- )
69+ # Synlig integration (manages Surelog and UHDM internally)
70+
71+ # Synlig integration (manages Surelog and UHDM internally)
72+ set (SYNLIG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} /synlig)
73+
74+ # Clone Synlig repository and ensure submodules are synced before building
75+ ExternalProject_Add(synlig
76+ PREFIX "synlig"
77+
78+ # Clone the Synlig repository
79+ GIT_REPOSITORY https://github.com/chipsalliance/synlig.git
80+ GIT_TAG main
81+ GIT_PROGRESS TRUE
82+ GIT_SHALLOW TRUE
83+
84+ # Set source and build directories
85+ SOURCE_DIR "${SYNLIG_SOURCE_DIR} "
86+ BUILD_IN_SOURCE FALSE
87+ INSTALL_DIR " "
88+
89+ # Sync submodules after cloning
90+ UPDATE_COMMAND git submodule update --init --recursive third_party/surelog
91+ WORKING_DIRECTORY ${SYNLIG_SOURCE_DIR}
92+
93+
94+ BUILD_COMMAND ${MAKE_PROGRAM} -C ${SYNLIG_SOURCE_DIR} install DESTDIR=${CMAKE_BINARY_DIR} /bin/synlig_install -j$(nproc)#${CUSTOM_BUILD_PARALLEL_LEVEL}
95+ INSTALL_COMMAND ""
96+ CONFIGURE_COMMAND ""
97+
98+ # Pass necessary paths and set environment variables
99+ CMAKE_CACHE_ARGS
100+ "-DCMAKE_BUILD_TYPE:STRING=Release"
101+ "-DSURELOG_PATH=${CMAKE_BINARY_DIR} /surelog"
102+ "-DYOSYS_PATH=${CMAKE_BINARY_DIR} /yosys"
103+ "-DUHDM_INSTALL_DIR=${CMAKE_BINARY_DIR} "
104+ "-DBUILD_DIR=${CMAKE_BINARY_DIR} /synlig-build"
105+ "-DEXPORT_PATH=${CMAKE_BINARY_DIR} /synlig_install/usr/local/bin:$ENV{PATH} "
106+
107+ LOG_BUILD ON
108+ LOG_UPDATE ON
109+ LOG_INSTALL ON
110+ LOG_CONFIGURE OFF
111+ LOG_OUTPUT_ON_FAILURE ON
112+
113+ # Ensure dependencies like Yosys are built first
114+ DEPENDS yosys # Ensure submodule sync runs before synlig build
115+ )
116+
117+ endif ()
101118 endif ()
102119
103- endif ()
104120
105- if (${VTR_ENABLE_CAPNPROTO} )
106- # Override default policy for capnproto (CMake policy version 3.1)
107- # Enable new IPO variables
108- set (CMAKE_POLICY_DEFAULT_CMP0069 NEW)
121+ if (${VTR_ENABLE_CAPNPROTO} )
122+ # Override default policy for capnproto (CMake policy version 3.1)
123+ # Enable new IPO variables
124+ set (CMAKE_POLICY_DEFAULT_CMP0069 NEW)
109125
110- # Enable option overrides via variables
111- set (CMAKE_POLICY_DEFAULT_CMP0077 NEW)
126+ # Enable option overrides via variables
127+ set (CMAKE_POLICY_DEFAULT_CMP0077 NEW)
112128
113- # Re-enable CXX extensions for capnproto.
114- set (CMAKE_CXX_EXTENSIONS ON )
129+ # Re-enable CXX extensions for capnproto.
130+ set (CMAKE_CXX_EXTENSIONS ON )
115131
116- # Disable capnproto tests
117- set (BUILD_TESTING OFF )
132+ # Disable capnproto tests
133+ set (BUILD_TESTING OFF )
118134
119- #Since capnproto is an externally developed library/tool, we suppress all compiler warnings
120- CHECK_CXX_COMPILER_FLAG("-w" CXX_COMPILER_SUPPORTS_-w)
121- if (CXX_COMPILER_SUPPORTS_-w)
122- add_compile_options ("-w" )
123- endif ()
135+ #Since capnproto is an externally developed library/tool, we suppress all compiler warnings
136+ CHECK_CXX_COMPILER_FLAG("-w" CXX_COMPILER_SUPPORTS_-w)
137+ if (CXX_COMPILER_SUPPORTS_-w)
138+ add_compile_options ("-w" )
139+ endif ()
124140
125- add_subdirectory (capnproto EXCLUDE_FROM_ALL )
141+ add_subdirectory (capnproto EXCLUDE_FROM_ALL )
126142
127- #Some capnproto kj headers (e.g. filesystem.h) generate warnings, treat them as system headers to suppress warnings
128- #We suppress them here since we include the capnproto sub-tree as is and do not modify its CMakeLists.txts
129- target_include_directories (kj SYSTEM INTERFACE
130- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /capnproto/c++/src>
131- $<INSTALL_INTERFACE:include >
132- )
143+ #Some capnproto kj headers (e.g. filesystem.h) generate warnings, treat them as system headers to suppress warnings
144+ #We suppress them here since we include the capnproto sub-tree as is and do not modify its CMakeLists.txts
145+ target_include_directories (kj SYSTEM INTERFACE
146+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /capnproto/c++/src>
147+ $<INSTALL_INTERFACE:include >
148+ )
133149endif ()
134150
135151# Some catch2 headers generate warnings, so treat them as system headers to suppress warnings
0 commit comments