antlr4-runtime: fix dll install (#5759)

pull/5653/merge
star9029 2 weeks ago committed by GitHub
parent 5abec9c6a5
commit 64f38c10b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      packages/a/antlr4-runtime/xmake.lua

@ -28,17 +28,28 @@ package("antlr4-runtime")
add_deps("cmake")
on_install(function (package)
local configs = {"-DANTLR_BUILD_CPP_TESTS=OFF", "-DANTLR4_INSTALL=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DANTLR_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DANTLR_BUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
if not package:config("shared") then
package:add("defines", "ANTLR4CPP_STATIC")
end
os.cd("runtime/Cpp")
io.replace("CMakeLists.txt", [[set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")]], "", {plain = true})
io.replace("CMakeLists.txt", [[set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")]], "", {plain = true})
io.replace("CMakeLists.txt", "add_subdirectory(runtime)",
"include(GNUInstallDirs)\nadd_subdirectory(runtime)", {plain = true})
local configs = {"-DANTLR_BUILD_CPP_TESTS=OFF", "-DANTLR4_INSTALL=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DANTLR_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DANTLR_BUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
if package:is_plat("windows") then
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
end
import("package.tools.cmake").install(package, configs)
if not package:config("shared") then
package:add("defines", "ANTLR4CPP_STATIC")
if package:is_plat("windows") and package:is_debug() then
local dir = package:installdir(package:config("shared") and "bin" or "lib")
os.vcp(path.join(package:buildir(), "runtime/*.pdb"), dir)
end
end)

Loading…
Cancel
Save