Skip to content

Commit

Permalink
Fix Mingw Compilation (verilator#4675)
Browse files Browse the repository at this point in the history
  • Loading branch information
seppeon authored Nov 8, 2023
1 parent 5ba7084 commit 9a65ed4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (NOT WIN32)
message(WARNING "CMake support on Linux/OSX is experimental.")
endif()

if (MSVC)
if (WIN32)
if (DEFINED ENV{WIN_FLEX_BISON})
set(WIN_FLEX_BISON "$ENV{WIN_FLEX_BISON}")
endif()
Expand Down
1 change: 1 addition & 0 deletions docs/CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Conor McCullough
Dan Petrisko
Daniel Bates
David Horton
David Ledger
David Metz
David Stanford
David Turner
Expand Down
12 changes: 9 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ set_target_properties(${verilator} PROPERTIES
#UNITY_BUILD $<IF:$<CONFIG:DEBUG>,FALSE,${CMAKE_UNITY_BUILD}>
MSVC_RUNTIME_LIBRARY MultiThreaded$<IF:$<CONFIG:Release>,,DebugDLL>
#JOB_POOL_LINK one_job # Linking takes lots of resources
INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE
INTERPROCEDURAL_OPTIMIZATION_RELEASE $<IF:MINGW,FALSE,TRUE>
)

add_dependencies(${verilator}
Expand Down Expand Up @@ -501,13 +501,19 @@ target_include_directories(${verilator}
)

if (WIN32)
target_compile_options(${verilator} PRIVATE /bigobj)
if(MINGW)
target_compile_options(${verilator} PRIVATE -Wa,-mbig-obj)
target_link_options(${verilator} PRIVATE -Wl,--stack,10000000 -mconsole -lcomctl32 -DWIN_32_LEAN_AND_MEAN)
else()
target_compile_options(${verilator} PRIVATE /bigobj)
target_link_options(${verilator} PRIVATE /STACK:10000000)
endif()

target_compile_definitions(${verilator} PRIVATE
YY_NO_UNISTD_H
)
target_include_directories(${verilator} PRIVATE ../platform/win32)
target_link_libraries(${verilator} PRIVATE bcrypt psapi)
target_link_options(${verilator} PRIVATE /STACK:10000000)
endif()

install(TARGETS ${verilator})

0 comments on commit 9a65ed4

Please sign in to comment.