mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-30 08:11:59 +08:00
Add presets and deps autobuild
This commit is contained in:
parent
34f76e1228
commit
0436acc7d9
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,6 +16,8 @@ local-lib
|
||||
/src/TAGS
|
||||
/.vscode/
|
||||
build-linux/*
|
||||
deps/build*
|
||||
deps/build-linux/*
|
||||
**/.DS_Store
|
||||
**/.idea/
|
||||
.pkg_cache
|
||||
|
@ -60,6 +60,15 @@ if (SLIC3R_STATIC)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
endif ()
|
||||
|
||||
# Dependency build management
|
||||
option(${PROJECT_NAME}_BUILD_DEPS "Build dependencies before the project" OFF)
|
||||
option(${PROJECT_NAME}_DEPS_OUTPUT_QUIET "Don't print build output for dependencies" OFF)
|
||||
set(${PROJECT_NAME}_DEPS_PRESET "default" CACHE STRING "Preset of the dependencies when ${PROJECT_NAME}_BUILD_DEPS is ON")
|
||||
set(${PROJECT_NAME}_DEPS_BUILD_DIR "" CACHE PATH "Binary dir of the dependencies build when ${PROJECT_NAME}_BUILD_DEPS is ON")
|
||||
if (${PROJECT_NAME}_BUILD_DEPS)
|
||||
include(deps/autobuild.cmake)
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
set(CMAKE_FIND_FRAMEWORK LAST)
|
||||
set(CMAKE_FIND_APPBUNDLE LAST)
|
||||
|
28
CMakePresets.json
Normal file
28
CMakePresets.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"displayName": "Default Config",
|
||||
"description": "Building with statically linked dependencies",
|
||||
"binaryDir": "${sourceDir}/build-default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"SLIC3R_STATIC": true,
|
||||
"SLIC3R_GTK": "3",
|
||||
"SLIC3R_ENC_CHECK": false,
|
||||
"SLIC3R_PCH": true,
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build-default/dist",
|
||||
"PrusaSlicer_DEPS_PRESET": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "no-occt",
|
||||
"inherits": "default",
|
||||
"cacheVariables": {
|
||||
"SLIC3R_ENABLE_FORMAT_STEP": false,
|
||||
"PrusaSlicer_DEPS_PRESET": "no-occt"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
4
deps/CMakeLists.txt
vendored
4
deps/CMakeLists.txt
vendored
@ -114,6 +114,7 @@ if (APPLE)
|
||||
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
|
||||
"-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}"
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}"
|
||||
"-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}"
|
||||
"-DCMAKE_CXX_FLAGS=${DEP_WERRORS_SDK}"
|
||||
"-DCMAKE_C_FLAGS=${DEP_WERRORS_SDK}"
|
||||
"-DCMAKE_FIND_FRAMEWORK=LAST"
|
||||
@ -139,8 +140,9 @@ set(REQUIRED_PACKAGES
|
||||
wxWidgets
|
||||
OpenVDB
|
||||
CGAL
|
||||
# OCCT
|
||||
OCCT
|
||||
ZLIB
|
||||
LibBGCode
|
||||
)
|
||||
|
||||
set(${PROJECT_NAME}_PLATFORM_PACKAGES "" CACHE STRING "Select packages which are provided by the platform" )
|
||||
|
54
deps/CMakePresets.json
vendored
Normal file
54
deps/CMakePresets.json
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"displayName": "Default Config",
|
||||
"description": "Default build for any desktop OS",
|
||||
"binaryDir": "${sourceDir}/build-default",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"DEP_DOWNLOAD_DIR": {
|
||||
"type": "PATH",
|
||||
"value": "${sourceDir}/.pkg_cache"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "no-occt",
|
||||
"inherits": "default",
|
||||
"binaryDir": "${sourceDir}/build-no-occt",
|
||||
"cacheVariables": {
|
||||
"PrusaSlicer_deps_PACKAGE_EXCLUDES": "OCCT"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mac_universal_x86",
|
||||
"inherits": "default",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-x86_64",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Darwin"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_OSX_ARCHITECTURES": "x86_64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mac_universal_arm",
|
||||
"inherits": "default",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build-arm64",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Darwin"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_OSX_ARCHITECTURES": "arm64"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
63
deps/autobuild.cmake
vendored
Normal file
63
deps/autobuild.cmake
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
if (NOT ${PROJECT_NAME}_DEPS_PRESET)
|
||||
set (${PROJECT_NAME}_DEPS_PRESET "default")
|
||||
endif ()
|
||||
|
||||
set (_output_quiet "")
|
||||
if (${PROJECT_NAME}_DEPS_OUTPUT_QUIET)
|
||||
set (_output_quiet OUTPUT_QUIET)
|
||||
endif ()
|
||||
|
||||
message(STATUS "Building the dependencies with preset ${${PROJECT_NAME}_DEPS_PRESET}")
|
||||
|
||||
set(_gen_arg "")
|
||||
if (CMAKE_GENERATOR)
|
||||
set (_gen_arg "-G${CMAKE_GENERATOR}")
|
||||
endif ()
|
||||
|
||||
set(_build_args "")
|
||||
|
||||
if (CMAKE_C_COMPILER)
|
||||
list(APPEND _build_args "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_CXX_COMPILER)
|
||||
list(APPEND _build_args "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_TOOLCHAIN_FILE)
|
||||
list(APPEND _build_args "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
|
||||
endif ()
|
||||
|
||||
set(_build_dir "${CMAKE_CURRENT_LIST_DIR}/build-${${PROJECT_NAME}_DEPS_PRESET}")
|
||||
if (${PROJECT_NAME}_DEPS_BUILD_DIR)
|
||||
set(_build_dir "${${PROJECT_NAME}_DEPS_BUILD_DIR}")
|
||||
endif ()
|
||||
|
||||
message(STATUS "build dir = ${_build_dir}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} --preset ${${PROJECT_NAME}_DEPS_PRESET} "${_gen_arg}" -B ${_build_dir} ${_build_args}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
${_output_quiet}
|
||||
ERROR_VARIABLE _deps_configure_output
|
||||
RESULT_VARIABLE _deps_configure_result
|
||||
)
|
||||
|
||||
if (NOT _deps_configure_result EQUAL 0)
|
||||
message(FATAL_ERROR "Dependency configure failed with output:\n${_deps_configure_output}")
|
||||
else ()
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} --build .
|
||||
WORKING_DIRECTORY ${_build_dir}
|
||||
${_output_quiet}
|
||||
ERROR_VARIABLE _deps_build_output
|
||||
RESULT_VARIABLE _deps_build_result
|
||||
)
|
||||
if (NOT _deps_build_result EQUAL 0)
|
||||
message(FATAL_ERROR "Dependency build failed with output:\n${_deps_build_output}")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
list(APPEND CMAKE_PREFIX_PATH ${_build_dir}/destdir/usr/local)
|
||||
set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}" CACHE STRING "")
|
||||
|
Loading…
x
Reference in New Issue
Block a user