[miniz] Add new port (#5452)

* [miniz] Add new port

* [miniz] Fix Windows Build Conflict

* [miniz] Miniz cannot be built as a shared library

* [miniz] Force miniz to be static library

* [miniz] Fix CRT deprecation error on uwp

* [miniz] Fix CRT deprecation error within tests

* [miniz] Disable tests entirely
This commit is contained in:
Connor Fitzgerald 2019-02-26 17:20:07 -05:00 committed by Phil Christensen
parent 108afe5396
commit 4a582b4d1d
3 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,54 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7dd6309..eaf160f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,12 +8,12 @@ if(CMAKE_BUILD_TYPE STREQUAL "")
CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
-
set(miniz_SOURCE miniz.c miniz_zip.c miniz_tinfl.c miniz_tdef.c)
-add_library(miniz ${miniz_SOURCE})
+add_library(miniz STATIC ${miniz_SOURCE})
+target_compile_definitions(miniz PRIVATE _CRT_SECURE_NO_WARNINGS)
+if(FALSE)
set(EXAMPLE1_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example1.c")
set(EXAMPLE2_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example2.c")
set(EXAMPLE3_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/examples/example3.c")
@@ -41,12 +41,28 @@ if(${UNIX})
target_link_libraries(example6 m)
endif()
+target_compile_definitions(example1 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example2 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example3 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example4 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example5 PRIVATE _CRT_SECURE_NO_WARNINGS)
+target_compile_definitions(example6 PRIVATE _CRT_SECURE_NO_WARNINGS)
+
# add_executable(miniz_tester ${MINIZ_TESTER_SRC_LIST})
# target_link_libraries(miniz_tester miniz)
+endif()
-install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
+install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Config
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+export(TARGETS ${PROJECT_NAME}
+ NAMESPACE miniz::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
+)
+install(EXPORT ${PROJECT_NAME}Config
+ DESTINATION "${CMAKE_INSTALL_PREFIX}/share/miniz"
+ NAMESPACE miniz::
+)
file(GLOB INSTALL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
-install(FILES ${INSTALL_HEADERS} DESTINATION include/${PROJECT_NAME})
\ No newline at end of file
+install(FILES ${INSTALL_HEADERS} DESTINATION include/${PROJECT_NAME})

3
ports/miniz/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: miniz
Version: 2.0.8
Description: Single C source file zlib-replacement library

View File

@ -0,0 +1,25 @@
include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO richgel999/miniz
REF 2.0.8
SHA512 84b480df8bff63422d8c36cef3741f9b9f3dce13babf4de6cb4d575209978ad849357cc72bcf31ee8b6c5da6853ed2e5eddbbe16fecd689afd7028e834abf7e9
HEAD_REF master
PATCHES
CMakeLists-targets.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/miniz RENAME copyright)
vcpkg_test_cmake(PACKAGE_NAME miniz)