Skip to content
Merged
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
78 changes: 62 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ concurrency:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
MAKEFLAGS: "-j8"
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
# (Boolean) Setting this value to True, will force linux tet always
IGNORE_DOCKER_TEST: ${{ secrets.IGNORE_DOCKER_TEST }}
Expand Down Expand Up @@ -93,7 +92,7 @@ jobs:
cxx: g++
os: MINGW64
prefix: mingw64
cmake_flags: "-DOPENFPGA_WITH_YOSYS=OFF -DWITH_ABC=OFF"
cmake_flags: "-DOPENFPGA_WITH_YOSYS=ON -DWITH_ABC=OFF -DOPENFPGA_WITH_SLANG=OFF"
defaults:
run:
# This ensures all 'run' steps use the MSYS2 bash shell by default
Expand Down Expand Up @@ -209,7 +208,7 @@ jobs:
cxx: g++
os: MINGW64
prefix: mingw64
cmake_flags: "-DOPENFPGA_WITH_YOSYS=OFF -DWITH_ABC=OFF"
cmake_flags: "-DOPENFPGA_WITH_YOSYS=ON -DWITH_ABC=OFF -DOPENFPGA_WITH_SLANG=OFF"
defaults:
run:
# This ensures all 'run' steps use the MSYS2 bash shell by default
Expand Down Expand Up @@ -606,11 +605,18 @@ jobs:
${CXX} --version

- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores

- name: Build
shell: bash
run: |
make all BUILD_TYPE=$BUILD_TYPE
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make all BUILD_TYPE=$BUILD_TYPE -j${{ steps.cpu-cores.outputs.count}}

- name: Clear error log
if: ${{ failure() }}
Expand Down Expand Up @@ -658,10 +664,10 @@ jobs:
cc: gcc-11
cxx: g++-11
cmake_flags: "-DOPENFPGA_WITH_YOSYS=OFF"
- name: "Build w/o Yosys plugin (Ubuntu 22.04)"
- name: "Build w/o Yosys Slang (Ubuntu 22.04)"
cc: gcc-11
cxx: g++-11
cmake_flags: "-DOPENFPGA_WITH_YOSYS_PLUGIN=OFF"
cmake_flags: "-DOPENFPGA_WITH_SLANG=OFF"
- name: "Build w/o test (Ubuntu 22.04)"
cc: gcc-11
cxx: g++-11
Expand Down Expand Up @@ -701,11 +707,18 @@ jobs:
${CXX} --version

- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores

- name: Build
shell: bash
run: |
make all BUILD_TYPE=$BUILD_TYPE CMAKE_FLAGS="${{ matrix.config.cmake_flags }}"
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make all BUILD_TYPE=$BUILD_TYPE CMAKE_FLAGS="${{ matrix.config.cmake_flags }}" -j${{ steps.cpu-cores.outputs.count}}

centos_support:
needs: change_detect
Expand Down Expand Up @@ -740,12 +753,19 @@ jobs:
${CXX} --version

- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores

- name: Build
shell: bash
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
git config --global --add safe.directory '*'
make all BUILD_TYPE=$BUILD_TYPE
make all BUILD_TYPE=$BUILD_TYPE -j${{ steps.cpu-cores.outputs.count}}

# Support 24.04
ubuntu_support:
Expand Down Expand Up @@ -787,11 +807,18 @@ jobs:
python3 --version

- uses: hendrikmuhs/ccache-action@v1.2

with:
key: ${{ github.job }}

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores

- name: Build
shell: bash
run: |
make all BUILD_TYPE=$BUILD_TYPE
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make all BUILD_TYPE=$BUILD_TYPE -j${{ steps.cpu-cores.outputs.count}}

- name: Quick Test
shell: bash
Expand All @@ -813,7 +840,6 @@ jobs:
cc: gcc-13
cxx: g++-13
build_type: debug
cores: 4
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
Expand Down Expand Up @@ -841,11 +867,18 @@ jobs:
python3 --version

- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores

- name: Build
shell: bash
run: |
make all BUILD_TYPE=${{ matrix.config.build_type }} -j ${{ matrix.config.cores }}
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make all BUILD_TYPE=${{ matrix.config.build_type }} -j${{ steps.cpu-cores.outputs.count}}

