Fix Mingw Compilation (#4675)

This commit is contained in:
David Ledger 2023-11-08 22:27:56 +11:00 committed by GitHub
parent 5ba7084815
commit 9a65ed4ce2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -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()

View File

@ -26,6 +26,7 @@ Conor McCullough
Dan Petrisko
Daniel Bates
David Horton
David Ledger
David Metz
David Stanford
David Turner

View File

@ -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}
@ -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})