forked from xmake-io/xmake-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test * fixup hash * Do not build tests. * test * fixup * test * Update xmake.lua * Update xmake.lua * retry * re * remove v * Update xmake.lua * Update xmake.lua * test * fixup * retry * re * make opengl deps optional = true --------- Co-authored-by: star9029 <hengxings783@gmail.com>
- Loading branch information
Showing
2 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
add_rules("mode.debug", "mode.release") | ||
|
||
set_project("gl2ps") | ||
set_version("1.4.2") | ||
set_languages("c99") | ||
|
||
option("zlib", {description = "Enable ZLIB compression", default = true}) | ||
option("png", {description = "Enable PNG support", default = true}) | ||
|
||
includes("@builtin/check") | ||
|
||
set_configvar("GL2PS_MAJOR_VERSION", 1) | ||
set_configvar("GL2PS_MINOR_VERSION", 4) | ||
set_configvar("GL2PS_PATCH_VERSION", 2) | ||
set_configvar("GL2PS_EXTRA_VERSION", "") | ||
set_configvar("GL2PS_OS", is_plat("macosx") and "MacOSX" or (is_plat("windows", "mingw") and "Windows" or "Linux")) | ||
|
||
option("HAVE_VSNPRINTF") | ||
add_cfuncs("vsnprintf") | ||
add_cincludes("stdio.h") | ||
option_end() | ||
|
||
if not has_config("HAVE_VSNPRINTF") then | ||
add_defines("HAVE_NO_VSNPRINTF") | ||
end | ||
|
||
add_requires("opengl", {optional = true}) | ||
add_requires("glut") | ||
if has_config("zlib") then | ||
add_requires("zlib") | ||
add_defines("HAVE_ZLIB") | ||
end | ||
if has_config("png") then | ||
add_requires("libpng") | ||
add_defines("HAVE_PNG") | ||
end | ||
|
||
if is_plat("linux", "macosx") then | ||
add_syslinks("m") | ||
end | ||
|
||
if is_plat("macosx") then | ||
add_cflags("-Wno-deprecated-declarations") | ||
end | ||
|
||
target("gl2ps") | ||
set_kind("$(kind)") | ||
add_files("gl2ps.c") | ||
add_headerfiles("gl2ps.h") | ||
add_packages("opengl", "glut") | ||
|
||
if is_kind("shared") and is_plat("windows", "cygwin") then | ||
add_defines("GL2PSDLL", "GL2PSDLL_EXPORTS") | ||
end | ||
if is_kind("static") then | ||
add_defines("GL2PS_STATIC") | ||
end | ||
|
||
if has_config("zlib") then | ||
add_packages("zlib") | ||
end | ||
if has_config("png") then | ||
add_packages("libpng") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package("gl2ps") | ||
set_homepage("https://gitlab.onelab.info/gl2ps/gl2ps") | ||
set_description("OpenGL to PostScript printing library") | ||
set_license("LGPL") | ||
|
||
add_urls("https://gitlab.onelab.info/gl2ps/gl2ps/-/archive/gl2ps_$(version)/gl2ps-gl2ps_$(version).tar.gz", | ||
"https://gitlab.onelab.info/gl2ps/gl2ps.git", { version = function(version) | ||
return version:gsub("%.", "_") | ||
end}) | ||
|
||
add_versions("1.4.2", "afb6f4a8df9c7639449546a79aabd1baaccacc4360fc23741c6485138512ff72") | ||
|
||
add_configs("zlib", {description = "Enable compression using ZLIB", default = true, type = "boolean"}) | ||
add_configs("png", {description = "Enable PNG support", default = true, type = "boolean"}) | ||
|
||
add_deps("opengl", "glut") | ||
|
||
if is_plat("macosx", "linux", "bsd") then | ||
add_deps("libx11") | ||
end | ||
|
||
if is_plat("linux", "bsd") then | ||
add_syslinks("m") | ||
elseif is_plat("macosx") then | ||
add_frameworks("Cocoa", "OpenGL") | ||
end | ||
|
||
on_check("windows", function (package) | ||
local msvc = package:toolchain("msvc") | ||
if msvc and package:is_arch("arm.*") then | ||
local vs = msvc:config("vs") | ||
assert(vs and tonumber(vs) >= 2022, "package(gl2ps): requires Visual Studio 2022 and later for arm targets") | ||
end | ||
end) | ||
|
||
on_load(function (package) | ||
if package:config("zlib") then | ||
package:add("deps", "zlib") | ||
end | ||
if package:config("png") then | ||
package:add("deps", "libpng") | ||
end | ||
end) | ||
|
||
on_install("windows", "linux", "macosx", "mingw", function (package) | ||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") | ||
import("package.tools.xmake").install(package, configs) | ||
end) | ||
|
||
on_test(function (package) | ||
assert(package:has_cfuncs("gl2psEndPage", {includes = "gl2ps.h"})) | ||
end) |