Add support of `proj` on android (excluding `android@windows`) (#4310)

* fix: remove unused dependency `openssl` for `proj`

* add interface pre-defined macro

* edit the limited platforms for `proj`

* Update xmake.lua

---------

Co-authored-by: ruki <waruqi@gmail.com>
pull/4344/head
zjyhjqs 7 months ago committed by GitHub
parent 6f59a842b5
commit a14a57f0ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 24
      packages/p/proj/xmake.lua

@ -21,34 +21,26 @@ package("proj")
add_syslinks("pthread")
end
on_load("windows", "macosx", "linux", function (package)
on_load(function (package)
if package:config("tiff") then
package:add("deps", "libtiff")
end
if package:config("curl") then
package:add("deps", "libcurl")
if package:is_plat("linux") then
package:add("deps", "openssl")
end
end
if package:config("apps") then
package:addenv("PATH", "bin")
end
end)
on_install("windows", "macosx", "linux", function (package)
on_install("!wasm and (!android or android@!windows)", function (package)
-- windows@arm64 cann't generate proj.db
if package:is_plat("windows") and package:is_arch("arm64") then
io.replace("CMakeLists.txt", "add_subdirectory(data)", "", {plain = true})
end
if package:config("curl") and package:is_plat("linux") then
io.replace("src/lib_proj.cmake", "${CURL_LIBRARIES}", "CURL::libcurl ssl crypto", {plain = true})
else
if package:config("curl") and (package:version():le(9.4)) then
io.replace("src/lib_proj.cmake", "${CURL_LIBRARIES}", "CURL::libcurl", {plain = true})
end
if package:is_plat("windows") and not package:config("shared") then
io.replace("src/proj.h", "#ifndef PROJ_DLL", "#define PROJ_DLL\n#ifndef PROJ_DLL", {plain = true})
end
local configs = {"-DNLOHMANN_JSON_ORIGIN=external", "-DBUILD_TESTING=OFF"}
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"))
@ -56,14 +48,18 @@ package("proj")
table.insert(configs, "-DENABLE_TIFF=" .. (package:config("tiff") and "ON" or "OFF"))
table.insert(configs, "-DENABLE_CURL=" .. (package:config("curl") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_PROJSYNC=" .. (package:config("curl") and "ON" or "OFF"))
if package:config("curl") and package:is_plat("linux") then
import("package.tools.cmake").install(package, configs, {packagedeps = {"openssl"}})
elseif package:config("curl") and package:is_plat("macosx") then
if package:config("curl") and package:is_plat("macosx") then
local exflags = {"-framework", "CoreFoundation", "-framework", "Security", "-framework", "SystemConfiguration"}
import("package.tools.cmake").install(package, configs, {shflags = exflags, ldflags = exflags})
else
import("package.tools.cmake").install(package, configs)
end
if not package:config("shared") then
-- public compile definitions in CMake
package:add("defines", "PROJ_DLL=")
end
end)
on_test(function (package)

Loading…
Cancel
Save