mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-08 00:22:50 +08:00
[libredwg] Add new port (#30005)
This commit is contained in:
parent
66372e84ae
commit
4e57712f24
17
ports/libredwg/fix_arm64_build.patch
Normal file
17
ports/libredwg/fix_arm64_build.patch
Normal file
@ -0,0 +1,17 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8906fed..e953b76 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -11,8 +11,11 @@ if(MSVC)
|
||||
set(redwg libredwg)
|
||||
# Disable some overly strict MSVC warnings.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd4244 -wd4800 -wd4805 -wd4101 -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS")
|
||||
-else()
|
||||
+ else()
|
||||
set(redwg redwg)
|
||||
+ endif()
|
||||
+if(MSVC AND CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64")
|
||||
+ add_compile_options(/Gy)
|
||||
endif()
|
||||
|
||||
if (EXISTS ".version")
|
27
ports/libredwg/fix_dependency.patch
Normal file
27
ports/libredwg/fix_dependency.patch
Normal file
@ -0,0 +1,27 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 8263f23..8906fed 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -201,7 +201,8 @@ target_include_directories(${redwg} PRIVATE
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
target_include_directories(${redwg} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
|
||||
-
|
||||
+find_path(JSMN_INCLUDE_DIRS "jsmn.h")
|
||||
+target_include_directories(${redwg} PRIVATE ${JSMN_INCLUDE_DIRS})
|
||||
link_libraries(${redwg} ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if(NOT LIBREDWG_LIBONLY)
|
||||
diff --git a/src/in_json.c b/src/in_json.c
|
||||
index d66f1ab..724505b 100644
|
||||
--- a/src/in_json.c
|
||||
+++ b/src/in_json.c
|
||||
@@ -51,7 +51,7 @@ static unsigned int loglevel;
|
||||
// In strict mode an object or array can't become a key
|
||||
// In strict mode primitives are: numbers and booleans
|
||||
#undef JSMN_STRICT
|
||||
-#include "../jsmn/jsmn.h"
|
||||
+#include "jsmn.h"
|
||||
|
||||
typedef struct jsmntokens
|
||||
{
|
51
ports/libredwg/fix_install.patch
Normal file
51
ports/libredwg/fix_install.patch
Normal file
@ -0,0 +1,51 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f0e04be..8263f23 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -196,10 +196,11 @@ if (BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(${redwg} PUBLIC DLL_EXPORT;ENABLE_SHARED)
|
||||
endif()
|
||||
target_include_directories(${redwg} PRIVATE
|
||||
- ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
- ${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
|
||||
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
target_include_directories(${redwg} PUBLIC
|
||||
- ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
|
||||
|
||||
link_libraries(${redwg} ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
@@ -309,7 +310,7 @@ add_custom_target(
|
||||
COMMAND etags --language=c++ *.c *.h
|
||||
DEPENDS ${SRCS}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
-
|
||||
+if(0)
|
||||
if(MSVC)
|
||||
install(TARGETS ${redwg} RUNTIME PUBLIC_HEADER
|
||||
DESTINATION libredwg-${PACKAGE_VERSION})
|
||||
@@ -331,7 +332,21 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
install(TARGETS RUNTIME)
|
||||
-
|
||||
+endif()
|
||||
+include(GNUInstallDirs)
|
||||
+install(
|
||||
+ TARGETS ${redwg}
|
||||
+ EXPORT libredwg-core
|
||||
+ COMPONENT libredwg
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ PUBLIC_HEADER DESTINATION include/libredwg)
|
||||
+if(NOT LIBREDWG_LIBONLY)
|
||||
+ install(TARGETS ${executables_TARGETS}
|
||||
+ DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
+endif()
|
||||
+install(EXPORT libredwg-core FILE unofficial-libredwg-config.cmake NAMESPACE unofficial::libredwg:: DESTINATION share/unofficial-libredwg)
|
||||
if(WIN32)
|
||||
add_custom_target(dist
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/README README
|
55
ports/libredwg/portfile.cmake
Normal file
55
ports/libredwg/portfile.cmake
Normal file
@ -0,0 +1,55 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO LibreDWG/libredwg
|
||||
REF ${VERSION}
|
||||
SHA512 8696289ea7ff542bd48d4e1f0e959b95574a7741ba0c80238ad31aff28f1861f0c00dfb1dc78e998b043a4300ff976ba324f5a41195f799f9d31e2b5be288bc7
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix_install.patch
|
||||
fix_dependency.patch
|
||||
fix_arm64_build.patch
|
||||
)
|
||||
|
||||
# If generate dwg manipulation tools
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
INVERTED_FEATURES
|
||||
tools LIBREDWG_LIBONLY
|
||||
)
|
||||
|
||||
# libredwg will read the version
|
||||
file(WRITE "${SOURCE_PATH}/.version" ${VERSION})
|
||||
|
||||
# Fix https://github.com/LibreDWG/libredwg/issues/652#issuecomment-1454035167
|
||||
if(APPLE)
|
||||
vcpkg_replace_string("${SOURCE_PATH}/src/common.h"
|
||||
[[defined(COMMON_TEST_C)]]
|
||||
[[1]]
|
||||
)
|
||||
vcpkg_replace_string("${SOURCE_PATH}/src/common.c"
|
||||
[[defined(COMMON_TEST_C)]]
|
||||
[[1]]
|
||||
)
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
${FEATURE_OPTIONS}
|
||||
-DBUILD_TESTING=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-libredwg CONFIG_PATH share/unofficial-libredwg)
|
||||
|
||||
if("tools" IN_LIST FEATURES)
|
||||
vcpkg_copy_tools(TOOL_NAMES dwg2dxf dwg2SVG dwgbmp dwggrep dwglayers dwgread dwgrewrite dwgwrite dxf2dwg AUTO_CLEAN)
|
||||
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/libredwg")
|
||||
endif()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
|
4
ports/libredwg/usage
Normal file
4
ports/libredwg/usage
Normal file
@ -0,0 +1,4 @@
|
||||
libredwg provides CMake targets:
|
||||
|
||||
find_package(unofficial-libredwg CONFIG REQUIRED)
|
||||
target_link_libraries(main unofficial::libredwg::libredwg)
|
23
ports/libredwg/vcpkg.json
Normal file
23
ports/libredwg/vcpkg.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "libredwg",
|
||||
"version": "0.12.5.5178",
|
||||
"description": "GNU LibreDWG is a free C library to handle DWG files. It aims to be a free replacement for the OpenDWG libraries. DWG is the native file format of AutoCAD.",
|
||||
"homepage": "https://www.gnu.org/software/libredwg/",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": [
|
||||
"jsmn",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"tools": {
|
||||
"description": "Build dwg/dxf manipulation command-line tools"
|
||||
}
|
||||
}
|
||||
}
|
@ -4344,6 +4344,10 @@
|
||||
"baseline": "2.0.2",
|
||||
"port-version": 0
|
||||
},
|
||||
"libredwg": {
|
||||
"baseline": "0.12.5.5178",
|
||||
"port-version": 0
|
||||
},
|
||||
"libressl": {
|
||||
"baseline": "3.6.2",
|
||||
"port-version": 0
|
||||
|
9
versions/l-/libredwg.json
Normal file
9
versions/l-/libredwg.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "aa161067eef7398933b726e81cd4824733a9c9a6",
|
||||
"version": "0.12.5.5178",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user