Skip to content
Permalink
Browse files

Replace zlib with miniz to reduce dependencies

Warning: defines NOCRYPT and NOUNCRYPT, so there is
no support for password protected zip files.
  • Loading branch information...
morlad committed May 23, 2019
1 parent 5d5a310 commit d82170ba3b8ebfd467c20a707a9aa39c19b20657
@@ -6,9 +6,13 @@ set (CMAKE_CXX_STANDARD 11)
# set the mode flag as static to compile statically, for example:
# cmake -D mode=static .

include_directories(include additional_dependencies)
# MSVC: set the crtmode flag to 'static' to include the Visual C++
# runtime statically. Requires libcurl to be built with /MT as well.
# cmake -D crtmode=static .

file(GLOB_RECURSE SOURCES "src/*.cpp")
include_directories(include additional_dependencies include/dependencies/miniz)

file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.c")

if( mode AND mode STREQUAL "static" )
message("Building mod.io SDK statically")
@@ -22,19 +26,17 @@ else()
endif()

IF (APPLE)
find_package(ZLIB REQUIRED)
find_package(CURL REQUIRED)
target_link_libraries(modio ${CURL_LIBRARIES} ZLIB::ZLIB)
target_link_libraries(modio ${CURL_LIBRARIES})
ENDIF()

IF (UNIX AND NOT APPLE)
target_link_libraries (modio curl z)
target_link_libraries (modio curl)
ENDIF ()

IF (MINGW)
target_link_libraries(modio
${CMAKE_SOURCE_DIR}/lib/MinGW/libcurl.a
${CMAKE_SOURCE_DIR}/lib/MinGW/libz.a
${CMAKE_SOURCE_DIR}/lib/MinGW/libcrypto.dll.a
${CMAKE_SOURCE_DIR}/lib/MinGW/libeay32.dll
${CMAKE_SOURCE_DIR}/lib/MinGW/libssl.dll.a
@@ -60,17 +62,17 @@ IF (MSVC)
endforeach()

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_link_libraries(modio ${CMAKE_SOURCE_DIR}/lib/MSVC/x64/static/libcurl_a.lib ${CMAKE_SOURCE_DIR}/lib/MSVC/x64/static/zlib.lib )
target_link_libraries(modio ${CMAKE_SOURCE_DIR}/lib/MSVC/x64/static/libcurl_a.lib)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_link_libraries(modio ${CMAKE_SOURCE_DIR}/lib/MSVC/x86/static/libcurl_a.lib ${CMAKE_SOURCE_DIR}/lib/MSVC/x86/static/zlib.lib )
target_link_libraries(modio ${CMAKE_SOURCE_DIR}/lib/MSVC/x86/static/libcurl_a.lib)
endif()

ELSE()

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_link_libraries(modio ${CMAKE_SOURCE_DIR}/lib/MSVC/x64/libcurl_a.lib ${CMAKE_SOURCE_DIR}/lib/MSVC/x64/zlib.lib )
target_link_libraries(modio ${CMAKE_SOURCE_DIR}/lib/MSVC/x64/libcurl_a.lib)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_link_libraries(modio ${CMAKE_SOURCE_DIR}/lib/MSVC/x86/libcurl_a.lib ${CMAKE_SOURCE_DIR}/lib/MSVC/x86/zlib.lib )
target_link_libraries(modio ${CMAKE_SOURCE_DIR}/lib/MSVC/x86/libcurl_a.lib)
endif()

ENDIF()
@@ -86,4 +88,4 @@ IF( test AND test STREQUAL "on" )
add_executable(runUnitTests ${TEST_SRC_FILES})
target_link_libraries(runUnitTests gtest gtest_main modio)
add_test(UnitTests runUnitTests)
ENDIF()
ENDIF()

0 comments on commit d82170b

Please sign in to comment.
You can’t perform that action at this time.