Followup fully converted deps to new system

Support legacy DEP_DEBUG parameter but respecting parent CMake generator
This commit is contained in:
tamasmeszaros 2023-08-10 12:10:34 +02:00
parent 3fba2bc140
commit 03451c39e2
39 changed files with 109 additions and 181 deletions

View File

@ -1,7 +1,3 @@
#/|/ Copyright (c) Prusa Research 2021 Tomáš Mészáros @tamasmeszaros
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
if(BUILD_SHARED_LIBS)
set(_build_shared ON)
set(_build_static OFF)
@ -15,7 +11,6 @@ add_cmake_project(Blosc
#URL_HASH SHA256=7463a1df566704f212263312717ab2c36b45d45cba6cd0dccebf91b2cc4b4da9
URL https://github.com/tamasmeszaros/c-blosc/archive/refs/heads/v1.17.0_tm.zip
URL_HASH SHA256=dcb48bf43a672fa3de6a4b1de2c4c238709dad5893d1e097b8374ad84b1fc3b3
DEPENDS ${ZLIB_PKG}
# Patching upstream does not work this way with git version 2.28 installed on mac worker
# PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/blosc-mods.patch
CMAKE_ARGS
@ -25,4 +20,6 @@ add_cmake_project(Blosc
-DBUILD_TESTS=OFF
-DBUILD_BENCHMARKS=OFF
-DPREFER_EXTERNAL_ZLIB=ON
)
)
set(DEP_Blosc_DEPENDS ZLIB)

View File

@ -3,6 +3,6 @@ add_cmake_project(Boost
URL_HASH SHA256=200f9292b5ef957ab551a648834239f502df165cb7bff18432702fb7ae98accb
LIST_SEPARATOR |
CMAKE_ARGS
-DBOOST_INCLUDE_LIBRARIES:STRING=system|iostreams|filesystem|thread|log|locale|regex|date_time|beast|nowide|polygon
-DBOOST_INCLUDE_LIBRARIES:STRING=system|iostreams|filesystem|thread|log|locale|regex|date_time|beast|nowide|polygon|uuid
-DBUILD_TESTING:BOOL=OFF
)
)

View File

@ -1,15 +1,12 @@
#/|/ Copyright (c) Prusa Research 2019 - 2022 Tomáš Mészáros @tamasmeszaros, Filip Sykala @Jony01, Vojtěch Bubník @bubnikv, David Kocík @kocikdav
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
prusaslicer_add_cmake_project(
add_cmake_project(
CGAL
# GIT_REPOSITORY https://github.com/CGAL/cgal.git
# GIT_TAG bec70a6d52d8aacb0b3d82a7b4edc3caa899184b # releases/CGAL-5.0
# For whatever reason, this keeps downloading forever (repeats downloads if finished)
URL https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip
URL_HASH SHA256=d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0
DEPENDS dep_Boost dep_GMP dep_MPFR
)
include(GNUInstallDirs)
set(DEP_CGAL_DEPENDS Boost GMP MPFR)

8
deps/+GLEW/GLEW.cmake vendored Normal file
View File

@ -0,0 +1,8 @@
add_cmake_project(
GLEW
URL https://sourceforge.net/projects/glew/files/glew/2.2.0/glew-2.2.0.zip
URL_HASH SHA256=a9046a913774395a095edcc0b0ac2d81c3aacca61787b39839b941e9be14e0d4
SOURCE_SUBDIR build/cmake
CMAKE_ARGS
-DBUILD_UTILS=OFF
)

View File

@ -1,7 +1,3 @@
#/|/ Copyright (c) Prusa Research 2019 - 2021 Tomáš Mészáros @tamasmeszaros, David Kocík @kocikdav
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/gmp)
set(_dstdir ${DESTDIR}/usr/local)
@ -21,7 +17,8 @@ if (MSVC)
add_custom_target(dep_GMP SOURCES ${_output})
else ()
set(_gmp_ccflags "-O2 -DNDEBUG -fPIC -DPIC -Wall -Wmissing-prototypes -Wpointer-arith -pedantic -fomit-frame-pointer -fno-common")
string(TOUPPER ${CMAKE_BUILD_TYPE} _buildtype_upper)
set(_gmp_ccflags "${CMAKE_CXX_FLAGS}_${_buildtype_upper} -fPIC -DPIC -Wall -Wmissing-prototypes -Wpointer-arith -pedantic -fomit-frame-pointer -fno-common")
set(_gmp_build_tgt "${CMAKE_SYSTEM_PROCESSOR}")
if (APPLE)
@ -55,4 +52,4 @@ else ()
BUILD_COMMAND make -j
INSTALL_COMMAND make install
)
endif ()
endif ()

