Skip to content

Commit

Permalink
glob: use ghc option (#5118)
Browse files Browse the repository at this point in the history
* glob: use ghc option

* glob: add option

* glob: add requested changes

* glob: re-add `package:add("defines", "GLOB_USE_GHC_FILESYSTEM")` in on_install

* glob: remove `package:add("defines", "GLOB_USE_GHC_FILESYSTEM")`

* glob: move `add_defines("GLOB_USE_GHC_FILESYSTEM")`

* Update xmake.lua

---------

Co-authored-by: star9029 <[email protected]>
  • Loading branch information
Chi-EEE and star-hengxing authored Sep 3, 2024
1 parent bc70562 commit 538c0e7
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions packages/g/glob/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,42 @@ package("glob")
on_load(function (package)
if package:config("ghc_filesystem") then
package:add("deps", "ghc_filesystem")
package:add("defines", "GLOB_USE_GHC_FILESYSTEM")
end
if package:config("header_only") then
package:set("kind", "library", {headeronly = true})
end
end)

on_install(function (package)
if package:config("ghc_filesystem") then
package:add("defines", "GLOB_USE_GHC_FILESYSTEM")
end
if package:config("header_only") then
os.cp("single_include/glob", package:installdir("include"))
else
local configs = {}
if package:config("ghc_filesystem") then
configs.ghc_filesystem = true
end
io.writefile("xmake.lua", [[
add_rules("mode.debug", "mode.release")
option("ghc_filesystem", {default = false, showmenu = true, description = "Use ghc_filesystem"})
if has_config("ghc_filesystem") then
add_requires("ghc_filesystem")
add_defines("GLOB_USE_GHC_FILESYSTEM")
end
target("glob")
set_kind("$(kind)")
set_languages("cxx17")
if has_config("ghc_filesystem") then
add_packages("ghc_filesystem")
end
add_headerfiles("include/(glob/*.h)")
add_files("source/*.cpp")
add_includedirs("include", {public = true})
if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all", {export_classes = true})
end
]])
import("package.tools.xmake").install(package)
import("package.tools.xmake").install(package, configs)
end
end)

Expand Down

0 comments on commit 538c0e7

Please sign in to comment.