- name: Quick Test
shell: bash
Expand All @@ -865,7 +898,6 @@ jobs:
cc: gcc-11
cxx: g++-11
build_type: release
cores: 4
# Define the steps to run the build job
env:
CC: ${{ matrix.config.cc }}
Expand All @@ -892,11 +924,18 @@ jobs:
${CXX} --version

- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores

- name: Build
shell: bash
run: |
make all BUILD_TYPE=${{ matrix.config.build_type }} -j ${{ matrix.config.cores }} CMAKE_FLAGS="-DOPENFPGA_ENABLE_STRICT_COMPILE=ON"
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make all BUILD_TYPE=${{ matrix.config.build_type }} -j${{ steps.cpu-cores.outputs.count}} CMAKE_FLAGS="-DOPENFPGA_ENABLE_STRICT_COMPILE=ON"

- name: Quick Test
shell: bash
Expand Down Expand Up @@ -942,13 +981,20 @@ jobs:
${CXX} --version

- uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}

- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v3
id: cpu-cores

- name: Build
shell: bash
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make checkout
make prebuild BUILD_TYPE=$BUILD_TYPE INSTALL_DOC=OFF
make installer BUILD_TYPE=$BUILD_TYPE INSTALL_DOC=OFF
make prebuild BUILD_TYPE=$BUILD_TYPE INSTALL_DOC=OFF -j${{ steps.cpu-cores.outputs.count}}
make installer BUILD_TYPE=$BUILD_TYPE INSTALL_DOC=OFF -j${{ steps.cpu-cores.outputs.count}}

docker_distribution:
name: Build docker image for distribution
Expand Down
86 changes: 52 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ include(CheckCXXCompilerFlag)
# Options
## General options
option(OPENFPGA_WITH_YOSYS "Enable building Yosys" ON)
option(OPENFPGA_WITH_YOSYS_PLUGIN "Enable building Yosys plugin" ON)
option(OPENFPGA_WITH_SLANG "Enable building Yosys Slang plugin" ON)
option(OPENFPGA_WITH_TEST "Enable testing build for codebase. Once enabled, make test can be run" ON)
option(OPENFPGA_WITH_VERSION "Enable version always-up-to-date when building codebase. Disable only when you do not care an accurate version number" ON)
option(OPENFPGA_WITH_SWIG "Enable SWIG interface when building codebase. Disable when you do not need high-level interfaces, such as Tcl/Python" ON)
Expand Down Expand Up @@ -349,6 +349,41 @@ if(CXX_COMPILER_SUPPORTS_-Wimplicit-fallthrough=0)
target_compile_options(libpugixml PRIVATE "-Wimplicit-fallthrough=0")
endif()

