Fix zlib dependencies and CMAKE_MODULE_PATH forwarding
This commit is contained in:
parent
c91046925a
commit
4a4d8b4e26
1
deps/CMakeLists.txt
vendored
1
deps/CMakeLists.txt
vendored
@ -67,6 +67,7 @@ function(prusaslicer_add_cmake_project projectname)
|
||||
${_gen}
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}/usr/local
|
||||
-DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/../cmake/modules
|
||||
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}/usr/local
|
||||
-DCMAKE_DEBUG_POSTFIX:STRING=d
|
||||
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
|
||||
|
2
deps/OpenCSG/CMakeLists.txt.in
vendored
2
deps/OpenCSG/CMakeLists.txt.in
vendored
@ -9,6 +9,8 @@ elseif (MSVC)
|
||||
endif()
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
set(GLEW_VERBOSE ON)
|
||||
find_package(GLEW 1.13.0 REQUIRED)
|
||||
|
||||
set(_srcfiles
|
||||
|
4
deps/OpenCSG/OpenCSG.cmake
vendored
4
deps/OpenCSG/OpenCSG.cmake
vendored
@ -6,6 +6,10 @@ prusaslicer_add_cmake_project(OpenCSG
|
||||
DEPENDS dep_GLEW
|
||||
)
|
||||
|
||||
if (TARGET dep_ZLIB)
|
||||
add_dependencies(dep_OpenCSG dep_ZLIB)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_OpenCSG)
|
||||
endif ()
|
51
deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch
vendored
Normal file
51
deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
From 0c64e33bc2e4e7c011f5a64f5d9c7571a434cc86 Mon Sep 17 00:00:00 2001
|
||||
From: tamasmeszaros <meszaros.q@gmail.com>
|
||||
Date: Sat, 16 Nov 2019 13:43:17 +0100
|
||||
Subject: [PATCH] Respect BUILD_SHARED_LIBS
|
||||
|
||||
---
|
||||
CMakeLists.txt | 14 ++++++++------
|
||||
1 file changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 0fe939d..01dfea1 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -183,10 +183,12 @@ if(MINGW)
|
||||
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
|
||||
endif(MINGW)
|
||||
|
||||
-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
-set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||
-set_target_properties(zlib PROPERTIES SOVERSION 1)
|
||||
+add_library(zlib ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
||||
+if (BUILD_SHARED_LIBS)
|
||||
+ target_sources(zlib PRIVATE ${ZLIB_DLL_SRCS})
|
||||
+ set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
||||
+ set_target_properties(zlib PROPERTIES SOVERSION 1)
|
||||
+endif()
|
||||
|
||||
if(NOT CYGWIN)
|
||||
# This property causes shared libraries on Linux to have the full version
|
||||
@@ -201,7 +203,7 @@ endif()
|
||||
|
||||
if(UNIX)
|
||||
# On unix-like platforms the library is almost always called libz
|
||||
- set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
|
||||
+ set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
|
||||
if(NOT APPLE)
|
||||
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
|
||||
endif()
|
||||
@@ -211,7 +213,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32)
|
||||
endif()
|
||||
|
||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
||||
- install(TARGETS zlib zlibstatic
|
||||
+ install(TARGETS zlib
|
||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
|
||||
--
|
||||
2.16.2.windows.1
|
||||
|
10
deps/ZLIB/ZLIB.cmake
vendored
Normal file
10
deps/ZLIB/ZLIB.cmake
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
prusaslicer_add_cmake_project(ZLIB
|
||||
GIT_REPOSITORY https://github.com/madler/zlib.git
|
||||
GIT_TAG v1.2.11
|
||||
PATCH_COMMAND ${GIT_EXECUTABLE} checkout -f -- . && git clean -df &&
|
||||
${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-Respect-BUILD_SHARED_LIBS.patch
|
||||
CMAKE_ARGS
|
||||
-DSKIP_INSTALL_FILES=ON # Prevent installation of man pages et al.
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
)
|
||||
|
5
deps/deps-unix-common.cmake
vendored
5
deps/deps-unix-common.cmake
vendored
@ -7,7 +7,10 @@ else ()
|
||||
set(TBB_MINGW_WORKAROUND "")
|
||||
endif ()
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(ZLIB QUIET)
|
||||
if (NOT ZLIB_FOUND)
|
||||
include(ZLIB/ZLIB.cmake)
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(dep_tbb
|
||||
EXCLUDE_FROM_ALL 1
|
||||
|
59
deps/deps-windows.cmake
vendored
59
deps/deps-windows.cmake
vendored
@ -149,36 +149,37 @@ ExternalProject_Add(dep_nlopt
|
||||
|
||||
add_debug_dep(dep_nlopt)
|
||||
|
||||
ExternalProject_Add(dep_zlib
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://zlib.net/zlib-1.2.11.tar.xz"
|
||||
URL_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}"
|
||||
CMAKE_ARGS
|
||||
-DSKIP_INSTALL_FILES=ON # Prevent installation of man pages et al.
|
||||
"-DINSTALL_BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}\\fallout" # I found no better way of preventing zlib from creating & installing DLLs :-/
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
include(ZLIB/ZLIB.cmake)
|
||||
# ExternalProject_Add(dep_zlib
|
||||
# EXCLUDE_FROM_ALL 1
|
||||
# URL "https://zlib.net/zlib-1.2.11.tar.xz"
|
||||
# URL_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
|
||||
# CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
# CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}"
|
||||
# CMAKE_ARGS
|
||||
# -DSKIP_INSTALL_FILES=ON # Prevent installation of man pages et al.
|
||||
# "-DINSTALL_BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}\\fallout" # I found no better way of preventing zlib from creating & installing DLLs :-/
|
||||
# -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
# "-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
# BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj
|
||||
# INSTALL_COMMAND ""
|
||||
# )
|
||||
|
||||
add_debug_dep(dep_zlib)
|
||||
add_debug_dep(dep_ZLIB)
|
||||
|
||||
# The following steps are unfortunately needed to remove the _static suffix on libraries
|
||||
ExternalProject_Add_Step(dep_zlib fix_static
|
||||
DEPENDEES install
|
||||
COMMAND "${CMAKE_COMMAND}" -E rename zlibstatic.lib zlib.lib
|
||||
WORKING_DIRECTORY "${DESTDIR}\\usr\\local\\lib\\"
|
||||
)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Add_Step(dep_zlib fix_static_debug
|
||||
DEPENDEES install
|
||||
COMMAND "${CMAKE_COMMAND}" -E rename zlibstaticd.lib zlibd.lib
|
||||
WORKING_DIRECTORY "${DESTDIR}\\usr\\local\\lib\\"
|
||||
)
|
||||
endif ()
|
||||
# ExternalProject_Add_Step(dep_zlib fix_static
|
||||
# DEPENDEES install
|
||||
# COMMAND "${CMAKE_COMMAND}" -E rename zlibstatic.lib zlib.lib
|
||||
# WORKING_DIRECTORY "${DESTDIR}\\usr\\local\\lib\\"
|
||||
# )
|
||||
# if (${DEP_DEBUG})
|
||||
# ExternalProject_Add_Step(dep_zlib fix_static_debug
|
||||
# DEPENDEES install
|
||||
# COMMAND "${CMAKE_COMMAND}" -E rename zlibstaticd.lib zlibd.lib
|
||||
# WORKING_DIRECTORY "${DESTDIR}\\usr\\local\\lib\\"
|
||||
# )
|
||||
# endif ()
|
||||
|
||||
if (${DEPS_BITS} EQUAL 32)
|
||||
set(DEP_LIBCURL_TARGET "x86")
|
||||
@ -273,7 +274,7 @@ ExternalProject_Add(dep_blosc
|
||||
#URL_HASH SHA256=7463a1df566704f212263312717ab2c36b45d45cba6cd0dccebf91b2cc4b4da9
|
||||
GIT_REPOSITORY https://github.com/Blosc/c-blosc.git
|
||||
GIT_TAG e63775855294b50820ef44d1b157f4de1cc38d3e #v1.17.0
|
||||
DEPENDS dep_zlib
|
||||
DEPENDS dep_ZLIB
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}"
|
||||
CMAKE_ARGS
|
||||
@ -300,7 +301,7 @@ ExternalProject_Add(dep_openexr
|
||||
EXCLUDE_FROM_ALL 1
|
||||
GIT_REPOSITORY https://github.com/openexr/openexr.git
|
||||
GIT_TAG eae0e337c9f5117e78114fd05f7a415819df413a #v2.4.0
|
||||
DEPENDS dep_zlib
|
||||
DEPENDS dep_ZLIB
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}"
|
||||
CMAKE_ARGS
|
||||
|
Loading…
Reference in New Issue
Block a user