cppp-reiconv: fix install (#4451)

pull/4453/head
star9029 5 months ago committed by GitHub
parent af3270b5cb
commit 570c9dfab7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 49
      packages/c/cppp-reiconv/patches/2.1.0/cmake.patch
  2. 14
      packages/c/cppp-reiconv/xmake.lua

@ -0,0 +1,49 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d3c761..0689164 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -48,7 +48,7 @@ if(MSVC)
endif()
# Generate header file for build
-if(WIN32)
+if(WIN32 AND BUILD_SHARED_LIBS)
set(DLL_VARIABLE "__declspec(dllexport)")
elseif(HAVE_VISIBILITY)
set(DLL_VARIABLE "__attribute__((__visibility__(\"default\")))")
@@ -59,7 +59,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/cppp/reiconv.hpp.in" "${outp
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/windows/libcppp-reiconv.rc.in" "${CMAKE_BINARY_DIR}/windows/libcppp-reiconv.rc")
# Generate header file for install
-if(WIN32)
+if(WIN32 AND BUILD_SHARED_LIBS)
set(DLL_VARIABLE "__declspec(dllimport)")
else()
set(DLL_VARIABLE "")
@@ -83,7 +83,7 @@ cppp_build_library(${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/lib/iconv.cpp" T
# Include test suite.
include("tests/tests.cmake")
-
+if (NOT BUILD_SHARED_LIBS)
# Install
# Static
# PERMISSIONS 0644
@@ -94,7 +94,7 @@ install(TARGETS libcppp-reiconv.static
ARCHIVE DESTINATION "${install_staticdir}"
RUNTIME DESTINATION "${install_bindir}"
INCLUDES DESTINATION "${install_includedir}" )
-
+else()
# Shared
# PERMISSIONS 0755
install(TARGETS libcppp-reiconv.shared
@@ -105,7 +105,7 @@ install(TARGETS libcppp-reiconv.shared
ARCHIVE DESTINATION "${install_staticdir}"
RUNTIME DESTINATION "${install_bindir}"
INCLUDES DESTINATION "${install_includedir}" )
-
+endif()
# Includes
# install includes
# PERMISSIONS 0644

@ -1,20 +1,21 @@
package("cppp-reiconv") package("cppp-reiconv")
set_homepage("https://github.com/cppp-project/cppp-reiconv") set_homepage("https://github.com/cppp-project/cppp-reiconv")
set_description("A character set conversion library based on GNU LIBICONV.") set_description("A character set conversion library based on GNU LIBICONV.")
set_license("LGPL-3.0")
add_urls("https://github.com/cppp-project/cppp-reiconv/releases/download/$(version)/cppp-reiconv-$(version).zip") add_urls("https://github.com/cppp-project/cppp-reiconv/releases/download/$(version)/cppp-reiconv-$(version).zip",
"https://github.com/cppp-project/cppp-reiconv.git")
add_versions("v2.1.0", "3e539785a437843793c5ce2f8a72cb08f2b543cba11635b06db25cfc6d9cc3a4") add_versions("v2.1.0", "3e539785a437843793c5ce2f8a72cb08f2b543cba11635b06db25cfc6d9cc3a4")
add_patches("2.1.0", "patches/2.1.0/cmake.patch", "21bd2fcb5874f8774af1360aaac51073b67bf4c754096f0fe162d66632c1b7f9")
add_deps("cmake", "python") add_deps("cmake", "python")
on_install(function (package) on_install(function (package)
local configs = {} local configs = {"-DENABLE_TEST=OFF", "-DENABLE_EXTRA=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DENABLE_EXTRA=ON")
table.insert(configs, "-DENABLE_TEST=OFF")
import("package.tools.cmake").install(package, configs) import("package.tools.cmake").install(package, configs)
end) end)
@ -36,4 +37,3 @@ package("cppp-reiconv")
} }
]]}, {configs = {languages = "c++14"}})) ]]}, {configs = {languages = "c++14"}}))
end) end)

Loading…
Cancel
Save