Skip to content

Commit 8c0adba

Browse files
committed
[Infra]: - adding "update_submodules" option to the main VTR makefile
- adding "vtr-submodules.sh" to github scripts - changing Surelog custom target to an external project Signed-off-by: Seyed Alireza Damghani <sdamghan@unb.ca>
1 parent 299fc57 commit 8c0adba

File tree

5 files changed

+65
-37
lines changed

5 files changed

+65
-37
lines changed

.github/scripts/install_dependencies.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ sudo apt install -y \
3939
valgrind \
4040
zip \
4141
qt5-default \
42+
default-jdk \
4243
clang-format-7 \
4344
g++-7 \
4445
gcc-7 \

.github/scripts/run-vtr.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ if ! { [ $VTR_TEST == "vtr_reg_strong" ] || [ $VTR_TEST == "odin_reg_strong" ] \
1313
source $SCRIPT_DIR/vtr-full-setup.sh
1414
fi
1515

16+
# Update VtR submodules
17+
source $SCRIPT_DIR/vtr-submodules.sh
1618
# Build VtR
1719
source $SCRIPT_DIR/vtr-build.sh
1820
# Run the reg test.

.github/scripts/vtr-submodules.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
echo
4+
echo "========================================"
5+
echo "VtR Submodules Update"
6+
echo "----------------------------------------"
7+
8+
# Update GitHub submodules of Yosys plugins
9+
if { [ $VTR_TEST == "vtr_reg_yosys" ] || [ $VTR_TEST == "vtr_reg_yosys_odin" ]; }; then
10+
make update_submodules
11+
fi

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export CTEST_OUTPUT_ON_FAILURE=TRUE
5959
#For a BUILD_TYPE without 'pgo', a single stage (non-pgo) compilation is performed.
6060

6161
#Forward any targets that are not named 'distclean' or 'clean' to the generated Makefile
62+
ifneq ($(MAKECMDGOALS),update_submodules)
6263
ifneq ($(MAKECMDGOALS),distclean)
6364
ifneq ($(MAKECMDGOALS),clean)
6465
all $(MAKECMDGOALS):
@@ -69,12 +70,6 @@ ifeq ($(CMAKE),)
6970
$(error Required 'cmake' executable not found. On debian/ubuntu try 'sudo apt-get install cmake' to install)
7071
endif
7172
@ mkdir -p $(BUILD_DIR)
72-
73-
ifneq (,$(findstring -DYOSYS_SV_UHDM_PLUGIN=ON,$(CMAKE_PARAMS)))
74-
@echo "Performing Git Submodule Recursive Update on the VTR Submodules..."
75-
git submodule update --init --recursive
76-
endif
77-
7873
ifneq (,$(findstring pgo,$(BUILD_TYPE)))
7974
#
8075
#Profile Guided Optimization Build
@@ -114,6 +109,12 @@ endif #BUILD_TYPE
114109
@+$(MAKE) -C $(BUILD_DIR) $(MAKECMDGOALS)
115110
endif #clean
116111
endif #distclean
112+
endif #update_submodules
113+
114+
# Update GitHub submodules exist in VTR repository
115+
update_submodules:
116+
@echo "Performing Git Submodule Recursive Update on the VTR Submodules..."
117+
git submodule update --init --recursive
117118

118119
#Call the generated Makefile's clean, and then remove all cmake generated files
119120
distclean: clean

libs/EXTERNAL/CMakeLists.txt

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include(ExternalProject)
2+
13
#Manually synchronized external libraries
24
add_subdirectory(libpugixml)
35

@@ -31,39 +33,50 @@ if(${ODIN_USE_YOSYS} OR ${WITH_YOSYS})
3133
set(YOSYS_DATDIR ${libyosys_BINARY_DIR}/share/yosys)
3234
# keep record of the yosys-uhdm-plugin-integration path
3335
set(SURELOG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Surelog)
36+
set(SURELOG_BINARY_DIR ${SURELOG_SOURCE_DIR}/build)
3437
set(YOSYS_F4PGA_PLUGINS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/yosys-f4pga-plugins)
3538

36-
# building Surelog and UHDM in a custom command to avoid any target conflict with VTR targets
37-
add_custom_command( OUTPUT ${libyosys_BINARY_DIR}/bin/surelog ${libyosys_BINARY_DIR}/bin/uhdm-dump ${libyosys_BINARY_DIR}/bin/uhdm-hier DEPENDS yosys
38-
# Surelog
39-
COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release
40-
-DCMAKE_INSTALL_PREFIX=${libyosys_BINARY_DIR}
41-
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
42-
-S ${SURELOG_SOURCE_DIR}
43-
-B ${SURELOG_SOURCE_DIR}/build
44-
-Wno-deprecated
45-
> /dev/null 2>&1
46-
COMMAND ${CMAKE_COMMAND} --build ${SURELOG_SOURCE_DIR}/build
47-
-j${CMAKE_BUILD_PARALLEL_LEVEL}
48-
> /dev/null 2>&1
49-
COMMAND ${CMAKE_COMMAND} --install ${SURELOG_SOURCE_DIR}/build
50-
> /dev/null 2>&1
51-
# UHDM
52-
COMMAND ${MAKE_PROGRAM} -C ${YOSYS_F4PGA_PLUGINS_SOURCE_DIR}
53-
PATH=${libyosys_BINARY_DIR}/bin/:$ENV{PATH}
54-
UHDM_INSTALL_DIR=${libyosys_BINARY_DIR}
55-
install
56-
-j${CMAKE_BUILD_PARALLEL_LEVEL}
57-
> /dev/null 2>&1
58-
59-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
60-
61-
# create a custom target out of the plugins compilation result
62-
add_custom_target(yosys-plugins ALL
63-
DEPENDS
64-
${libyosys_BINARY_DIR}/bin/surelog
65-
${libyosys_BINARY_DIR}/bin/uhdm-dump
66-
${libyosys_BINARY_DIR}/bin/uhdm-hier)
39+
ExternalProject_Add(surelog
40+
# root directory for Surelog project
41+
PREFIX ""
42+
43+
# setting source, build and install directories
44+
SOURCE_DIR "${SURELOG_SOURCE_DIR}"
45+
# BINARY_DIR "${SURELOG_BINARY_DIR}"
46+
BUILD_IN_SOURCE ON
47+
INSTALL_DIR "${SURELOG_BINARY_DIR}"
48+
49+
# define Surelog cache values
50+
CMAKE_CACHE_DEFAULT_ARGS
51+
"-DCMAKE_BUILD_TYPE:STRING=Release"
52+
"-DCMAKE_INSTALL_PREFIX:FILEPATH=${libyosys_BINARY_DIR}"
53+
"-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON"
54+
"-DCMAKE_WARN_DEPRECATED:BOOL=OFF"
55+
56+
# redirect logs to a logfile
57+
LOG_BUILD ON
58+
LOG_UPDATE ON
59+
LOG_INSTALL ON
60+
LOG_DOWNLOAD ON
61+
LOG_CONFIGURE ON
62+
LOG_OUTPUT_ON_FAILURE ON
63+
64+
# usefull flags
65+
EXCLUDE_FROM_ALL ON
66+
DEPENDS yosys
67+
)
68+
69+
# building Surelog and UHDM in a custom target to avoid any target conflict with VTR targets
70+
add_custom_target(yosys-plugins ALL DEPENDS surelog yosys
71+
# uhdm
72+
COMMAND ${MAKE_PROGRAM} -C ${YOSYS_F4PGA_PLUGINS_SOURCE_DIR}
73+
PATH=${libyosys_BINARY_DIR}/bin/:$ENV{PATH}
74+
UHDM_INSTALL_DIR=${libyosys_BINARY_DIR}
75+
install
76+
-j${CMAKE_BUILD_PARALLEL_LEVEL}
77+
78+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
79+
)
6780
endif()
6881

6982
# In addition to libyosys in the build folder, we copy the libyosys directory

0 commit comments

Comments
 (0)