3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-05-25 03:16:22 +00:00

Visual Studio build

This commit is contained in:
Miodrag Milanovic 2026-05-22 19:54:19 +02:00
parent ba6083da16
commit 6039446e60
3 changed files with 51 additions and 38 deletions

View file

@ -31,41 +31,41 @@ jobs:
echo "should_skip=${{ steps.skip_check.outputs.should_skip }}" >> $GITHUB_OUTPUT
fi
# vs-prep:
# name: Prepare Visual Studio build
# runs-on: ubuntu-latest
# needs: [pre_job]
# if: (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && needs.pre_job.outputs.should_skip != 'true'
# steps:
# - uses: actions/checkout@v5
# with:
# submodules: true
# persist-credentials: false
# - run: sudo apt-get install libfl-dev
# - name: Build
# run: make vcxsrc YOSYS_COMPILER="Visual Studio" VCX_DIR_NAME=yosys-win32-vcxsrc-latest
# - uses: actions/upload-artifact@v7
# with:
# name: vcxsrc
# path: yosys-win32-vcxsrc-latest.zip
#
# vs-build:
# name: Visual Studio build
# runs-on: windows-latest
# needs: [vs-prep, pre_job]
# if: (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && needs.pre_job.outputs.should_skip != 'true'
# steps:
# - uses: actions/download-artifact@v8
# with:
# name: vcxsrc
# path: .
# - name: unzip
# run: unzip yosys-win32-vcxsrc-latest.zip
# - name: setup-msbuild
# uses: microsoft/setup-msbuild@v2
# - name: MSBuild
# working-directory: yosys-win32-vcxsrc-latest
# run: msbuild YosysVS.sln /p:PlatformToolset=v142 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0.26100.0
vs-build:
name: Visual Studio build
runs-on: windows-latest
needs: [pre_job]
if: (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && needs.pre_job.outputs.should_skip != 'true'
steps:
- uses: actions/checkout@v5
with:
submodules: true
persist-credentials: false
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Install flex/bison
shell: pwsh
run: |
choco install winflexbison3 --no-progress
# Make tools visible to CMake
echo "C:\Program Files (x86)\GnuWin32\bin" | Out-File -Append -FilePath $env:GITHUB_PATH
echo "C:\ProgramData\chocolatey\lib\winflexbison3\tools" | Out-File -Append -FilePath $env:GITHUB_PATH
- name: Configure CMake
run: >
cmake -S . -B build
-A x64
-DCMAKE_BUILD_TYPE=Release
-DYOSYS_WITHOUT_ABC=ON
- name: Build
run: >
cmake --build build
--config Release
--parallel
wasi-build:
name: WASI build
@ -121,7 +121,7 @@ jobs:
extra-builds-result:
runs-on: ubuntu-latest
needs:
# - vs-build
- vs-build
- wasi-build
- nix-build
if: always()

View file

@ -99,7 +99,14 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/O2 /DEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "/Os")
add_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(
_CRT_NONSTDC_NO_DEPRECATE
_CRT_SECURE_NO_WARNINGS
NOMINMAX
UNICODE
_UNICODE
)
add_compile_options(/Zc:__cplusplus)
else()
# We have to do this because CMake adds `-DNDEBUG` in release builds by default, and there's
# no particularly good way to prevent this without also erasing optimization flags.
@ -289,6 +296,9 @@ condition(YOSYS_ENABLE_EDITLINE editline_FOUND AND NOT YOSYS_WITHOUT_EDITLINE AN
condition(YOSYS_ENABLE_TCL tcl_FOUND AND libtommath_FOUND AND NOT YOSYS_WITHOUT_TCL)
condition(YOSYS_ENABLE_PYTHON Python3Embed_FOUND AND PyosysEnv_FOUND AND YOSYS_WITH_PYTHON)
condition(YOSYS_ENABLE_VERIFIC YOSYS_VERIFIC_DIR AND zlib_FOUND)
if (MSVC)
set(YOSYS_ENABLE_SPAWN ON)
endif()
# Describe dependencies and features
# CMake 4.0 would let us use proper conditions, but that's too new for now.

View file

@ -2,7 +2,10 @@ include(CMakePushCheckState)
include(CheckCXXSymbolExists)
include(FindPackageHandleStandardArgs)
if (WIN32 OR MSYS)
if (MSVC)
set(Dlfcn_FOUND FALSE)
unset(Dlfcn_LIBRARIES CACHE)
elseif (WIN32 OR MSYS)
# Windows; dlopen is available via a polyfill `libs/dlfcn-win32`.
set(Dlfcn_LIBRARIES dlfcn)
else()