* add geant4

* update folly
pull/683/head
Hoildkv 3 years ago committed by GitHub
parent f94431e768
commit 7b1e7e9982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/f/folly/xmake.lua
  2. 70
      packages/g/geant4/xmake.lua
  3. 4
      packages/l/libevent/xmake.lua

@ -8,6 +8,7 @@ package("folly")
"https://github.com/facebook/folly.git")
add_versions("2021.06.28", "477765d43045d82ac6a2750142aed9534cd5efc1fbf2be622bb682a8c02a45a4")
add_versions("2021.08.02", "03159657ef7a08c1207d90e63f02d4d6b1241dcae49f11a72441c0c269b269fa")
add_versions("2021.11.01", "2620ad559f1e041f50328c91838cde666d422ed09f23b31bcdbf61e709da5c17")
add_patches("2021.06.28", path.join(os.scriptdir(), "patches", "2021.06.28", "reorder.patch"), "9a6bf283881580474040cfc7a8e89d461d68b89bae5583d89fff0a3198739980")
add_patches("2021.x", path.join(os.scriptdir(), "patches", "2021.06.28", "regex.patch"), "6a77ade9f48dd9966d3f7154e66ca8a5c030ae2b6d335cbe3315784aefd8f495")

@ -0,0 +1,70 @@
package("geant4")
set_homepage("https://geant4.web.cern.ch/")
set_description("Geant4 is a toolkit for the simulation of the passage of particles through matter.")
add_urls("https://geant4-data.web.cern.ch/releases/geant4_$(version).zip", {version = function (version)
return format("%02d_%02d_p%02d", version:major(), version:minor(), version:patch())
end})
add_versions("10.7.2", "c07b358c30b5930afcc32b44e899cf901083539f350f4333d65784c2aaa4af38")
add_deps("cmake")
add_deps("zlib", "expat", "clhep")
add_includedirs("include/Geant4")
if is_plat("windows") then
add_defines("WIN32")
end
on_install("windows", "macosx", "linux", function (package)
if package:is_plat("windows") then
local vs = import("core.tool.toolchain").load("msvc"):config("vs")
if tonumber(vs) < 2019 then
raise("Your compiler is too old to use this library.")
end
end
local configs = {"-DCMAKE_INSTALL_LIBDIR=lib",
"-DGEANT4_ENABLE_TESTING=OFF",
"-DGEANT4_INSTALL_EXAMPLES=OFF",
"-DGEANT4_USE_SYSTEM_CLHEP=ON",
"-DGEANT4_USE_SYSTEM_EXPAT=ON",
"-DGEANT4_USE_SYSTEM_ZLIB=ON",
"-DGEANT4_USE_SYSTEM_PTL=OFF",
"-DGEANT4_USE_TBB=OFF",
"-DGEANT4_USE_GDML=OFF",
"-DGEANT4_USE_TIMEMORY=OFF",
"-DGEANT4_USE_USOLIDS=OFF",
"-DGEANT4_USE_FREETYPE=OFF",
"-DGEANT4_USE_HDF5=OFF"}
io.replace("cmake/Modules/G4OptionalComponents.cmake", "if(WIN32)", "if(FALSE)", {plain = true})
io.replace("cmake/Modules/G4OptionalComponents.cmake", "EXPAT REQUIRED", "EXPAT CONFIG REQUIRED", {plain = true})
io.replace("cmake/Modules/G4OptionalComponents.cmake", "EXPAT::EXPAT", "expat::expat", {plain = true})
io.replace("cmake/Modules/G4OptionalComponents.cmake", "${EXPAT_VERSION_STRING} VERSION_LESS \"2.0.1\"", "FALSE", {plain = true})
if package:is_plat("windows") then
io.replace("cmake/Modules/G4MakeRules_cxx.cmake", "-MD", "-" .. package:config("vs_runtime"), {plain = true})
end
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
import("package.tools.cmake").install(package, configs)
package:addenv("PATH", "bin")
local suffix = ""
if package:is_plat("windows") and not package:config("shared") then
suffix = "-static"
end
local expected_links = {"G4physicslists", "G4parmodels", "G4persistency", "G4GMocren", "G4error_propagation", "G4visXXX", "G4VRML", "G4RayTracer", "G4Tree", "G4visHepRep", "G4FR", "G4vis_management", "G4modeling", "G4tasking", "G4readout", "G4run", "G4tracking", "G4event", "G4processes", "G4digits_hits", "G4track", "G4particles", "G4geometry", "G4graphics_reps", "G4materials", "G4analysis", "G4interfaces", "G4intercoms", "G4global", "G4ptl"}
for _, libname in ipairs(expected_links) do
package:add("links", libname .. suffix)
end
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <G4NistManager.hh>
void test() {
using CLHEP::cm;
G4NistManager* nist = G4NistManager::Instance();
G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
}
]]}, {configs = {languages = "c++17"}}))
end)

@ -22,11 +22,15 @@ package("libevent")
end)
on_install("windows", "linux", "macosx", function (package)
io.replace("CMakeLists.txt", "advapi32", "advapi32 crypt32", {plain = true})
local configs = {"-DEVENT__DISABLE_TESTS=ON", "-DEVENT__DISABLE_REGRESS=ON", "-DEVENT__DISABLE_SAMPLES=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DEVENT__DISABLE_OPENSSL=" .. (package:config("openssl") and "OFF" or "ON"))
table.insert(configs, "-DEVENT__DISABLE_MBEDTLS=" .. (package:config("mbedtls") and "OFF" or "ON"))
if package:is_plat("windows") then
table.insert(configs, "-DEVENT__MSVC_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs)
end)

Loading…
Cancel
Save