mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-02 23:20:38 +08:00
Remove the need to list libraries to build in deps/CMakeLists.txt
This commit is contained in:
parent
c15501bf8a
commit
0fefc13599
@ -12,6 +12,11 @@ if (NOT CMAKE_BUILD_TYPE)
|
|||||||
message(STATUS "Forcing CMAKE_BUILD_TYPE to Release as it was not specified.")
|
message(STATUS "Forcing CMAKE_BUILD_TYPE to Release as it was not specified.")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
# This is a wrapper function around ExternalProject_Add to simplify adding
|
||||||
|
# CMake based external projects. It will forward common build configuration from the parent
|
||||||
|
# project and set up multithreaded build for various generators.
|
||||||
|
# The function signiture is identical to that of ExternalProject_Add, except that the
|
||||||
|
# BUILD_COMMAND, INSTALL_COMMAND and INSTALL_DIR arguments are ignored.
|
||||||
# The value of CMAKE_BUILD_TYPE will be used for building each dependency even if the
|
# The value of CMAKE_BUILD_TYPE will be used for building each dependency even if the
|
||||||
# generator is multi-config. Use this var to specify build type regardless of the generator.
|
# generator is multi-config. Use this var to specify build type regardless of the generator.
|
||||||
function(add_cmake_project projectname)
|
function(add_cmake_project projectname)
|
||||||
@ -53,7 +58,6 @@ function(add_cmake_project projectname)
|
|||||||
|
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
dep_${projectname}
|
dep_${projectname}
|
||||||
EXCLUDE_FROM_ALL ON # Not built by default, dep_${projectname} needs to be added to ALL target
|
|
||||||
INSTALL_DIR ${${PROJECT_NAME}_DEP_INSTALL_PREFIX}
|
INSTALL_DIR ${${PROJECT_NAME}_DEP_INSTALL_PREFIX}
|
||||||
DOWNLOAD_DIR ${${PROJECT_NAME}_DEP_DOWNLOAD_DIR}/${projectname}
|
DOWNLOAD_DIR ${${PROJECT_NAME}_DEP_DOWNLOAD_DIR}/${projectname}
|
||||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/builds/${projectname}
|
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/builds/${projectname}
|
||||||
|
1
deps/+OpenCSG/OpenCSG.cmake
vendored
1
deps/+OpenCSG/OpenCSG.cmake
vendored
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
add_cmake_project(OpenCSG
|
add_cmake_project(OpenCSG
|
||||||
|
EXCLUDE_FROM_ALL ON # No need to build this lib by default. Only used in experiment in sandboxes/opencsg
|
||||||
URL https://github.com/floriankirsch/OpenCSG/archive/refs/tags/opencsg-1-4-2-release.zip
|
URL https://github.com/floriankirsch/OpenCSG/archive/refs/tags/opencsg-1-4-2-release.zip
|
||||||
URL_HASH SHA256=51afe0db79af8386e2027d56d685177135581e0ee82ade9d7f2caff8deab5ec5
|
URL_HASH SHA256=51afe0db79af8386e2027d56d685177135581e0ee82ade9d7f2caff8deab5ec5
|
||||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in ./CMakeLists.txt
|
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in ./CMakeLists.txt
|
||||||
|
29
deps/CMakeLists.txt
vendored
29
deps/CMakeLists.txt
vendored
@ -60,7 +60,7 @@ macro(list_projects result curdir)
|
|||||||
set(dirlist "")
|
set(dirlist "")
|
||||||
foreach(child ${children})
|
foreach(child ${children})
|
||||||
if(IS_DIRECTORY ${curdir}/${child})
|
if(IS_DIRECTORY ${curdir}/${child})
|
||||||
string(REGEX MATCH "^\\+([a-zA-Z0-9]+)" is_package_dir ${child})
|
string(REGEX MATCH "^\\+([a-zA-Z0-9_]+)" is_package_dir ${child})
|
||||||
if(is_package_dir AND EXISTS ${curdir}/${child}/${CMAKE_MATCH_1}.cmake)
|
if(is_package_dir AND EXISTS ${curdir}/${child}/${CMAKE_MATCH_1}.cmake)
|
||||||
list(APPEND dirlist ${CMAKE_MATCH_1})
|
list(APPEND dirlist ${CMAKE_MATCH_1})
|
||||||
endif()
|
endif()
|
||||||
@ -127,25 +127,6 @@ list_projects(FOUND_PACKAGES ${CMAKE_CURRENT_LIST_DIR})
|
|||||||
|
|
||||||
dep_message(STATUS "Found external package definitions: ${FOUND_PACKAGES}")
|
dep_message(STATUS "Found external package definitions: ${FOUND_PACKAGES}")
|
||||||
|
|
||||||
# Current list of all required dependencies for PS (top level)
|
|
||||||
set(REQUIRED_PACKAGES
|
|
||||||
Boost
|
|
||||||
Catch2
|
|
||||||
Cereal
|
|
||||||
CURL
|
|
||||||
EXPAT
|
|
||||||
NLopt
|
|
||||||
GLEW
|
|
||||||
TBB
|
|
||||||
Qhull
|
|
||||||
wxWidgets
|
|
||||||
OpenVDB
|
|
||||||
CGAL
|
|
||||||
OCCT
|
|
||||||
ZLIB
|
|
||||||
LibBGCode
|
|
||||||
)
|
|
||||||
|
|
||||||
set(${PROJECT_NAME}_PLATFORM_PACKAGES "" CACHE STRING "Select packages which are provided by the platform" )
|
set(${PROJECT_NAME}_PLATFORM_PACKAGES "" CACHE STRING "Select packages which are provided by the platform" )
|
||||||
set(SYSTEM_PROVIDED_PACKAGES OpenGL)
|
set(SYSTEM_PROVIDED_PACKAGES OpenGL)
|
||||||
|
|
||||||
@ -159,7 +140,6 @@ if (UNIX)
|
|||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
list(APPEND SYSTEM_PROVIDED_PACKAGES ${${PROJECT_NAME}_PLATFORM_PACKAGES})
|
list(APPEND SYSTEM_PROVIDED_PACKAGES ${${PROJECT_NAME}_PLATFORM_PACKAGES})
|
||||||
list(REMOVE_DUPLICATES SYSTEM_PROVIDED_PACKAGES)
|
list(REMOVE_DUPLICATES SYSTEM_PROVIDED_PACKAGES)
|
||||||
|
|
||||||
@ -200,10 +180,13 @@ foreach (pkg ${FOUND_PACKAGES})
|
|||||||
|
|
||||||
if (${pkg} IN_LIST SYSTEM_PROVIDED_PACKAGES)
|
if (${pkg} IN_LIST SYSTEM_PROVIDED_PACKAGES)
|
||||||
check_system_package(${pkg} _checked_list)
|
check_system_package(${pkg} _checked_list)
|
||||||
elseif (${pkg} IN_LIST REQUIRED_PACKAGES)
|
else ()
|
||||||
|
get_target_property(_is_excluded_from_all dep_${pkg} EXCLUDE_FROM_ALL)
|
||||||
|
if (NOT _is_excluded_from_all)
|
||||||
list(APPEND DEPS_TO_BUILD ${pkg})
|
list(APPEND DEPS_TO_BUILD ${pkg})
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
endif ()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Establish dependency graph
|
# Establish dependency graph
|
||||||
@ -218,10 +201,8 @@ foreach (pkg ${SUPPORTED_PACKAGES})
|
|||||||
elseif(TARGET dep_${deppkg})
|
elseif(TARGET dep_${deppkg})
|
||||||
dep_message(STATUS "Mapping dep_${deppkg} => dep_${pkg}")
|
dep_message(STATUS "Mapping dep_${deppkg} => dep_${pkg}")
|
||||||
add_dependencies(dep_${pkg} dep_${deppkg})
|
add_dependencies(dep_${pkg} dep_${deppkg})
|
||||||
if (${pkg} IN_LIST REQUIRED_PACKAGES)
|
|
||||||
list(APPEND _build_list dep_${deppkg})
|
list(APPEND _build_list dep_${deppkg})
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user