# Only patch abc makefile on Msys2 where linker complains
# Find the Python 3 interpreter
find_package(Python3 REQUIRED COMPONENTS Interpreter)
if (DEFINED ENV{MSYSTEM})
set(PY_PATCH_ABC_MAKEFILE "${CMAKE_CURRENT_SOURCE_DIR}/dev/patch_abc_makefile.py")
set(ABC_MAKEFILE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/yosys/abc")
set(ABC_MAKEFILE_FPATH "Makefile")
set(ABC_MAKEFILE_PATCH_FPATH "Makefile.patched")
message(STATUS "Patching ${ABC_MAKEFILE_DIR}/${ABC_MAKEFILE_FPATH}")
add_custom_command(
OUTPUT ${ABC_MAKEFILE_PATCH_FPATH}
COMMAND "${Python3_EXECUTABLE}" "${PY_PATCH_ABC_MAKEFILE}" "${ABC_MAKEFILE_FPATH}"
COMMAND ${CMAKE_COMMAND} -E touch ${ABC_MAKEFILE_PATCH_FPATH}
COMMENT "Apply sed patch to ${ABC_MAKEFILE_DIR}/${ABC_MAKEFILE_FPATH} for long linker command fix"
DEPENDS "${PY_PATCH_ABC_MAKEFILE}"
VERBATIM
WORKING_DIRECTORY "${ABC_MAKEFILE_DIR}"
)
add_custom_target(patch_abc_makefile ALL DEPENDS ${ABC_MAKEFILE_PATCH_FPATH})
endif()

# Once Yosys adapts to CMake. This will be much simplified
# Yosys build options
set(YOSYS_CONFIG_OPTION "config-gcc" CACHE STRING "Yosys configuration on environment")
set(YOSYS_BUILD_OPTION "ENABLE_CCACHE=1" CACHE STRING "Yosys build options")
set(SLANG_BUILD_CONFIG "" CACHE STRING "Slang build configuration on environment")
set(SLANG_CMAKE_CONFIG "" CACHE STRING "Slang cmake configuration on environment")
if (DEFINED ENV{MSYSTEM})
message(STATUS "Build Yosys in an MSYS2 MinGW-w64 environment")
set(YOSYS_CONFIG_OPTION "config-msys2-64" CACHE STRING "Yosys configuration on environment" FORCE)
set(YOSYS_BUILD_OPTION "DISABLE_ABC_THREADS=1 ENABLE_CCACHE=1" CACHE STRING "Yosys build options on environment" FORCE)
set(SLANG_BUILD_CONFIG "-Wl,--exclude-all-symbols" CACHE STRING "Slang build configuration on environment" FORCE)
set(SLANG_CMAKE_CONFIG "" CACHE STRING "Slang cmake configuration on environment")
endif()

# we will check if yosys already exist. if not then build it
if (OPENFPGA_WITH_YOSYS STREQUAL "ON")
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/yosys/bin/yosys)
Expand All @@ -358,47 +393,30 @@ if (OPENFPGA_WITH_YOSYS STREQUAL "ON")
add_custom_target(
yosys ALL
# add step to remove the 'built-in' quicklogic plugins code in yosys
COMMAND $(MAKE) config-gcc
COMMAND $(MAKE) install PREFIX=${CMAKE_CURRENT_BINARY_DIR}/yosys/
COMMAND $(MAKE) ${YOSYS_CONFIG_OPTION}
COMMAND $(MAKE) install PREFIX=${CMAKE_CURRENT_BINARY_DIR}/yosys/ ${YOSYS_BUILD_OPTION}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/yosys
COMMENT "Compile Yosys with given Makefile"
)
# Add dependency on patched Makefile if on MinGW
if (DEFINED ENV{MSYSTEM})
add_dependencies(yosys patch_abc_makefile)
endif()
# yosys compilation ends
# yosys-plugins compilation starts
add_custom_target(
yosys-slang ALL
COMMAND $(MAKE) install YOSYS_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/yosys/bin/ CMAKE_FLAGS+="-DPASS_NAME=read_slang"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/yosys-slang
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/yosys/bin/yosys
COMMENT "Compile Yosys-Slang with given Makefile"
)
add_dependencies(yosys-slang yosys)

## yosys-plugins compilation starts
#if (OPENFPGA_WITH_YOSYS_PLUGIN)
# add_custom_target(
# yosys-plugins ALL
# COMMAND $(MAKE) install_ql-qlf YOSYS_PATH=${CMAKE_CURRENT_BINARY_DIR}/yosys EXTRA_FLAGS="-DPASS_NAME=synth_ql"
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/yosys-plugins
# DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/yosys/bin/yosys
# COMMENT "Compile Yosys-plugins with given Makefile"
# )
# add_dependencies(yosys-plugins yosys)
#endif()
if (OPENFPGA_WITH_SLANG)
add_custom_target(
yosys-slang ALL
COMMAND $(MAKE) install YOSYS_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/yosys/bin/ CMAKE_FLAGS+="-DPASS_NAME=read_slang ${SLANG_CMAKE_CONFIG}" LDFLAGS+="${SLANG_BUILD_CONFIG}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/yosys-slang
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/yosys/bin/yosys
COMMENT "Compile Yosys-Slang with given Makefile"
)
add_dependencies(yosys-slang yosys)
endif()
endif()
endif()

# run make to extract compiler options, linker options and list of source files
#add_custom_target(
# yosys
# COMMAND make run
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/yosys
#)

# Add extra compilation flags to suppress warnings from some libraries/tools
# Note that target_compile_options() *appends* to the current compilation options of
# the specified target

# For installer
if (OPENFPGA_WITH_INSTALLER)
include(OpenfpgaInstaller)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.4223
1.2.4241
Loading
Loading