Overriding variables used in yosys-plugins Makefile

This commit is contained in:
Lalit Sharma 2021-03-25 03:14:16 -07:00
parent b4da61b4ae
commit 11c9e59006
3 changed files with 49 additions and 11 deletions

View File

@ -231,25 +231,36 @@ include(CheckCXXCompilerFlag)
# run makefile provided, we pass-on the options to the local make file
add_custom_target(
yosys ALL
COMMAND rm -rf ${CMAKE_CURRENT_SOURCE_DIR}/yosys/install
COMMAND $(MAKE) config-gcc
COMMAND $(MAKE) install PREFIX=$ENV{OPENFPGA_PATH}/yosys/install
COMMAND $(MAKE) install PREFIX=${CMAKE_CURRENT_SOURCE_DIR}/yosys/install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/yosys
COMMENT "Compile Yosys with given Makefile"
COMMENT "Compile Yosys with given Makefile: ${CMAKE_CURRENT_SOURCE_DIR}/yosys/install"
)
# yosys compilation ends
# yosys-plugins compilation starts
add_custom_target(
YosysVariables ALL ${CMAKE_COMMAND}
-D YOSYS_INSTALL=${CMAKE_CURRENT_SOURCE_DIR}/yosys/install
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/YosysVars.cmake
COMMENT "Getting Yosys variables to use in yosys-plugins build: ${YS_CXX}"
)
add_dependencies(YosysVariables yosys)
# run makefile provided, we pass-on the options to the local make file
add_custom_target(
yosys-plugins ALL
COMMAND $(MAKE)
COMMAND $(MAKE) install
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/yosys-plugins
COMMENT "Compile Yosys-plugins with given Makefile"
COMMAND $(MAKE) CXX=${YS_CXX} CXXFLAGS=${YS_CXXFLAGS} LDFLAGS=${YS_LDFLAGS}
LDLIBS=${YS_LDLIBS} PLUGINS_DIR=${YS_DATA_DIR}/plugins DATA_DIR=${YS_DATA_DIR}
COMMAND $(MAKE) install CXX=${YS_CXX} CXXFLAGS=${YS_CXXFLAGS} LDFLAGS=${YS_LDFLAGS}
LDLIBS=${YS_LDLIBS} PLUGINS_DIR=${YS_DATA_DIR}/plugins DATA_DIR=${YS_DATA_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/yosys-plugins
COMMENT "Compile Yosys-plugins with given Makefile: ${YS_CXX}"
)
add_dependencies(yosys-plugins yosys)
#add_dependencies(yosys-plugins yosys ) #YosysVariables)
# yosys-plugins compilation ends

View File

@ -0,0 +1,31 @@
execute_process(
COMMAND ${YOSYS_INSTALL}/bin/yosys-config --cxx
OUTPUT_VARIABLE ENV{YS_CXX}
)
message(STATUS "++++++ YS_CXX: $ENV{YS_CXX}")
message(STATUS "++++++ YOSYS_INSTALL: ${YOSYS_INSTALL}")
execute_process(
COMMAND ${YOSYS_INSTALL}/bin/yosys-config --cxxflags
OUTPUT_VARIABLE YS_CXXFLAGS
)
message(STATUS "++++++ YS_CXXFLAGS: ${YS_CXXFLAGS}")
execute_process(
COMMAND ${YOSYS_INSTALL}/bin/yosys-config --ldflags
OUTPUT_VARIABLE YS_LDFLAGS
)
message(STATUS "++++++ YS_LDFLAGS: ${YS_LDFLAGS}")
execute_process(
COMMAND ${YOSYS_INSTALL}/bin/yosys-config --ldlibs
OUTPUT_VARIABLE YS_LDLIBS
)
message(STATUS "++++++ YS_LDLIBS: ${YS_LDLIBS}")
execute_process(
COMMAND ${YOSYS_INSTALL}/bin/yosys-config --datdir
OUTPUT_VARIABLE YS_DATA_DIR
)
message(STATUS "++++++ YS_DATA_DIR: ${YS_DATA_DIR}")

View File

@ -16,10 +16,6 @@ export OPENFPGA_SCRIPT_PATH="${OPENFPGA_PATH}/openfpga_flow/scripts"
export OPENFPGA_TASK_PATH="${OPENFPGA_PATH}/openfpga_flow/tasks"
if [ -z $PYTHON_EXEC ]; then export PYTHON_EXEC="python3"; fi
# Add yosys bin folder in PATH, this is required by yosys-plugins
# to install plugins in yosys folder
export PATH="${OPENFPGA_PATH}/yosys/install/bin:${PATH}"
# This function checks the path and
# raises warning if the command is not executing
# inside current OpendFPGA folder