Skip to content

Commit

Permalink
updated zip (assimp#5499)
Browse files Browse the repository at this point in the history
* updated zip

udated zip from version 1.15 to version 3.0.2

* Check for double defined macro

* Update miniz.h

* Update zip.c

* Update zip.c

---------

Co-authored-by: Kim Kulling <[email protected]>
  • Loading branch information
mosfet80 and kimkulling authored May 27, 2024
1 parent 329fee2 commit 83d7216
Show file tree
Hide file tree
Showing 24 changed files with 13,764 additions and 6,259 deletions.
1 change: 1 addition & 0 deletions contrib/zip/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.h linguist-language=C
60 changes: 60 additions & 0 deletions contrib/zip/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/build/
/test/build/
/xcodeproj/
/infer-out/
.vscode/
Testing/

# Object files
*.o
*.ko
*.obj
*.elf

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
*.suo

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Temporary
*.swp
.DS_Store

# CMake
CMakeScripts
*.cmake

# Xcode
*.build
*.xcodeproj
zip.sln
zip.vcxproj.filters
zip.vcxproj
ALL_BUILD.vcxproj.filters
ALL_BUILD.vcxproj
CMakeFiles/
zip.dir/
test/test.exe.vcxproj.filters
test/test.exe.vcxproj
test/test.exe.dir/

18 changes: 0 additions & 18 deletions contrib/zip/.travis.sh

This file was deleted.

22 changes: 0 additions & 22 deletions contrib/zip/.travis.yml

This file was deleted.

68 changes: 44 additions & 24 deletions contrib/zip/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
cmake_minimum_required(VERSION 3.4)
cmake_minimum_required(VERSION 3.14)

project(zip
LANGUAGES C
VERSION "0.1.19")
VERSION "0.3.0")
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_VERBOSE_MAKEFILE ON)
option(CMAKE_DISABLE_TESTING "Disable test creation" OFF)

# Enable building tests only if the project is being built as a standalone one
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
option(CMAKE_DISABLE_TESTING "Disable test creation" OFF)
else ()
option(CMAKE_DISABLE_TESTING "Disable test creation" ON)
endif ()

option(CMAKE_ENABLE_SANITIZERS "Enable zip sanitizers" OFF)
option(ZIP_STATIC_PIC "Build static zip with PIC" ON)
option(ZIP_BUILD_DOCS "Generate API documentation with Doxygen" OFF)

if(ZIP_ENABLE_SHARABLE_FILE_OPEN)
add_definitions(-DZIP_ENABLE_SHARABLE_FILE_OPEN)
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 4)
# large file support
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64)
endif()

# zip
set(SRC src/miniz.h src/zip.h src/zip.c)

# this is the "object library" target: compiles the sources only once
add_library(OBJLIB OBJECT ${SRC})
# shared libraries need PIC
set_property(TARGET OBJLIB PROPERTY POSITION_INDEPENDENT_CODE 1)

# static and shared libraries built from the same object files
if (BUILD_SHARED_LIBS)
add_library(${PROJECT_NAME} SHARED $<TARGET_OBJECTS:OBJLIB>)
include(GenerateExportHeader)
generate_export_header(${PROJECT_NAME})
else()
add_library(${PROJECT_NAME} STATIC $<TARGET_OBJECTS:OBJLIB>)
add_library(${PROJECT_NAME} ${SRC})
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

if(ZIP_STATIC_PIC)
set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE 1)
endif()

set_property(TARGET ${PROJECT_NAME} PROPERTY C_VISIBILITY_PRESET hidden)
if(BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_NAME}
PUBLIC ZIP_SHARED
PRIVATE ZIP_BUILD_SHARED
)
endif()

target_include_directories(${PROJECT_NAME} PUBLIC
Expand All @@ -33,24 +53,26 @@ target_include_directories(${PROJECT_NAME} PUBLIC
if (NOT CMAKE_DISABLE_TESTING)
enable_testing()
add_subdirectory(test)
endif()
if (CMAKE_ENABLE_SANITIZERS)
find_package(Sanitizers)
add_sanitizers(${PROJECT_NAME} ${test_out})
add_sanitizers(${PROJECT_NAME})
endif()

set(CMAKE_C_STANDARD 90)
if (MSVC)
# Use secure functions by default and suppress warnings about "deprecated" functions
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_NONSTDC_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1")

elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra -Werror -pedantic -Wno-deprecated")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -pedantic")
endif (MSVC)

####
# Installation (https://github.com/forexample/package-example) {

set(CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
set(INCLUDE_INSTALL_DIR "include")

Expand All @@ -62,7 +84,7 @@ set(PROJECT_CONFIG "${GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(NAMESPACE "${PROJECT_NAME}::")

# Include module with fuction 'write_basic_package_version_file'
# Include module with function 'write_basic_package_version_file'
include(CMakePackageConfigHelpers)

# Note: PROJECT_VERSION is used as a VERSION
Expand Down Expand Up @@ -90,8 +112,6 @@ install(
DESTINATION "${CONFIG_INSTALL_DIR}"
)

# }

install(TARGETS ${PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_NAME}
RUNTIME DESTINATION bin
Expand All @@ -112,8 +132,8 @@ if(NOT TARGET uninstall)
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake)
endif()

find_package(Doxygen)
if(DOXYGEN_FOUND)
if(ZIP_BUILD_DOCS)
find_package(Doxygen REQUIRED)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
Expand Down
9 changes: 9 additions & 0 deletions contrib/zip/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contribution Rules/Coding Standards
No need to throw away your coding style, just do your best to follow default clang-format style.
Apply `clang-format` to the source files before commit:
```sh
for file in $(git ls-files | \grep -E '\.(c|h)$' | \grep -v -- '#')
do
clang-format -i $file
done
```
Loading

0 comments on commit 83d7216

Please sign in to comment.