|
|
@ -13,12 +13,8 @@ package("verilator") |
|
|
|
|
|
|
|
|
|
|
|
on_load(function (package) |
|
|
|
on_load(function (package) |
|
|
|
if not package:is_precompiled() then |
|
|
|
if not package:is_precompiled() then |
|
|
|
if package:is_plat("windows") then |
|
|
|
package:add("deps", "flex", {kind = "library"}) |
|
|
|
package:add("deps", "winflexbison", {kind = "library"}) |
|
|
|
package:add("deps", "bison") |
|
|
|
else |
|
|
|
|
|
|
|
package:add("deps", "flex", {kind = "library"}) |
|
|
|
|
|
|
|
package:add("deps", "bison") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
package:add("deps", "python 3.x", {kind = "binary"}) |
|
|
|
package:add("deps", "python 3.x", {kind = "binary"}) |
|
|
|
end |
|
|
|
end |
|
|
|
package:mark_as_pathenv("VERILATOR_ROOT") |
|
|
|
package:mark_as_pathenv("VERILATOR_ROOT") |
|
|
@ -29,16 +25,31 @@ package("verilator") |
|
|
|
import("package.tools.cmake") |
|
|
|
import("package.tools.cmake") |
|
|
|
|
|
|
|
|
|
|
|
io.replace("src/CMakeLists.txt", "MSVC_RUNTIME_LIBRARY MultiThreaded$<IF:$<CONFIG:Release>,,DebugDLL>", "", {plain = true}) |
|
|
|
io.replace("src/CMakeLists.txt", "MSVC_RUNTIME_LIBRARY MultiThreaded$<IF:$<CONFIG:Release>,,DebugDLL>", "", {plain = true}) |
|
|
|
|
|
|
|
if is_subhost("msys") then |
|
|
|
|
|
|
|
io.replace("CMakeLists.txt", "if(WIN32)", "if(0)", {plain = true}) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
local configs = {"-DOBJCACHE_ENABLED=OFF", "-DDEBUG_AND_RELEASE_AND_COVERAGE=OFF"} |
|
|
|
local configs = { |
|
|
|
|
|
|
|
"-DOBJCACHE_ENABLED=OFF", |
|
|
|
|
|
|
|
"-DDEBUG_AND_RELEASE_AND_COVERAGE=OFF", |
|
|
|
|
|
|
|
"-DCMAKE_CXX_STANDARD=20", |
|
|
|
|
|
|
|
} |
|
|
|
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) |
|
|
|
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) |
|
|
|
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
|
|
|
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
|
|
|
|
|
|
|
if package:is_plat("windows") then |
|
|
|
|
|
|
|
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
local opt = {} |
|
|
|
local opt = {} |
|
|
|
opt.envs = cmake.buildenvs(package) |
|
|
|
opt.envs = cmake.buildenvs(package) |
|
|
|
if package:is_plat("windows") then |
|
|
|
if is_host("windows") then |
|
|
|
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''") |
|
|
|
local winflexbison = package:dep("winflexbison") |
|
|
|
opt.envs.WIN_FLEX_BISON = package:dep("winflexbison"):installdir("include") |
|
|
|
if winflexbison then |
|
|
|
|
|
|
|
opt.envs.WIN_FLEX_BISON = winflexbison:installdir("include") |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
local flex = package:dep("flex") |
|
|
|
|
|
|
|
table.insert(configs, "-DFLEX_INCLUDE_DIR=" .. flex:installdir("include")) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
cmake.install(package, configs, opt) |
|
|
|
cmake.install(package, configs, opt) |
|
|
|
|
|
|
|
|
|
|
@ -56,5 +67,7 @@ package("verilator") |
|
|
|
end) |
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
on_test(function (package) |
|
|
|
on_test(function (package) |
|
|
|
os.vrun("verilator --version") |
|
|
|
if not package:is_cross() then |
|
|
|
|
|
|
|
os.vrun("verilator --version") |
|
|
|
|
|
|
|
end |
|
|
|
end) |
|
|
|
end) |
|
|
|