Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
cmake_minimum_required(VERSION 3.13)

option(CREALITYPRINT_REQUIRE_OFFLINE_WEBVIEW2_INSTALLER
"Require the offline WebView2 Runtime installer when installing on Windows" ON)

set(CREALITYPRINT_BUILD_JOBS "" CACHE STRING
"Maximum compiler processes for supported builds; empty preserves the legacy default")
if (NOT "${CREALITYPRINT_BUILD_JOBS}" STREQUAL "" AND
NOT "${CREALITYPRINT_BUILD_JOBS}" MATCHES "^[1-9][0-9]*$")
message(FATAL_ERROR "CREALITYPRINT_BUILD_JOBS must be a positive integer or empty")
endif ()

if (APPLE)
# if CMAKE_OSX_DEPLOYMENT_TARGET is not set, set it to 11.3
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
Expand Down Expand Up @@ -180,7 +190,11 @@ endif ()

if (MSVC)
if (SLIC3R_MSVC_COMPILE_PARALLEL AND NOT IS_CLANG_CL)
add_compile_options(/MP)
if ("${CREALITYPRINT_BUILD_JOBS}" STREQUAL "")
add_compile_options(/MP)
else ()
add_compile_options("/MP${CREALITYPRINT_BUILD_JOBS}")
endif ()
endif ()
# /bigobj (Increase Number of Sections in .Obj file)
# error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm90' or greater
Expand Down
121 changes: 120 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,108 @@
"CMAKE_OSX_DEPLOYMENT_TARGET": "11.3",
"CMAKE_MACOSX_BUNDLE": "ON"
}
},
{
"name": "_windows-vs2026-v143-x64",
"hidden": true,
"generator": "Visual Studio 18 2026",
"architecture": {
"value": "x64",
"strategy": "set"
},
"toolset": {
"value": "v143,host=x64",
"strategy": "set"
},
"binaryDir": "${sourceDir}/out/build/app/${presetName}",
"installDir": "${sourceDir}/out/install/app/${presetName}",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"CMAKE_SYSTEM_VERSION": {
"type": "STRING",
"value": "10.0.26100.0"
},
"BBL_RELEASE_TO_PUBLIC": {
"type": "BOOL",
"value": true
},
"GENERATE_ORCA_HEADER": {
"type": "BOOL",
"value": true
},
"ENABLE_BREAKPAD": {
"type": "BOOL",
"value": true
},
"CREALITYPRINT_REQUIRE_OFFLINE_WEBVIEW2_INSTALLER": {
"type": "BOOL",
"value": false
},
"CREALITYPRINT_BUILD_JOBS": {
"type": "STRING",
"value": "8"
},
"SLIC3R_BUILD_TESTS": {
"type": "BOOL",
"value": false
},
"SLIC3R_STATIC": {
"type": "BOOL",
"value": true
},
"UPDATE_ONLINE_MACHINES": {
"type": "BOOL",
"value": true
},
"WIN10SDK_PATH": {
"type": "PATH",
"value": "C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0"
},
"CMAKE_PREFIX_PATH": {
"type": "PATH",
"value": "${sourceDir}/out/install/deps/${presetName}/usr/local"
},
"CMAKE_FIND_USE_PACKAGE_ROOT_PATH": {
"type": "BOOL",
"value": false
},
"CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH": {
"type": "BOOL",
"value": false
},
"CMAKE_FIND_USE_PACKAGE_REGISTRY": {
"type": "BOOL",
"value": false
},
"CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY": {
"type": "BOOL",
"value": false
},
"CMAKE_EXPORT_NO_PACKAGE_REGISTRY": {
"type": "BOOL",
"value": true
}
}
},
{
"name": "windows-vs2026-v143-x64-release",
"displayName": "Windows VS2026 v143 x64 Release",
"description": "Build CrealityPrint Release with VS2026 and the v143 toolset",
"inherits": "_windows-vs2026-v143-x64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": {
"type": "STRING",
"value": "Release"
},
"CMAKE_CONFIGURATION_TYPES": {
"type": "STRING",
"value": "Release"
}
}
}
],
"buildPresets": [
Expand All @@ -213,6 +315,23 @@
"configurePreset": "x64-release",
"inherits": "x64-debug",
"description": "Windows Release Build"
},
{
"name": "windows-vs2026-v143-x64-release",
"displayName": "Build Windows VS2026 v143 x64 Release",
"configurePreset": "windows-vs2026-v143-x64-release",
"configuration": "Release",
"jobs": 8
},
{
"name": "windows-vs2026-v143-x64-release-install",
"displayName": "Install Windows VS2026 v143 x64 Release",
"configurePreset": "windows-vs2026-v143-x64-release",
"configuration": "Release",
"targets": [
"install"
],
"jobs": 8
}
],
"testPresets": [
Expand All @@ -230,4 +349,4 @@
"configurePreset": "x64-debug"
}
]
}
}
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Creality Print 6.0
Creality Print 6.0 is an open source slicer for FDM printers. [Offical Wiki](https://wiki.creality.com/en/software)
# Creality Print 7.0
Creality Print 7.0 is an open source slicer for FDM printers. [Offical Wiki](https://wiki.creality.com/en/software)

# Join community

Expand Down Expand Up @@ -124,7 +124,13 @@ CrealityPrint.exe --slice 0 --outputdir "C:\output" --load_settings "C:\presets\
Run `CrealityPrint.exe --help` to see the full list of supported command line options.

# How to compile
- Windows 64-bit
- Windows 64-bit with Visual Studio 2026 and the v143 toolset
- Use the additive `windows-vs2026-v143-x64-release` presets through
`pwsh -File scripts/build_windows_vs2026.ps1 -Target All -Fresh`.
- See [Windows VS2026/v143 clean build](doc/windows-vs2026-build.md) for
prerequisites, output paths, and safety checks.

- Legacy Windows 64-bit (Visual Studio 2019)
- Tools needed: Visual Studio 2019, Cmake, git, git-lfs, Strawberry Perl.
- You will require cmake version 3.14 or later, which is available [on their website](https://cmake.org/download/).
- Strawberry Perl is [available on their github repository](https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/).
Expand Down
69 changes: 59 additions & 10 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# therefore, unfortunatelly, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
#

cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
if (APPLE)
# if CMAKE_OSX_DEPLOYMENT_TARGET is not set, set it to 11.3
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
Expand All @@ -40,6 +40,14 @@ if (NPROC EQUAL 0)
set(NPROC 1)
endif ()

set(CREALITYPRINT_BUILD_JOBS "${NPROC}" CACHE STRING
"Maximum parallel jobs for dependency child builds")
if (NOT "${CREALITYPRINT_BUILD_JOBS}" MATCHES "^[1-9][0-9]*$")
message(FATAL_ERROR "CREALITYPRINT_BUILD_JOBS must be a positive integer")
endif ()
option(CREALITYPRINT_STRICT_PATH_TOOLCHAIN_MATCH
"Require cl.exe on PATH to be the compiler selected by CMake" OFF)

set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/../DL_CACHE CACHE PATH "Path for downloaded source packages.")
set(FLATPAK FALSE CACHE BOOL "Toggles various build settings for flatpak, like /usr/local in DESTDIR or not building wxwidgets")
Expand Down Expand Up @@ -93,6 +101,28 @@ message(STATUS "OrcaSlicer deps debug build: ${DEP_DEBUG}")

find_package(Git REQUIRED)

# Some dependency projects use custom nmake-based build steps. Ensure those
# commands see the same compiler selected by the parent Visual Studio generator
# instead of silently falling back to another toolset from PATH.
if (MSVC AND CREALITYPRINT_STRICT_PATH_TOOLCHAIN_MATCH)
find_program(DEP_PATH_CL_EXECUTABLE NAMES cl.exe cl)
if (NOT DEP_PATH_CL_EXECUTABLE)
message(FATAL_ERROR "MSVC was selected, but cl.exe is not available on PATH")
endif ()

get_filename_component(_selected_cl "${CMAKE_CXX_COMPILER}" REALPATH)
get_filename_component(_path_cl "${DEP_PATH_CL_EXECUTABLE}" REALPATH)
file(TO_CMAKE_PATH "${_selected_cl}" _selected_cl)
file(TO_CMAKE_PATH "${_path_cl}" _path_cl)
string(TOLOWER "${_selected_cl}" _selected_cl_cmp)
string(TOLOWER "${_path_cl}" _path_cl_cmp)
if (NOT _selected_cl_cmp STREQUAL _path_cl_cmp)
message(FATAL_ERROR
"The selected compiler (${_selected_cl}) differs from cl.exe on PATH (${_path_cl}). "
"Enter a developer shell for the selected toolset before configuring dependencies.")
endif ()
endif ()

# The default command line for patching. Only works for newer
set(PATCH_CMD ${GIT_EXECUTABLE} apply --verbose --ignore-space-change --whitespace=fix)

Expand All @@ -114,10 +144,29 @@ function(orcaslicer_add_cmake_project projectname)
endif ()

set(_gen "")
set(_build_j "-j${NPROC}")
set(_build_parallel_args --parallel "${CREALITYPRINT_BUILD_JOBS}")
set(_build_native_args "")
if (MSVC)
set(_gen CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}")
set(_build_j "/m")
set(_gen CMAKE_GENERATOR "${CMAKE_GENERATOR}")

if (CMAKE_GENERATOR_PLATFORM)
list(APPEND _gen
CMAKE_GENERATOR_PLATFORM "${CMAKE_GENERATOR_PLATFORM}")
endif ()

if (CMAKE_GENERATOR_TOOLSET)
list(APPEND _gen
CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}")
endif ()

if (CMAKE_GENERATOR_INSTANCE)
list(APPEND _gen
CMAKE_GENERATOR_INSTANCE "${CMAKE_GENERATOR_INSTANCE}")
endif ()

if (CMAKE_GENERATOR MATCHES "^Visual Studio ")
set(_build_native_args -- "/p:CL_MPCount=${CREALITYPRINT_BUILD_JOBS}")
endif ()
endif ()

if (NOT IS_CROSS_COMPILE OR NOT APPLE)
Expand All @@ -141,8 +190,8 @@ if (NOT IS_CROSS_COMPILE OR NOT APPLE)
${DEP_CMAKE_OPTS}
${P_ARGS_CMAKE_ARGS}
${P_ARGS_UNPARSED_ARGUMENTS}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${_build_j}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release ${_build_parallel_args} ${_build_native_args}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release ${_build_parallel_args} ${_build_native_args}
)
elseif(FLATPAK)
# the only reason this is here is because of the HACK at the bottom for ci
Expand Down Expand Up @@ -170,8 +219,8 @@ elseif(FLATPAK)
${DEP_CMAKE_OPTS}
${P_ARGS_CMAKE_ARGS}
${P_ARGS_UNPARSED_ARGUMENTS}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${_build_j}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release ${_build_parallel_args} ${_build_native_args}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release ${_build_parallel_args} ${_build_native_args}
# HACK: save space after each compile job, because CI
# reasoning: cmake changes directory after this command, so just keep only the folders
# so that it can navigate out
Expand All @@ -193,8 +242,8 @@ else()
${DEP_CMAKE_OPTS}
${P_ARGS_CMAKE_ARGS}
${P_ARGS_UNPARSED_ARGUMENTS}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${_build_j}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release ${_build_parallel_args} ${_build_native_args}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release ${_build_parallel_args} ${_build_native_args}
)

endif()
Expand Down
Loading