View File

@ -1,7 +1,3 @@
#/|/ Copyright (c) Prusa Research 2019 - 2021 Tomáš Mészáros @tamasmeszaros
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/mpfr)
set(_dstdir ${DESTDIR}/usr/local)
@ -37,6 +33,7 @@ else ()
CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --prefix=${DESTDIR}/usr/local --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR}/usr/local ${_gmp_build_tgt}
BUILD_COMMAND make -j
INSTALL_COMMAND make install
DEPENDS dep_GMP
)
endif ()
set(DEP_MPFR_DEPENDS GMP)

View File

@ -1,8 +1,4 @@
#/|/ Copyright (c) Prusa Research 2021 Tomáš Mészáros @tamasmeszaros
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
prusaslicer_add_cmake_project(NLopt
add_cmake_project(NLopt
URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"
URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
CMAKE_ARGS
@ -13,7 +9,3 @@ prusaslicer_add_cmake_project(NLopt
-DNLOPT_SWIG:BOOL=OFF
-DNLOPT_TESTS:BOOL=OFF
)
if (MSVC)
add_debug_dep(dep_NLopt)
endif ()

View File

@ -1,8 +1,4 @@
#/|/ Copyright (c) Prusa Research 2022 Tomáš Mészáros @tamasmeszaros
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
prusaslicer_add_cmake_project(OCCT
add_cmake_project(OCCT
#LMBBS: changed version to 7.6.2
URL https://github.com/Open-Cascade-SAS/OCCT/archive/refs/tags/V7_6_2.zip
URL_HASH SHA256=c696b923593e8c18d059709717dbf155b3e72fdd283c8522047a790ec3a432c5
@ -25,7 +21,3 @@ prusaslicer_add_cmake_project(OCCT
-DBUILD_MODULE_ModelingData=OFF
-DBUILD_MODULE_Visualization=OFF
)
if (MSVC)
add_debug_dep(dep_OCCT)
endif ()

9
deps/+OpenCSG/OpenCSG.cmake vendored Normal file
View File

@ -0,0 +1,9 @@
add_cmake_project(OpenCSG
URL https://github.com/floriankirsch/OpenCSG/archive/refs/tags/opencsg-1-4-2-release.zip
URL_HASH SHA256=51afe0db79af8386e2027d56d685177135581e0ee82ade9d7f2caff8deab5ec5
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in ./CMakeLists.txt
DEPENDS dep_GLEW
)
set(DEP_OpenCSG_DEPENDS ZLIB)

View File

@ -1,13 +1,7 @@
#/|/ Copyright (c) Prusa Research 2021 - 2023 Lukáš Matěna @lukasmatena, Tomáš Mészáros @tamasmeszaros
#/|/ Copyright (c) 2023 Robert Schiele @schiele
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
prusaslicer_add_cmake_project(OpenEXR
add_cmake_project(OpenEXR
# GIT_REPOSITORY https://github.com/openexr/openexr.git
URL https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.5.zip
URL_HASH SHA256=0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de
DEPENDS ${ZLIB_PKG}
GIT_TAG v2.5.5
PATCH_COMMAND COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/OpenEXR.patch
CMAKE_ARGS
@ -18,6 +12,4 @@ prusaslicer_add_cmake_project(OpenEXR
-DOPENEXR_BUILD_UTILS:BOOL=OFF
)
if (MSVC)
add_debug_dep(dep_OpenEXR)
endif ()
set(DEP_OpenEXR_DEPENDS ZLIB)

View File

@ -1,7 +1,3 @@
#/|/ Copyright (c) Prusa Research 2021 - 2022 Tomáš Mészáros @tamasmeszaros, Filip Sykala @Jony01
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
if(BUILD_SHARED_LIBS)
set(_build_shared ON)
set(_build_static OFF)
@ -11,17 +7,16 @@ else()
endif()
set (_openvdb_vdbprint ON)
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm" OR ${CMAKE_BUILD_TYPE} STREQUAL Debug)
# Build fails on raspberry pi due to missing link directive to latomic
# Let's hope it will be fixed soon.
set (_openvdb_vdbprint OFF)
endif ()
prusaslicer_add_cmake_project(OpenVDB
add_cmake_project(OpenVDB
# 8.2 patched
URL https://github.com/tamasmeszaros/openvdb/archive/a68fd58d0e2b85f01adeb8b13d7555183ab10aa5.zip
URL_HASH SHA256=f353e7b99bd0cbfc27ac9082de51acf32a8bc0b3e21ff9661ecca6f205ec1d81
DEPENDS dep_TBB dep_Blosc dep_OpenEXR dep_Boost
CMAKE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DOPENVDB_BUILD_PYTHON_MODULE=OFF
@ -34,15 +29,4 @@ prusaslicer_add_cmake_project(OpenVDB
-DDISABLE_DEPENDENCY_VERSION_CHECKS=ON # Centos6 has old zlib
)
if (MSVC)
if (${DEP_DEBUG})
ExternalProject_Get_Property(dep_OpenVDB BINARY_DIR)
ExternalProject_Add_Step(dep_OpenVDB build_debug
DEPENDEES build
DEPENDERS install
COMMAND ${CMAKE_COMMAND} ../dep_OpenVDB -DOPENVDB_BUILD_VDB_PRINT=OFF
COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj
WORKING_DIRECTORY "${BINARY_DIR}"
)
endif ()
endif ()
set(DEP_OpenVDB_DEPENDS TBB Blosc OpenEXR Boost)

View File

@ -1,15 +1,7 @@
#/|/ Copyright (c) Prusa Research 2021 Tomáš Mészáros @tamasmeszaros
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
include(GNUInstallDirs)
prusaslicer_add_cmake_project(Qhull
add_cmake_project(Qhull
URL "https://github.com/qhull/qhull/archive/v8.0.1.zip"
URL_HASH SHA256=5287f5edd6a0372588f5d6640799086a4033d89d19711023ef8229dd9301d69b
CMAKE_ARGS
-DINCLUDE_INSTALL_DIR=${CMAKE_INSTALL_INCLUDEDIR}
)
if (MSVC)
add_debug_dep(dep_Qhull)
endif ()

View File

@ -1,8 +1,4 @@
#/|/ Copyright (c) Prusa Research 2021 - 2022 Tomáš Mészáros @tamasmeszaros, Filip Sykala @Jony01
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
prusaslicer_add_cmake_project(
add_cmake_project(
TBB
URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.5.0.zip"
URL_HASH SHA256=83ea786c964a384dd72534f9854b419716f412f9d43c0be88d41874763e7bb47
@ -13,8 +9,4 @@ prusaslicer_add_cmake_project(
-DCMAKE_DEBUG_POSTFIX=_debug
)
if (MSVC)
add_debug_dep(dep_TBB)
endif ()

View File

@ -42,4 +42,4 @@ add_cmake_project(wxWidgets
-DwxUSE_WEBREQUEST=OFF
)
set(DEP_wxWidgets_DEPENDS ZLIB PNG EXPAT TIFF JPEG NanoSVG)
set(DEP_wxWidgets_DEPENDS ZLIB PNG EXPAT TIFF JPEG NanoSVG)

79
deps/CMakeLists.txt vendored
View File

@ -26,9 +26,8 @@
cmake_minimum_required(VERSION 3.12)
project(PrusaSlicer_deps)
# Always ON options:
if (NOT MSVC)
set(DEP_CMAKE_OPTS "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
if (MSVC)
option(DEP_DEBUG "Build in debug version of packages automatically" OFF)
endif ()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
@ -51,6 +50,27 @@ macro(list_projects result curdir)
set(${result} ${dirlist})
endmacro()
function(dep_message mode msg)
if (NOT DEP_MESSAGES_WRITTEN)
message(${mode} "${msg}")
endif()
endfunction ()
# Always ON options:
if (MSVC)
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
dep_message(STATUS "Detected 64-bit compiler => building 64-bit deps bundle")
set(DEPS_BITS 64)
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
dep_message(STATUS "Detected 32-bit compiler => building 32-bit deps bundle")
set(DEPS_BITS 32)
else ()
dep_message(FATAL_ERROR "Unable to detect architecture!")
endif ()
else ()
set(DEP_CMAKE_OPTS "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
endif ()
if (APPLE)
# This ensures dependencies don't use SDK features which are not available in the version specified by Deployment target
# That can happen when one uses a recent SDK but specifies an older Deployment target
@ -68,7 +88,8 @@ if (APPLE)
endif ()
list_projects(SUPPORTED_PACKAGES ${CMAKE_CURRENT_LIST_DIR})
message(STATUS "Found external package definitions: ${SUPPORTED_PACKAGES}")
dep_message(STATUS "Found external package definitions: ${SUPPORTED_PACKAGES}")
set(REQUIRED_PACKAGES
Boost
@ -76,7 +97,14 @@ set(REQUIRED_PACKAGES
Cereal
CURL
EXPAT
NLopt
GLEW
TBB
Qhull
wxWidgets
OpenVDB
CGAL
OCCT
)
set(SYSTEM_PROVIDED_PACKAGES OpenGL)
@ -112,24 +140,55 @@ foreach (pkg ${SUPPORTED_PACKAGES})
endforeach()
# Establish dependency graph
foreach (pkg ${REQUIRED_PACKAGES})
foreach (pkg ${SUPPORTED_PACKAGES})
foreach(deppkg ${DEP_${pkg}_DEPENDS})
if (${deppkg} IN_LIST SYSTEM_PROVIDED_PACKAGES)
find_package(${deppkg} QUIET)
if (NOT ${deppkg}_FOUND)
message(WARNING "No ${deppkg} found in system altough marked as system provided. This might cause trouble building the dependencies on this platform")
dep_message(WARNING "No ${deppkg} found in system altough marked as system provided. This might cause trouble building the dependencies on this platform")
endif ()
else ()
message(STATUS "Mapping dep_${deppkg} => dep_${pkg}")
dep_message(STATUS "Mapping dep_${deppkg} => dep_${pkg}")
add_dependencies(dep_${pkg} dep_${deppkg})
list(APPEND _build_list dep_${deppkg})
if (${pkg} IN_LIST REQUIRED_PACKAGES)
list(APPEND _build_list dep_${deppkg})
endif ()
endif ()
endforeach()
endforeach()
list(APPEND _build_list ${_dep_list})
list(REMOVE_DUPLICATES _build_list)
message(STATUS "Building dep targets: ${_build_list}")
dep_message(STATUS "Building dep targets (${CMAKE_BUILD_TYPE}): ${_build_list}")
add_custom_target(deps ALL DEPENDS ${_dep_list})
install(CODE "message(STATUS \"Built packages succesfully.\")")
# Support legacy option DEP_DEBUG on MSVC to build debug libraries in the same cmake run as for Release:
if (DEP_DEBUG AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_build_list_dbg "")
foreach (t ${_build_list})
list(APPEND _build_list_dbg ${t}_debug)
endforeach()
dep_message(STATUS "Building dep targets (Debug): ${_build_list_dbg}")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DebugBuild)
execute_process(
COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR} -G${CMAKE_GENERATOR} -DCMAKE_BUILD_TYPE=Debug -DDEP_DOWNLOAD_DIR=${DEP_DOWNLOAD_DIR} -DDESTDIR=${DESTDIR} -DDEP_MESSAGES_WRITTEN=ON
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DebugBuild
)
# Can be used to build only the debug libs
add_custom_target(deps_debug ALL)
# Each lib will have a dep_<package>_debug target to build only the debug counterpart
foreach(pkgtgt ${_build_list})
add_custom_target(${pkgtgt}_debug
COMMAND ${CMAKE_COMMAND} --build . --target ${pkgtgt}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/DebugBuild
)
add_dependencies(deps_debug ${pkgtgt}_debug)
endforeach()
endif ()
set(DEP_MESSAGES_WRITTEN ON CACHE BOOL "")
install(CODE "message(STATUS \"Built packages succesfully.\")")

20
deps/GLEW/GLEW.cmake vendored
View File

@ -1,20 +0,0 @@
#/|/ Copyright (c) Prusa Research 2019 - 2022 Tomáš Mészáros @tamasmeszaros, Filip Sykala @Jony01
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
# We have to check for OpenGL to compile GLEW
set(OpenGL_GL_PREFERENCE "LEGACY") # to prevent a nasty warning by cmake
find_package(OpenGL QUIET REQUIRED)
prusaslicer_add_cmake_project(
GLEW
URL https://sourceforge.net/projects/glew/files/glew/2.2.0/glew-2.2.0.zip
URL_HASH SHA256=a9046a913774395a095edcc0b0ac2d81c3aacca61787b39839b941e9be14e0d4
SOURCE_SUBDIR build/cmake
CMAKE_ARGS
-DBUILD_UTILS=OFF
)
if (MSVC)
add_debug_dep(dep_GLEW)
endif ()

View File

@ -1,21 +0,0 @@
#/|/ Copyright (c) Prusa Research 2019 - 2021 Tomáš Mészáros @tamasmeszaros
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
prusaslicer_add_cmake_project(OpenCSG
# GIT_REPOSITORY https://github.com/floriankirsch/OpenCSG.git
# GIT_TAG 83e274457b46c9ad11a4ee599203250b1618f3b9 #v1.4.2
URL https://github.com/floriankirsch/OpenCSG/archive/refs/tags/opencsg-1-4-2-release.zip
URL_HASH SHA256=51afe0db79af8386e2027d56d685177135581e0ee82ade9d7f2caff8deab5ec5
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in ./CMakeLists.txt
DEPENDS dep_GLEW
)
if (TARGET ${ZLIB_PKG})
add_dependencies(dep_OpenCSG ${ZLIB_PKG})
endif()
if (MSVC)
add_debug_dep(dep_OpenCSG)
endif ()

View File

@ -1,39 +0,0 @@
#/|/ Copyright (c) Prusa Research 2021 Tomáš Mészáros @tamasmeszaros
#/|/
#/|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
#/|/
include(ProcessorCount)
ProcessorCount(NPROC)
set(_conf_cmd "./config")
set(_cross_arch "")
set(_cross_comp_prefix_line "")
if (CMAKE_CROSSCOMPILING)
set(_conf_cmd "./Configure")
set(_cross_comp_prefix_line "--cross-compile-prefix=${TOOLCHAIN_PREFIX}-")
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
set(_cross_arch "linux-aarch64")
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armhf") # For raspbian
# TODO: verify
set(_cross_arch "linux-armv4")
endif ()
endif ()
ExternalProject_Add(dep_OpenSSL
EXCLUDE_FROM_ALL ON
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0l.tar.gz"
URL_HASH SHA256=e2acf0cf58d9bff2b42f2dc0aee79340c8ffe2c5e45d3ca4533dd5d4f5775b1d
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/OpenSSL
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND ${_conf_cmd} ${_cross_arch}
"--prefix=${DESTDIR}/usr/local"
${_cross_comp_prefix_line}
no-shared
no-ssl3-method
no-dynamic-engine
-Wa,--noexecstack
BUILD_COMMAND make depend && make "-j${NPROC}"
INSTALL_COMMAND make install_sw
)