View | Details | Raw Unified | Return to bug 255363 | Differences between
and this patch

Collapse All | Expand All

(-)cad/PrusaSlicer/Makefile (-3 / +2 lines)
Lines 1-7 Link Here
1
PORTNAME=	PrusaSlicer
1
PORTNAME=	PrusaSlicer
2
DISTVERSIONPREFIX=version_
2
DISTVERSIONPREFIX=version_
3
DISTVERSION=	2.3.0
3
DISTVERSION=	2.3.3
4
PORTREVISION=	11
5
CATEGORIES=	cad
4
CATEGORIES=	cad
6
5
7
MAINTAINER=	teodorsigaev@gmail.com
6
MAINTAINER=	teodorsigaev@gmail.com
Lines 10-16 COMMENT= Slicing application for 3D printers Link Here
10
LICENSE=	AGPLv3
9
LICENSE=	AGPLv3
11
LICENSE_FILE=	${WRKSRC}/LICENSE
10
LICENSE_FILE=	${WRKSRC}/LICENSE
12
11
13
LIB_DEPENDS=	libtbb.so:devel/tbb \
12
LIB_DEPENDS=	libtbb.so:devel/onetbb \
14
		libboost_log.so:devel/boost-libs \
13
		libboost_log.so:devel/boost-libs \
15
		libImath.so:math/Imath \
14
		libImath.so:math/Imath \
16
		libnlopt.so:math/nlopt \
15
		libnlopt.so:math/nlopt \
(-)cad/PrusaSlicer/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1610441839
1
TIMESTAMP = 1628978092
2
SHA256 (prusa3d-PrusaSlicer-version_2.3.0_GH0.tar.gz) = cd3bac5e29b5441fc4690f28cd7b1064e97dc00207bbdc88f7bd7832308d6ca5
2
SHA256 (prusa3d-PrusaSlicer-version_2.3.3_GH0.tar.gz) = deda209505f740ac3d6f59cb2a960f4df908269ee09bd30cd4edb9fc472d29ac
3
SIZE (prusa3d-PrusaSlicer-version_2.3.0_GH0.tar.gz) = 34785471
3
SIZE (prusa3d-PrusaSlicer-version_2.3.3_GH0.tar.gz) = 40659538
(-)cad/PrusaSlicer/files/patch-CMakeLists.txt (-3 / +3 lines)
Lines 1-4 Link Here
1
--- CMakeLists.txt.orig	2021-01-11 13:01:51 UTC
1
--- CMakeLists.txt.orig	2021-04-16 11:41:00 UTC
2
+++ CMakeLists.txt
2
+++ CMakeLists.txt
3
@@ -3,6 +3,7 @@ project(PrusaSlicer)
3
@@ -3,6 +3,7 @@ project(PrusaSlicer)
4
 
4
 
Lines 8-14 Link Here
8
 
8
 
9
 set(SLIC3R_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
9
 set(SLIC3R_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
10
 file(TO_NATIVE_PATH "${SLIC3R_RESOURCES_DIR}" SLIC3R_RESOURCES_DIR_WIN)
10
 file(TO_NATIVE_PATH "${SLIC3R_RESOURCES_DIR}" SLIC3R_RESOURCES_DIR_WIN)
11
@@ -154,7 +155,7 @@ if (APPLE)
11
@@ -166,7 +167,7 @@ if (APPLE)
12
     endif ()
12
     endif ()
13
 endif ()
13
 endif ()
14
 
14
 
Lines 17-23 Link Here
17
     find_package(PkgConfig REQUIRED)
17
     find_package(PkgConfig REQUIRED)
18
 
18
 
19
     if (CMAKE_VERSION VERSION_LESS "3.1")
19
     if (CMAKE_VERSION VERSION_LESS "3.1")
20
@@ -513,8 +514,8 @@ elseif (SLIC3R_FHS)
20
@@ -525,8 +526,8 @@ elseif (SLIC3R_FHS)
21
     # CMAKE_INSTALL_FULL_DATAROOTDIR: read-only architecture-independent data root (share)
21
     # CMAKE_INSTALL_FULL_DATAROOTDIR: read-only architecture-independent data root (share)
22
     set(SLIC3R_FHS_RESOURCES "${CMAKE_INSTALL_FULL_DATAROOTDIR}/PrusaSlicer")
22
     set(SLIC3R_FHS_RESOURCES "${CMAKE_INSTALL_FULL_DATAROOTDIR}/PrusaSlicer")
23
     install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${SLIC3R_FHS_RESOURCES}")
23
     install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${SLIC3R_FHS_RESOURCES}")
(-)cad/PrusaSlicer/files/patch-cmake_modules_FindTBB.cmake (+738 lines)
Added Link Here
1
--- cmake/modules/FindTBB.cmake.orig	2021-07-16 10:14:03 UTC
2
+++ cmake/modules/FindTBB.cmake
3
@@ -1,332 +1,456 @@
4
-# The MIT License (MIT)
5
+# - Find ThreadingBuildingBlocks include dirs and libraries
6
+# Use this module by invoking find_package with the form:
7
+#  find_package(TBB
8
+#    [REQUIRED]             # Fail with error if TBB is not found
9
+#    )                      #
10
+# Once done, this will define
11
 #
12
-# Copyright (c) 2015 Justus Calvin
13
-# 
14
-# Permission is hereby granted, free of charge, to any person obtaining a copy
15
-# of this software and associated documentation files (the "Software"), to deal
16
-# in the Software without restriction, including without limitation the rights
17
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
-# copies of the Software, and to permit persons to whom the Software is
19
-# furnished to do so, subject to the following conditions:
20
-# 
21
-# The above copyright notice and this permission notice shall be included in all
22
-# copies or substantial portions of the Software.
23
-# 
24
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
-# SOFTWARE.
31
-
32
+#  TBB_FOUND - system has TBB
33
+#  TBB_INCLUDE_DIRS - the TBB include directories
34
+#  TBB_LIBRARIES - TBB libraries to be lined, doesn't include malloc or
35
+#                  malloc proxy
36
+#  TBB::tbb - imported target for the TBB library
37
 #
38
-# FindTBB
39
-# -------
40
+#  TBB_VERSION_MAJOR - Major Product Version Number
41
+#  TBB_VERSION_MINOR - Minor Product Version Number
42
+#  TBB_INTERFACE_VERSION - Engineering Focused Version Number
43
+#  TBB_COMPATIBLE_INTERFACE_VERSION - The oldest major interface version
44
+#                                     still supported. This uses the engineering
45
+#                                     focused interface version numbers.
46
 #
47
-# Find TBB include directories and libraries.
48
+#  TBB_MALLOC_FOUND - system has TBB malloc library
49
+#  TBB_MALLOC_INCLUDE_DIRS - the TBB malloc include directories
50
+#  TBB_MALLOC_LIBRARIES - The TBB malloc libraries to be lined
51
+#  TBB::malloc - imported target for the TBB malloc library
52
 #
53
-# Usage:
54
+#  TBB_MALLOC_PROXY_FOUND - system has TBB malloc proxy library
55
+#  TBB_MALLOC_PROXY_INCLUDE_DIRS = the TBB malloc proxy include directories
56
+#  TBB_MALLOC_PROXY_LIBRARIES - The TBB malloc proxy libraries to be lined
57
+#  TBB::malloc_proxy - imported target for the TBB malloc proxy library
58
 #
59
-#  find_package(TBB [major[.minor]] [EXACT]
60
-#               [QUIET] [REQUIRED]
61
-#               [[COMPONENTS] [components...]]
62
-#               [OPTIONAL_COMPONENTS components...]) 
63
 #
64
-# where the allowed components are tbbmalloc and tbb_preview. Users may modify 
65
-# the behavior of this module with the following variables:
66
+# This module reads hints about search locations from variables:
67
+#  ENV TBB_ARCH_PLATFORM - for eg. set it to "mic" for Xeon Phi builds
68
+#  ENV TBB_ROOT or just TBB_ROOT - root directory of tbb installation
69
+#  ENV TBB_BUILD_PREFIX - specifies the build prefix for user built tbb
70
+#                         libraries. Should be specified with ENV TBB_ROOT
71
+#                         and optionally...
72
+#  ENV TBB_BUILD_DIR - if build directory is different than ${TBB_ROOT}/build
73
 #
74
-# * TBB_ROOT_DIR          - The base directory the of TBB installation.
75
-# * TBB_INCLUDE_DIR       - The directory that contains the TBB headers files.
76
-# * TBB_LIBRARY           - The directory that contains the TBB library files.
77
-# * TBB_<library>_LIBRARY - The path of the TBB the corresponding TBB library. 
78
-#                           These libraries, if specified, override the 
79
-#                           corresponding library search results, where <library>
80
-#                           may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug,
81
-#                           tbb_preview, or tbb_preview_debug.
82
-# * TBB_USE_DEBUG_BUILD   - The debug version of tbb libraries, if present, will
83
-#                           be used instead of the release version.
84
-# * TBB_STATIC            - Static linking of libraries with a _static suffix.
85
-#                           For example, on Windows a tbb_static.lib will be searched for
86
-#                           instead of tbb.lib.
87
 #
88
-# Users may modify the behavior of this module with the following environment
89
-# variables:
90
+# Modified by Robert Maynard from the original OGRE source
91
 #
92
-# * TBB_INSTALL_DIR 
93
-# * TBBROOT
94
-# * LIBRARY_PATH
95
+#-------------------------------------------------------------------
96
+# This file is part of the CMake build system for OGRE
97
+#     (Object-oriented Graphics Rendering Engine)
98
+# For the latest info, see http://www.ogre3d.org/
99
 #
100
-# This module will set the following variables:
101
+# The contents of this file are placed in the public domain. Feel
102
+# free to make use of it in any way you like.
103
+#-------------------------------------------------------------------
104
 #
105
-# * TBB_FOUND             - Set to false, or undefined, if we haven’t found, or
106
-#                           don’t want to use TBB.
107
-# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
108
-#                           not available.
109
-# * TBB_VERSION           - The full version string
110
-# * TBB_VERSION_MAJOR     - The major version
111
-# * TBB_VERSION_MINOR     - The minor version
112
-# * TBB_INTERFACE_VERSION - The interface version number defined in 
113
-#                           tbb/tbb_stddef.h.
114
-# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of 
115
-#                           <library>, where <library> may be tbb, tbb_debug,
116
-#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or 
117
-#                           tbb_preview_debug.
118
-# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of 
119
-#                           <library>, where <library> may be tbb, tbb_debug,
120
-#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or 
121
-#                           tbb_preview_debug.
122
+#=============================================================================
123
+# Copyright 2010-2012 Kitware, Inc.
124
+# Copyright 2012      Rolf Eike Beer <eike@sf-mail.de>
125
 #
126
-# The following varibles should be used to build and link with TBB:
127
+# Distributed under the OSI-approved BSD License (the "License");
128
+# see accompanying file Copyright.txt for details.
129
 #
130
-# * TBB_INCLUDE_DIRS        - The include directory for TBB.
131
-# * TBB_LIBRARIES           - The libraries to link against to use TBB.
132
-# * TBB_LIBRARIES_RELEASE   - The release libraries to link against to use TBB.
133
-# * TBB_LIBRARIES_DEBUG     - The debug libraries to link against to use TBB.
134
-# * TBB_DEFINITIONS         - Definitions to use when compiling code that uses
135
-#                             TBB.
136
-# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that
137
-#                             uses TBB.
138
-# * TBB_DEFINITIONS_DEBUG   - Definitions to use when compiling debug code that
139
-#                             uses TBB.
140
+# This software is distributed WITHOUT ANY WARRANTY; without even the
141
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
142
+# See the License for more information.
143
+#=============================================================================
144
+# (To distribute this file outside of CMake, substitute the full
145
+#  License text for the above reference.)
146
+
147
+
148
+#=============================================================================
149
+#  FindTBB helper functions and macros
150
 #
151
-# This module will also create the "tbb" target that may be used when building
152
-# executables and libraries.
153
 
154
-unset(TBB_FOUND CACHE)
155
-unset(TBB_INCLUDE_DIRS CACHE)
156
-unset(TBB_LIBRARIES)
157
-unset(TBB_LIBRARIES_DEBUG)
158
-unset(TBB_LIBRARIES_RELEASE)
159
+# Use TBBConfig.cmake if possible.
160
 
161
-include(FindPackageHandleStandardArgs)
162
+set(_tbb_find_quiet)
163
+if (TBB_FIND_QUIETLY)
164
+  set(_tbb_find_quiet QUIET)
165
+endif ()
166
+set(_tbb_find_components)
167
+set(_tbb_find_optional_components)
168
+foreach (_tbb_find_component IN LISTS TBB_FIND_COMPONENTS)
169
+  if (TBB_FIND_REQUIRED_${_tbb_find_component})
170
+    list(APPEND _tbb_find_components "${_tbb_find_component}")
171
+  else ()
172
+    list(APPEND _tbb_find_optional_components "${_tbb_find_component}")
173
+  endif ()
174
+endforeach ()
175
+unset(_tbb_find_component)
176
+find_package(TBB CONFIG ${_tbb_find_quiet}
177
+  COMPONENTS ${_tbb_find_components}
178
+  OPTIONAL_COMPONENTS ${_tbb_find_optional_components})
179
+unset(_tbb_find_quiet)
180
+unset(_tbb_find_components)
181
+unset(_tbb_find_optional_components)
182
+if (TBB_FOUND)
183
+  return ()
184
+endif ()
185
 
186
-find_package(Threads QUIET REQUIRED)
187
+#====================================================
188
+# Fix the library path in case it is a linker script
189
+#====================================================
190
+function(tbb_extract_real_library library real_library)
191
+  if(NOT UNIX OR NOT EXISTS ${library})
192
+    set(${real_library} "${library}" PARENT_SCOPE)
193
+    return()
194
+  endif()
195
 
196
-if(NOT TBB_FOUND)
197
+  #Read in the first 4 bytes and see if they are the ELF magic number
198
+  set(_elf_magic "7f454c46")
199
+  file(READ ${library} _hex_data OFFSET 0 LIMIT 4 HEX)
200
+  if(_hex_data STREQUAL _elf_magic)
201
+    #we have opened a elf binary so this is what
202
+    #we should link to
203
+    set(${real_library} "${library}" PARENT_SCOPE)
204
+    return()
205
+  endif()
206
 
207
-  ##################################
208
-  # Check the build type
209
-  ##################################
210
-  
211
-  if(NOT DEFINED TBB_USE_DEBUG_BUILD)
212
-    if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug)")
213
-      set(TBB_BUILD_TYPE DEBUG)
214
-    else()
215
-      set(TBB_BUILD_TYPE RELEASE)
216
-    endif()
217
-  elseif(TBB_USE_DEBUG_BUILD)
218
-    set(TBB_BUILD_TYPE DEBUG)
219
+  file(READ ${library} _data OFFSET 0 LIMIT 1024)
220
+  if("${_data}" MATCHES "INPUT \\(([^(]+)\\)")
221
+    #extract out the .so name from REGEX MATCH command
222
+    set(_proper_so_name "${CMAKE_MATCH_1}")
223
+
224
+    #construct path to the real .so which is presumed to be in the same directory
225
+    #as the input file
226
+    get_filename_component(_so_dir "${library}" DIRECTORY)
227
+    set(${real_library} "${_so_dir}/${_proper_so_name}" PARENT_SCOPE)
228
   else()
229
-    set(TBB_BUILD_TYPE RELEASE)
230
+    #unable to determine what this library is so just hope everything works
231
+    #and pass it unmodified.
232
+    set(${real_library} "${library}" PARENT_SCOPE)
233
   endif()
234
-  
235
-  ##################################
236
-  # Set the TBB search directories
237
-  ##################################
238
-  
239
-  # Define search paths based on user input and environment variables
240
-  set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT})
241
-  
242
-  # Define the search directories based on the current platform
243
-  if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
244
-    set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB"
245
-                               "C:/Program Files (x86)/Intel/TBB")
246
+endfunction()
247
 
248
-    # Set the target architecture
249
-    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
250
-      set(TBB_ARCHITECTURE "intel64")
251
-    else()
252
-      set(TBB_ARCHITECTURE "ia32")
253
-    endif()
254
+#===============================================
255
+# Do the final processing for the package find.
256
+#===============================================
257
+macro(findpkg_finish PREFIX TARGET_NAME)
258
+  if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
259
+    set(${PREFIX}_FOUND TRUE)
260
+    set (${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
261
+    set (${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
262
+  else ()
263
+    if (${PREFIX}_FIND_REQUIRED AND NOT ${PREFIX}_FIND_QUIETLY)
264
+      message(FATAL_ERROR "Required library ${PREFIX} not found.")
265
+    endif ()
266
+  endif ()
267
 
268
-    # Set the TBB search library path search suffix based on the version of VC
269
-    if(WINDOWS_STORE)
270
-      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui")
271
-    elseif(MSVC14)
272
-      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14")
273
-    elseif(MSVC12)
274
-      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12")
275
-    elseif(MSVC11)
276
-      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11")
277
-    elseif(MSVC10)
278
-      set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10")
279
-    endif()
280
+  if (NOT TARGET "TBB::${TARGET_NAME}")
281
+    if (${PREFIX}_LIBRARY_RELEASE)
282
+      tbb_extract_real_library(${${PREFIX}_LIBRARY_RELEASE} real_release)
283
+    endif ()
284
+    if (${PREFIX}_LIBRARY_DEBUG)
285
+      tbb_extract_real_library(${${PREFIX}_LIBRARY_DEBUG} real_debug)
286
+    endif ()
287
+    add_library(TBB::${TARGET_NAME} UNKNOWN IMPORTED)
288
+    set_target_properties(TBB::${TARGET_NAME} PROPERTIES
289
+      INTERFACE_INCLUDE_DIRECTORIES "${${PREFIX}_INCLUDE_DIR}")
290
+    if (${PREFIX}_LIBRARY_DEBUG AND ${PREFIX}_LIBRARY_RELEASE)
291
+      set_target_properties(TBB::${TARGET_NAME} PROPERTIES
292
+        IMPORTED_LOCATION "${real_release}"
293
+        IMPORTED_LOCATION_DEBUG "${real_debug}"
294
+        IMPORTED_LOCATION_RELEASE "${real_release}")
295
+    elseif (${PREFIX}_LIBRARY_RELEASE)
296
+      set_target_properties(TBB::${TARGET_NAME} PROPERTIES
297
+        IMPORTED_LOCATION "${real_release}")
298
+    elseif (${PREFIX}_LIBRARY_DEBUG)
299
+      set_target_properties(TBB::${TARGET_NAME} PROPERTIES
300
+        IMPORTED_LOCATION "${real_debug}")
301
+    endif ()
302
+  endif ()
303
 
304
-    # Add the library path search suffix for the VC independent version of TBB
305
-    list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt")
306
+  #mark the following variables as internal variables
307
+  mark_as_advanced(${PREFIX}_INCLUDE_DIR
308
+                   ${PREFIX}_LIBRARY
309
+                   ${PREFIX}_LIBRARY_DEBUG
310
+                   ${PREFIX}_LIBRARY_RELEASE)
311
+endmacro()
312
 
313
-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
314
-    # OS X
315
-    set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
316
-    
317
-    # TODO: Check to see which C++ library is being used by the compiler.
318
-    if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
319
-      # The default C++ library on OS X 10.9 and later is libc++
320
-      set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib")
321
-    else()
322
-      set(TBB_LIB_PATH_SUFFIX "lib")
323
-    endif()
324
-  elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
325
-    # Linux
326
-    set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
327
-    
328
-    # TODO: Check compiler version to see the suffix should be <arch>/gcc4.1 or
329
-    #       <arch>/gcc4.1. For now, assume that the compiler is more recent than
330
-    #       gcc 4.4.x or later.
331
-    if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
332
-      set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4")
333
-    elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
334
-      set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4")
335
-    endif()
336
-  endif()
337
-  
338
-  ##################################
339
-  # Find the TBB include dir
340
-  ##################################
341
-  
342
-  find_path(TBB_INCLUDE_DIRS tbb/tbb.h
343
-      HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
344
-      PATHS ${TBB_DEFAULT_SEARCH_DIR}
345
-      PATH_SUFFIXES include)
346
+#===============================================
347
+# Generate debug names from given release names
348
+#===============================================
349
+macro(get_debug_names PREFIX)
350
+  foreach(i ${${PREFIX}})
351
+    set(${PREFIX}_DEBUG ${${PREFIX}_DEBUG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
352
+  endforeach()
353
+endmacro()
354
 
355
-  ##################################
356
-  # Set version strings
357
-  ##################################
358
+#===============================================
359
+# See if we have env vars to help us find tbb
360
+#===============================================
361
+macro(getenv_path VAR)
362
+   set(ENV_${VAR} $ENV{${VAR}})
363
+   # replace won't work if var is blank
364
+   if (ENV_${VAR})
365
+     string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
366
+   endif ()
367
+endmacro()
368
 
369
-  if(TBB_INCLUDE_DIRS)
370
-    file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file)
371
-    string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
372
-        TBB_VERSION_MAJOR "${_tbb_version_file}")
373
-    string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
374
-        TBB_VERSION_MINOR "${_tbb_version_file}")
375
-    string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
376
-        TBB_INTERFACE_VERSION "${_tbb_version_file}")
377
-    set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
378
-  endif()
379
+#===============================================
380
+# Couple a set of release AND debug libraries
381
+#===============================================
382
+macro(make_library_set PREFIX)
383
+  if (${PREFIX}_RELEASE AND ${PREFIX}_DEBUG)
384
+    set(${PREFIX} optimized ${${PREFIX}_RELEASE} debug ${${PREFIX}_DEBUG})
385
+  elseif (${PREFIX}_RELEASE)
386
+    set(${PREFIX} ${${PREFIX}_RELEASE})
387
+  elseif (${PREFIX}_DEBUG)
388
+    set(${PREFIX} ${${PREFIX}_DEBUG})
389
+  endif ()
390
+endmacro()
391
 
392
-  ##################################
393
-  # Find TBB components
394
-  ##################################
395
 
396
-  if(TBB_VERSION VERSION_LESS 4.3)
397
-    set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb)
398
-  else()
399
-    set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
400
-  endif()
401
+#=============================================================================
402
+#  Now to actually find TBB
403
+#
404
 
405
-  if(TBB_STATIC)
406
-    set(TBB_STATIC_SUFFIX "_static")
407
-  endif()
408
+# Get path, convert backslashes as ${ENV_${var}}
409
+getenv_path(TBB_ROOT)
410
 
411
-  # Find each component
412
-  foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
413
-    if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
414
+# initialize search paths
415
+set(TBB_PREFIX_PATH ${TBB_ROOT} ${ENV_TBB_ROOT})
416
+set(TBB_INC_SEARCH_PATH "")
417
+set(TBB_LIB_SEARCH_PATH "")
418
 
419
-      unset(TBB_${_comp}_LIBRARY_DEBUG CACHE)
420
-      unset(TBB_${_comp}_LIBRARY_RELEASE CACHE)
421
 
422
-      # Search for the libraries
423
-      find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}${TBB_STATIC_SUFFIX}
424
-          HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
425
-          PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
426
-          PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
427
+# If user built from sources
428
+set(TBB_BUILD_PREFIX $ENV{TBB_BUILD_PREFIX})
429
+if (TBB_BUILD_PREFIX AND ENV_TBB_ROOT)
430
+  getenv_path(TBB_BUILD_DIR)
431
+  if (NOT ENV_TBB_BUILD_DIR)
432
+    set(ENV_TBB_BUILD_DIR ${ENV_TBB_ROOT}/build)
433
+  endif ()
434
 
435
-      find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}${TBB_STATIC_SUFFIX}_debug
436
-          HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
437
-          PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
438
-          PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
439
+  # include directory under ${ENV_TBB_ROOT}/include
440
+  list(APPEND TBB_LIB_SEARCH_PATH
441
+    ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_release
442
+    ${ENV_TBB_BUILD_DIR}/${TBB_BUILD_PREFIX}_debug)
443
+endif ()
444
 
445
-      if(TBB_${_comp}_LIBRARY_DEBUG)
446
-        list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
447
-      endif()
448
-      if(TBB_${_comp}_LIBRARY_RELEASE)
449
-        list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}")
450
-      endif()
451
-      if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
452
-        set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
453
-      endif()
454
 
455
-      if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
456
-        set(TBB_${_comp}_FOUND TRUE)
457
-      else()
458
-        set(TBB_${_comp}_FOUND FALSE)
459
-      endif()
460
+# For Windows, let's assume that the user might be using the precompiled
461
+# TBB packages from the main website. These use a rather awkward directory
462
+# structure (at least for automatically finding the right files) depending
463
+# on platform and compiler, but we'll do our best to accommodate it.
464
+# Not adding the same effort for the precompiled linux builds, though. Those
465
+# have different versions for CC compiler versions and linux kernels which
466
+# will never adequately match the user's setup, so there is no feasible way
467
+# to detect the "best" version to use. The user will have to manually
468
+# select the right files. (Chances are the distributions are shipping their
469
+# custom version of tbb, anyway, so the problem is probably nonexistent.)
470
+if (WIN32 AND MSVC)
471
+  set(COMPILER_PREFIX "vc7.1")
472
+  if (MSVC_VERSION EQUAL 1400)
473
+    set(COMPILER_PREFIX "vc8")
474
+  elseif(MSVC_VERSION EQUAL 1500)
475
+    set(COMPILER_PREFIX "vc9")
476
+  elseif(MSVC_VERSION EQUAL 1600)
477
+    set(COMPILER_PREFIX "vc10")
478
+  elseif(MSVC_VERSION EQUAL 1700)
479
+    set(COMPILER_PREFIX "vc11")
480
+  elseif(MSVC_VERSION EQUAL 1800)
481
+    set(COMPILER_PREFIX "vc12")
482
+  elseif(MSVC_VERSION GREATER_EQUAL 1900)
483
+    set(COMPILER_PREFIX "vc14")
484
+  endif ()
485
 
486
-      # Mark internal variables as advanced
487
-      mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
488
-      mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
489
-      mark_as_advanced(TBB_${_comp}_LIBRARY)
490
+  # for each prefix path, add ia32/64\${COMPILER_PREFIX}\lib to the lib search path
491
+  foreach (dir IN LISTS TBB_PREFIX_PATH)
492
+    if (CMAKE_CL_64)
493
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia64/${COMPILER_PREFIX}/lib)
494
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia64/${COMPILER_PREFIX})
495
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${COMPILER_PREFIX}/lib)
496
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${COMPILER_PREFIX})
497
+    else ()
498
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${COMPILER_PREFIX}/lib)
499
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${COMPILER_PREFIX})
500
+    endif ()
501
+  endforeach ()
502
+endif ()
503
 
504
-    endif()
505
-  endforeach()
506
+# For OS X binary distribution, choose libc++ based libraries for Mavericks (10.9)
507
+# and above and AppleClang
508
+if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND
509
+    NOT CMAKE_SYSTEM_VERSION VERSION_LESS 13.0)
510
+  set (USE_LIBCXX OFF)
511
+  cmake_policy(GET CMP0025 POLICY_VAR)
512
 
513
-  ##################################
514
-  # Set compile flags and libraries
515
-  ##################################
516
+  if (POLICY_VAR STREQUAL "NEW")
517
+    if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
518
+      set (USE_LIBCXX ON)
519
+    endif ()
520
+  else ()
521
+    if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
522
+      set (USE_LIBCXX ON)
523
+    endif ()
524
+  endif ()
525
 
526
-  set(TBB_DEFINITIONS_RELEASE "")
527
-  set(TBB_DEFINITIONS_DEBUG "TBB_USE_DEBUG=1")
528
-    
529
-  if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
530
-    set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
531
+  if (USE_LIBCXX)
532
+    foreach (dir IN LISTS TBB_PREFIX_PATH)
533
+      list (APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/libc++ ${dir}/libc++/lib)
534
+    endforeach ()
535
+  endif ()
536
+endif ()
537
+
538
+# check compiler ABI
539
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
540
+  set(COMPILER_PREFIX)
541
+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
542
+    list(APPEND COMPILER_PREFIX "gcc4.8")
543
   endif()
544
-  
545
-  if(NOT MSVC AND NOT TBB_LIBRARIES)
546
-    set(TBB_LIBRARIES ${TBB_LIBRARIES_RELEASE})
547
+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
548
+    list(APPEND COMPILER_PREFIX "gcc4.7")
549
   endif()
550
+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
551
+    list(APPEND COMPILER_PREFIX "gcc4.4")
552
+  endif()
553
+  list(APPEND COMPILER_PREFIX "gcc4.1")
554
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
555
+  set(COMPILER_PREFIX)
556
+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) # Complete guess
557
+    list(APPEND COMPILER_PREFIX "gcc4.8")
558
+  endif()
559
+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.6)
560
+    list(APPEND COMPILER_PREFIX "gcc4.7")
561
+  endif()
562
+  list(APPEND COMPILER_PREFIX "gcc4.4")
563
+else() # Assume compatibility with 4.4 for other compilers
564
+  list(APPEND COMPILER_PREFIX "gcc4.4")
565
+endif ()
566
 
567
-  set(TBB_DEFINITIONS "")
568
-  if (MSVC AND TBB_STATIC)
569
-    set(TBB_DEFINITIONS __TBB_NO_IMPLICIT_LINKAGE)
570
-  endif ()
571
+# if platform architecture is explicitly specified
572
+set(TBB_ARCH_PLATFORM $ENV{TBB_ARCH_PLATFORM})
573
+if (TBB_ARCH_PLATFORM)
574
+  foreach (dir IN LISTS TBB_PREFIX_PATH)
575
+    list(APPEND TBB_LIB_SEARCH_PATH ${dir}/${TBB_ARCH_PLATFORM}/lib)
576
+    list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/${TBB_ARCH_PLATFORM})
577
+  endforeach ()
578
+endif ()
579
 
580
-  unset (TBB_STATIC_SUFFIX)
581
+foreach (dir IN LISTS TBB_PREFIX_PATH)
582
+  foreach (prefix IN LISTS COMPILER_PREFIX)
583
+    if (CMAKE_SIZEOF_VOID_P EQUAL 8)
584
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64)
585
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/intel64/${prefix})
586
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/lib)
587
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/intel64/${prefix}/lib)
588
+    else ()
589
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32)
590
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib/ia32/${prefix})
591
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/lib)
592
+      list(APPEND TBB_LIB_SEARCH_PATH ${dir}/ia32/${prefix}/lib)
593
+    endif ()
594
+  endforeach()
595
+endforeach ()
596
 
597
-  find_package_handle_standard_args(TBB 
598
-      REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
599
-      FAIL_MESSAGE "TBB library cannot be found. Consider set TBBROOT environment variable."
600
-      HANDLE_COMPONENTS
601
-      VERSION_VAR TBB_VERSION)
602
+# add general search paths
603
+foreach (dir IN LISTS TBB_PREFIX_PATH)
604
+  list(APPEND TBB_LIB_SEARCH_PATH ${dir}/lib ${dir}/Lib ${dir}/lib/tbb
605
+    ${dir}/Libs)
606
+  list(APPEND TBB_INC_SEARCH_PATH ${dir}/include ${dir}/Include
607
+    ${dir}/include/tbb)
608
+endforeach ()
609
 
610
-  ##################################
611
-  # Create targets
612
-  ##################################
613
+set(TBB_LIBRARY_NAMES tbb)
614
+get_debug_names(TBB_LIBRARY_NAMES)
615
 
616
-  if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
617
-    add_library(TBB::tbb UNKNOWN IMPORTED)
618
-    set_target_properties(TBB::tbb PROPERTIES
619
-          INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS}"
620
-          INTERFACE_LINK_LIBRARIES  "Threads::Threads;${CMAKE_DL_LIBS}"
621
-          INTERFACE_INCLUDE_DIRECTORIES  ${TBB_INCLUDE_DIRS}
622
-          IMPORTED_LOCATION              ${TBB_LIBRARIES})
623
-    if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
624
-      set_target_properties(TBB::tbb PROPERTIES
625
-          INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS};$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:${TBB_DEFINITIONS_DEBUG}>;$<$<CONFIG:Release>:${TBB_DEFINITIONS_RELEASE}>"
626
-          IMPORTED_LOCATION_DEBUG          ${TBB_LIBRARIES_DEBUG}
627
-          IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_RELEASE}
628
-          IMPORTED_LOCATION_RELEASE        ${TBB_LIBRARIES_RELEASE}
629
-          IMPORTED_LOCATION_MINSIZEREL     ${TBB_LIBRARIES_RELEASE}
630
-          )
631
-    endif()
632
-  endif()
633
 
634
-  mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
635
+find_path(TBB_INCLUDE_DIR
636
+          NAMES tbb/tbb.h
637
+          PATHS ${TBB_INC_SEARCH_PATH})
638
 
639
-  unset(TBB_ARCHITECTURE)
640
-  unset(TBB_BUILD_TYPE)
641
-  unset(TBB_LIB_PATH_SUFFIX)
642
-  unset(TBB_DEFAULT_SEARCH_DIR)
643
+find_library(TBB_LIBRARY_RELEASE
644
+             NAMES ${TBB_LIBRARY_NAMES}
645
+             PATHS ${TBB_LIB_SEARCH_PATH})
646
+find_library(TBB_LIBRARY_DEBUG
647
+             NAMES ${TBB_LIBRARY_NAMES_DEBUG}
648
+             PATHS ${TBB_LIB_SEARCH_PATH})
649
+make_library_set(TBB_LIBRARY)
650
 
651
-  if(TBB_DEBUG)
652
-    message(STATUS "  TBB_FOUND               = ${TBB_FOUND}")
653
-    message(STATUS "  TBB_INCLUDE_DIRS        = ${TBB_INCLUDE_DIRS}")
654
-    message(STATUS "  TBB_DEFINITIONS         = ${TBB_DEFINITIONS}")
655
-    message(STATUS "  TBB_LIBRARIES           = ${TBB_LIBRARIES}")
656
-    message(STATUS "  TBB_DEFINITIONS_DEBUG   = ${TBB_DEFINITIONS_DEBUG}")
657
-    message(STATUS "  TBB_LIBRARIES_DEBUG     = ${TBB_LIBRARIES_DEBUG}")
658
-    message(STATUS "  TBB_DEFINITIONS_RELEASE = ${TBB_DEFINITIONS_RELEASE}")
659
-    message(STATUS "  TBB_LIBRARIES_RELEASE   = ${TBB_LIBRARIES_RELEASE}")
660
+findpkg_finish(TBB tbb)
661
+
662
+#if we haven't found TBB no point on going any further
663
+if (NOT TBB_FOUND)
664
+  return()
665
+endif ()
666
+
667
+#=============================================================================
668
+# Look for TBB's malloc package
669
+set(TBB_MALLOC_LIBRARY_NAMES tbbmalloc)
670
+get_debug_names(TBB_MALLOC_LIBRARY_NAMES)
671
+
672
+find_path(TBB_MALLOC_INCLUDE_DIR
673
+          NAMES tbb/tbb.h
674
+          PATHS ${TBB_INC_SEARCH_PATH})
675
+
676
+find_library(TBB_MALLOC_LIBRARY_RELEASE
677
+             NAMES ${TBB_MALLOC_LIBRARY_NAMES}
678
+             PATHS ${TBB_LIB_SEARCH_PATH})
679
+find_library(TBB_MALLOC_LIBRARY_DEBUG
680
+             NAMES ${TBB_MALLOC_LIBRARY_NAMES_DEBUG}
681
+             PATHS ${TBB_LIB_SEARCH_PATH})
682
+make_library_set(TBB_MALLOC_LIBRARY)
683
+
684
+findpkg_finish(TBB_MALLOC tbbmalloc)
685
+
686
+#=============================================================================
687
+# Look for TBB's malloc proxy package
688
+set(TBB_MALLOC_PROXY_LIBRARY_NAMES tbbmalloc_proxy)
689
+get_debug_names(TBB_MALLOC_PROXY_LIBRARY_NAMES)
690
+
691
+find_path(TBB_MALLOC_PROXY_INCLUDE_DIR
692
+          NAMES tbb/tbbmalloc_proxy.h
693
+          PATHS ${TBB_INC_SEARCH_PATH})
694
+
695
+find_library(TBB_MALLOC_PROXY_LIBRARY_RELEASE
696
+             NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES}
697
+             PATHS ${TBB_LIB_SEARCH_PATH})
698
+find_library(TBB_MALLOC_PROXY_LIBRARY_DEBUG
699
+             NAMES ${TBB_MALLOC_PROXY_LIBRARY_NAMES_DEBUG}
700
+             PATHS ${TBB_LIB_SEARCH_PATH})
701
+make_library_set(TBB_MALLOC_PROXY_LIBRARY)
702
+
703
+findpkg_finish(TBB_MALLOC_PROXY tbbmalloc_proxy)
704
+
705
+
706
+#=============================================================================
707
+#parse all the version numbers from tbb
708
+if(NOT TBB_VERSION)
709
+  if (EXISTS "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h")
710
+    file(STRINGS
711
+      "${TBB_INCLUDE_DIR}/oneapi/tbb/version.h"
712
+      TBB_VERSION_CONTENTS
713
+      REGEX "VERSION")
714
+  else()
715
+    #only read the start of the file
716
+    file(STRINGS
717
+      "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h"
718
+      TBB_VERSION_CONTENTS
719
+      REGEX "VERSION")
720
   endif()
721
+
722
+  string(REGEX REPLACE
723
+    ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
724
+    TBB_VERSION_MAJOR "${TBB_VERSION_CONTENTS}")
725
+
726
+  string(REGEX REPLACE
727
+    ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
728
+    TBB_VERSION_MINOR "${TBB_VERSION_CONTENTS}")
729
+
730
+  string(REGEX REPLACE
731
+        ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
732
+        TBB_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
733
+
734
+  string(REGEX REPLACE
735
+        ".*#define TBB_COMPATIBLE_INTERFACE_VERSION ([0-9]+).*" "\\1"
736
+        TBB_COMPATIBLE_INTERFACE_VERSION "${TBB_VERSION_CONTENTS}")
737
 
738
 endif()
(-)cad/PrusaSlicer/files/patch-src_avrdude_main.c (+11 lines)
Added Link Here
1
--- src/avrdude/main.c.orig	2021-08-13 03:29:34 UTC
2
+++ src/avrdude/main.c
3
@@ -806,7 +806,7 @@ int avrdude_main(int argc, char * argv [])
4
   avrdude_message(MSG_NOTICE, "\n%s: Version %s, compiled on %s at %s\n"
5
                     "%sCopyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/\n"
6
                     "%sCopyright (c) 2007-2014 Joerg Wunsch\n\n",
7
-                    progname, version, __DATE__, __TIME__, progbuf, progbuf);
8
+                    progname, version, "REDACTED", "REDACTED", progbuf, progbuf);
9
   // avrdude_message(MSG_NOTICE, "%sSystem wide configuration file is \"%s\"\n",
10
   //           progbuf, sys_config);
11
 
(-)cad/PrusaSlicer/files/patch-src_libslic3r_CMakeLists.txt (-2 / +2 lines)
Lines 1-6 Link Here
1
--- src/libslic3r/CMakeLists.txt.orig	2021-02-16 20:42:21 UTC
1
--- src/libslic3r/CMakeLists.txt.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/CMakeLists.txt
2
+++ src/libslic3r/CMakeLists.txt
3
@@ -297,7 +297,6 @@ target_include_directories(libslic3r PUBLIC ${EXPAT_IN
3
@@ -300,7 +300,6 @@ target_include_directories(libslic3r PUBLIC ${EXPAT_IN
4
 target_link_libraries(libslic3r
4
 target_link_libraries(libslic3r
5
     libnest2d
5
     libnest2d
6
     admesh
6
     admesh
(-)cad/PrusaSlicer/files/patch-src_libslic3r_Platform.cpp (+13 lines)
Added Link Here
1
--- src/libslic3r/Platform.cpp.orig	2021-04-20 12:16:52 UTC
2
+++ src/libslic3r/Platform.cpp
3
@@ -49,6 +49,10 @@ void detect_platform()
4
     BOOST_LOG_TRIVIAL(info) << "Platform: OpenBSD";
5
 	s_platform 		  = Platform::BSDUnix;
6
 	s_platform_flavor = PlatformFlavor::OpenBSD;
7
+#elif defined(__FreeBSD__)
8
+    BOOST_LOG_TRIVIAL(info) << "Platform: FreeBSD";
9
+	s_platform 		  = Platform::BSDUnix;
10
+	s_platform_flavor = PlatformFlavor::FreeBSD;
11
 #else
12
 	// This should not happen.
13
     BOOST_LOG_TRIVIAL(info) << "Platform: Unknown";
(-)cad/PrusaSlicer/files/patch-src_libslic3r_Platform.hpp (+10 lines)
Added Link Here
1
--- src/libslic3r/Platform.hpp.orig	2021-04-20 12:26:01 UTC
2
+++ src/libslic3r/Platform.hpp
3
@@ -28,6 +28,7 @@ enum class PlatformFlavor
4
 	WSL2,
5
 	// For Platform::BSDUnix
6
 	OpenBSD,
7
+	FreeBSD,
8
 };
9
 
10
 // To be called on program start-up.
(-)cad/PrusaSlicer/files/patch-src_libslic3r_Print.cpp (+29 lines)
Added Link Here
1
--- src/libslic3r/Print.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/Print.cpp
3
@@ -36,7 +36,7 @@ template class PrintState<PrintObjectStep, posCount>;
4
 
5
 void Print::clear() 
6
 {
7
-	tbb::mutex::scoped_lock lock(this->state_mutex());
8
+	std::scoped_lock<std::mutex> lock(this->state_mutex());
9
     // The following call should stop background processing if it is running.
10
     this->invalidate_all_steps();
11
 	for (PrintObject *object : m_objects)
12
@@ -262,7 +262,7 @@ bool Print::is_step_done(PrintObjectStep step) const
13
 {
14
     if (m_objects.empty())
15
         return false;
16
-    tbb::mutex::scoped_lock lock(this->state_mutex());
17
+    std::scoped_lock<std::mutex> lock(this->state_mutex());
18
     for (const PrintObject *object : m_objects)
19
         if (! object->is_step_done_unguarded(step))
20
             return false;
21
@@ -617,7 +617,7 @@ Print::ApplyStatus Print::apply(const Model &model, Dy
22
         update_apply_status(false);
23
 
24
     // Grab the lock for the Print / PrintObject milestones.
25
-	tbb::mutex::scoped_lock lock(this->state_mutex());
26
+	std::scoped_lock<std::mutex> lock(this->state_mutex());
27
 
28
     // The following call may stop the background processing.
29
     if (! print_diff.empty())
(-)cad/PrusaSlicer/files/patch-src_libslic3r_PrintBase.cpp (+11 lines)
Added Link Here
1
--- src/libslic3r/PrintBase.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/PrintBase.cpp
3
@@ -97,7 +97,7 @@ void PrintBase::status_update_warnings(ObjectID object
4
     	printf("%s warning: %s\n", (object_id == this->id()) ? "print" : "print object", message.c_str());
5
 }
6
 
7
-tbb::mutex& PrintObjectBase::state_mutex(PrintBase *print)
8
+std::mutex& PrintObjectBase::state_mutex(PrintBase *print)
9
 { 
10
 	return print->state_mutex();
11
 }
(-)cad/PrusaSlicer/files/patch-src_libslic3r_PrintBase.hpp (+118 lines)
Added Link Here
1
--- src/libslic3r/PrintBase.hpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/PrintBase.hpp
3
@@ -6,13 +6,9 @@
4
 #include <vector>
5
 #include <string>
6
 #include <functional>
7
+#include <atomic>
8
+#include <mutex>
9
 
10
-// tbb/mutex.h includes Windows, which in turn defines min/max macros. Convince Windows.h to not define these min/max macros.
11
-#ifndef NOMINMAX
12
-    #define NOMINMAX
13
-#endif
14
-#include "tbb/mutex.h"
15
-
16
 #include "ObjectID.hpp"
17
 #include "Model.hpp"
18
 #include "PlaceholderParser.hpp"
19
@@ -84,23 +80,23 @@ class PrintState : public PrintStateBase
20
 public:
21
     PrintState() {}
22
 
23
-    StateWithTimeStamp state_with_timestamp(StepType step, tbb::mutex &mtx) const {
24
-        tbb::mutex::scoped_lock lock(mtx);
25
+    StateWithTimeStamp state_with_timestamp(StepType step, std::mutex &mtx) const {
26
+        std::scoped_lock<std::mutex> lock(mtx);
27
         StateWithTimeStamp state = m_state[step];
28
         return state;
29
     }
30
 
31
-    StateWithWarnings state_with_warnings(StepType step, tbb::mutex &mtx) const {
32
-        tbb::mutex::scoped_lock lock(mtx);
33
+    StateWithWarnings state_with_warnings(StepType step, std::mutex &mtx) const {
34
+        std::scoped_lock<std::mutex> lock(mtx);
35
         StateWithWarnings state = m_state[step];
36
         return state;
37
     }
38
 
39
-    bool is_started(StepType step, tbb::mutex &mtx) const {
40
+    bool is_started(StepType step, std::mutex &mtx) const {
41
         return this->state_with_timestamp(step, mtx).state == STARTED;
42
     }
43
 
44
-    bool is_done(StepType step, tbb::mutex &mtx) const {
45
+    bool is_done(StepType step, std::mutex &mtx) const {
46
         return this->state_with_timestamp(step, mtx).state == DONE;
47
     }
48
 
49
@@ -121,8 +117,8 @@ class PrintState : public PrintStateBase
50
     // This is necessary to block until the Print::apply() updates its state, which may
51
     // influence the processing step being entered.
52
     template<typename ThrowIfCanceled>
53
-    bool set_started(StepType step, tbb::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
54
-        tbb::mutex::scoped_lock lock(mtx);
55
+    bool set_started(StepType step, std::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
56
+        std::scoped_lock<std::mutex> lock(mtx);
57
         // If canceled, throw before changing the step state.
58
         throw_if_canceled();
59
 #ifndef NDEBUG
60
@@ -154,8 +150,8 @@ class PrintState : public PrintStateBase
61
     // 		Timestamp when this stepentered the DONE state.
62
     // 		bool indicates whether the UI has to update the slicing warnings of this step or not.
63
 	template<typename ThrowIfCanceled>
64
-	std::pair<TimeStamp, bool> set_done(StepType step, tbb::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
65
-        tbb::mutex::scoped_lock lock(mtx);
66
+	std::pair<TimeStamp, bool> set_done(StepType step, std::mutex &mtx, ThrowIfCanceled throw_if_canceled) {
67
+        std::scoped_lock<std::mutex> lock(mtx);
68
         // If canceled, throw before changing the step state.
69
         throw_if_canceled();
70
         assert(m_state[step].state == STARTED);
71
@@ -266,9 +262,9 @@ class PrintState : public PrintStateBase
72
     // Return value:
73
     // 		Current milestone (StepType).
74
     // 		bool indicates whether the UI has to be updated or not.
75
-    std::pair<StepType, bool> active_step_add_warning(PrintStateBase::WarningLevel warning_level, const std::string &message, int message_id, tbb::mutex &mtx)
76
+    std::pair<StepType, bool> active_step_add_warning(PrintStateBase::WarningLevel warning_level, const std::string &message, int message_id, std::mutex &mtx)
77
     {
78
-        tbb::mutex::scoped_lock lock(mtx);
79
+        std::scoped_lock<std::mutex> lock(mtx);
80
         assert(m_step_active != -1);
81
         StateWithWarnings &state = m_state[m_step_active];
82
         assert(state.state == STARTED);
83
@@ -314,7 +310,7 @@ class PrintObjectBase : public ObjectBase (protected)
84
     PrintObjectBase(ModelObject *model_object) : m_model_object(model_object) {}
85
     virtual ~PrintObjectBase() {}
86
     // Declared here to allow access from PrintBase through friendship.
87
-	static tbb::mutex&                  state_mutex(PrintBase *print);
88
+	static std::mutex&                  state_mutex(PrintBase *print);
89
 	static std::function<void()>        cancel_callback(PrintBase *print);
90
 	// Notify UI about a new warning of a milestone "step" on this PrintObjectBase.
91
 	// The UI will be notified by calling a status callback registered on print.
92
@@ -461,7 +457,7 @@ class PrintBase : public ObjectBase (protected)
93
 	friend class PrintObjectBase;
94
     friend class BackgroundSlicingProcess;
95
 
96
-    tbb::mutex&            state_mutex() const { return m_state_mutex; }
97
+    std::mutex&            state_mutex() const { return m_state_mutex; }
98
     std::function<void()>  cancel_callback() { return m_cancel_callback; }
99
 	void				   call_cancel_callback() { m_cancel_callback(); }
100
 	// Notify UI about a new warning of a milestone "step" on this PrintBase.
101
@@ -486,7 +482,7 @@ class PrintBase : public ObjectBase (protected)
102
     status_callback_type                    m_status_callback;
103
 
104
 private:
105
-    tbb::atomic<CancelStatus>               m_cancel_status;
106
+    std::atomic<CancelStatus>               m_cancel_status;
107
 
108
     // Callback to be evoked to stop the background processing before a state is updated.
109
     cancel_callback_type                    m_cancel_callback = [](){};
110
@@ -494,7 +490,7 @@ class PrintBase : public ObjectBase (protected)
111
     // Mutex used for synchronization of the worker thread with the UI thread:
112
     // The mutex will be used to guard the worker thread against entering a stage
113
     // while the data influencing the stage is modified.
114
-    mutable tbb::mutex                      m_state_mutex;
115
+    mutable std::mutex                      m_state_mutex;
116
 };
117
 
118
 template<typename PrintStepEnum, const size_t COUNT>
(-)cad/PrusaSlicer/files/patch-src_libslic3r_PrintObject.cpp (+10 lines)
Added Link Here
1
--- src/libslic3r/PrintObject.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/PrintObject.cpp
3
@@ -19,7 +19,6 @@
4
 #include <float.h>
5
 
6
 #include <tbb/parallel_for.h>
7
-#include <tbb/atomic.h>
8
 
9
 #include <Shiny/Shiny.h>
10
 
(-)cad/PrusaSlicer/files/patch-src_libslic3r_SLAPrint.cpp (+47 lines)
Added Link Here
1
--- src/libslic3r/SLAPrint.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/SLAPrint.cpp
3
@@ -19,8 +19,6 @@
4
 #include <libnest2d/tools/benchmark.h>
5
 #endif
6
 
7
-//#include <tbb/spin_mutex.h>//#include "tbb/mutex.h"
8
-
9
 #include "I18N.hpp"
10
 
11
 //! macro used to mark string used at localization,
12
@@ -118,7 +116,7 @@ bool validate_pad(const TriangleMesh &pad, const sla::
13
 
14
 void SLAPrint::clear()
15
 {
16
-    tbb::mutex::scoped_lock lock(this->state_mutex());
17
+    std::scoped_lock<std::mutex> lock(this->state_mutex());
18
     // The following call should stop background processing if it is running.
19
     this->invalidate_all_steps();
20
     for (SLAPrintObject *object : m_objects)
21
@@ -212,7 +210,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &mod
22
         update_apply_status(false);
23
 
24
     // Grab the lock for the Print / PrintObject milestones.
25
-    tbb::mutex::scoped_lock lock(this->state_mutex());
26
+    std::scoped_lock<std::mutex> lock(this->state_mutex());
27
 
28
     // The following call may stop the background processing.
29
     bool invalidate_all_model_objects = false;
30
@@ -514,7 +512,7 @@ SLAPrint::ApplyStatus SLAPrint::apply(const Model &mod
31
 void SLAPrint::set_task(const TaskParams &params)
32
 {
33
     // Grab the lock for the Print / PrintObject milestones.
34
-    tbb::mutex::scoped_lock lock(this->state_mutex());
35
+    std::scoped_lock<std::mutex> lock(this->state_mutex());
36
 
37
     int n_object_steps = int(params.to_object_step) + 1;
38
     if (n_object_steps == 0)
39
@@ -884,7 +882,7 @@ bool SLAPrint::is_step_done(SLAPrintObjectStep step) c
40
 {
41
     if (m_objects.empty())
42
         return false;
43
-    tbb::mutex::scoped_lock lock(this->state_mutex());
44
+    std::scoped_lock<std::mutex> lock(this->state_mutex());
45
     for (const SLAPrintObject *object : m_objects)
46
         if (! object->is_step_done_unguarded(step))
47
             return false;
(-)cad/PrusaSlicer/files/patch-src_libslic3r_SLA_Concurrency.hpp (+20 lines)
Added Link Here
1
--- src/libslic3r/SLA/Concurrency.hpp.orig	2021-08-14 22:14:14 UTC
2
+++ src/libslic3r/SLA/Concurrency.hpp
3
@@ -2,7 +2,7 @@
4
 #define SLA_CONCURRENCY_H
5
 
6
 #include <tbb/spin_mutex.h>
7
-#include <tbb/mutex.h>
8
+#include <mutex>
9
 #include <tbb/parallel_for.h>
10
 #include <tbb/parallel_reduce.h>
11
 
12
@@ -23,7 +23,7 @@ template<bool> struct _ccr {};
13
 template<> struct _ccr<true>
14
 {
15
     using SpinningMutex = tbb::spin_mutex;
16
-    using BlockingMutex = tbb::mutex;
17
+    using BlockingMutex = std::mutex;
18
 
19
     template<class Fn, class It>
20
     static IteratorOnly<It, void> loop_(const tbb::blocked_range<It> &range, Fn &&fn)
(-)cad/PrusaSlicer/files/patch-src_libslic3r_SLA_SupportTree.cpp (+12 lines)
Added Link Here
1
--- src/libslic3r/SLA/SupportTree.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/SLA/SupportTree.cpp
3
@@ -16,9 +16,6 @@
4
 #include <libnest2d/optimizers/nlopt/genetic.hpp>
5
 #include <libnest2d/optimizers/nlopt/subplex.hpp>
6
 #include <boost/log/trivial.hpp>
7
-#include <tbb/parallel_for.h>
8
-#include <tbb/mutex.h>
9
-#include <tbb/spin_mutex.h>
10
 #include <libslic3r/I18N.hpp>
11
 
12
 //! macro used to mark string used at localization,
(-)cad/PrusaSlicer/files/patch-src_libslic3r_SupportMaterial.cpp (+10 lines)
Added Link Here
1
--- src/libslic3r/SupportMaterial.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/SupportMaterial.cpp
3
@@ -12,7 +12,6 @@
4
 #include <boost/log/trivial.hpp>
5
 
6
 #include <tbb/parallel_for.h>
7
-#include <tbb/atomic.h>
8
 #include <tbb/spin_mutex.h>
9
 #include <tbb/task_group.h>
10
 
(-)cad/PrusaSlicer/files/patch-src_libslic3r_Thread.cpp (-36 / +35 lines)
Lines 2-46 Note that this patch may be removed after FreeBSD 11.x EoL Link Here
2
as latest FreeBSD versions have proper
2
as latest FreeBSD versions have proper
3
pthread_setname_np/pthread_getname_np support.
3
pthread_setname_np/pthread_getname_np support.
4
4
5
--- src/libslic3r/Thread.cpp.orig	2021-01-11 13:01:51 UTC
5
--- src/libslic3r/Thread.cpp.orig	2021-07-16 10:14:03 UTC
6
+++ src/libslic3r/Thread.cpp
6
+++ src/libslic3r/Thread.cpp
7
@@ -4,6 +4,7 @@
7
@@ -9,10 +9,10 @@
8
 #else
9
 	// any posix system
10
 	#include <pthread.h>
11
+	#include <pthread_np.h>
12
 #endif
13
 
14
 #include <atomic>
8
 #include <atomic>
15
@@ -161,26 +162,27 @@ std::optional<std::string> get_current_thread_name()
9
 #include <condition_variable>
16
 // posix
10
 #include <mutex>
17
 bool set_thread_name(std::thread &thread, const char *thread_name)
11
+#include <thread>
18
 {
12
+#include <tbb/global_control.h>
19
-   	pthread_setname_np(thread.native_handle(), thread_name);
13
 #include <tbb/parallel_for.h>
20
+   	pthread_set_name_np(thread.native_handle(), thread_name);
14
-#include <tbb/tbb_thread.h>
21
 	return true;
15
 #include <tbb/task_arena.h>
22
 }
16
-#include <tbb/task_scheduler_init.h>
23
 
17
 
24
 bool set_thread_name(boost::thread &thread, const char *thread_name)
18
 #include "Thread.hpp"
25
 {
26
-   	pthread_setname_np(thread.native_handle(), thread_name);
27
+   	pthread_set_name_np(thread.native_handle(), thread_name);
28
 	return true;
29
 }
30
 
19
 
31
 bool set_current_thread_name(const char *thread_name)
20
@@ -206,13 +206,13 @@ void name_tbb_thread_pool_threads()
32
 {
21
 	nthreads = 1;
33
-	pthread_setname_np(pthread_self(), thread_name);
22
 #endif
34
+	pthread_set_name_np(pthread_self(), thread_name);
35
 	return true;
36
 }
37
 
23
 
38
 std::optional<std::string> get_current_thread_name()
24
-	if (nthreads != nthreads_hw) 
39
 {
25
-		new tbb::task_scheduler_init(int(nthreads));
40
 	char buf[16];
26
+	if (nthreads != nthreads_hw)
41
-	return std::string(pthread_getname_np(pthread_self(), buf, 16) == 0 ? buf : "");
27
+		tbb::global_control(tbb::global_control::max_allowed_parallelism, nthreads);
42
+	pthread_get_name_np(pthread_self(), buf, 16);
43
+	return std::string(buf);
44
 }
45
 
28
 
46
 #endif
29
 	std::atomic<size_t>		nthreads_running(0);
30
 	std::condition_variable cv;
31
 	std::mutex				cv_m;
32
-	auto					master_thread_id = tbb::this_tbb_thread::get_id();
33
+	auto					master_thread_id = std::this_thread::get_id();
34
     tbb::parallel_for(
35
         tbb::blocked_range<size_t>(0, nthreads, 1),
36
         [&nthreads_running, nthreads, &master_thread_id, &cv, &cv_m](const tbb::blocked_range<size_t> &range) {
37
@@ -226,7 +226,7 @@ void name_tbb_thread_pool_threads()
38
 				std::unique_lock<std::mutex> lk(cv_m);
39
 			    cv.wait(lk, [&nthreads_running, nthreads]{return nthreads_running == nthreads;});
40
         	}
41
-        	auto thread_id = tbb::this_tbb_thread::get_id();
42
+        	auto thread_id = std::this_thread::get_id();
43
 			if (thread_id == master_thread_id) {
44
 				// The calling thread runs the 0'th task.
45
 				assert(range.begin() == 0);
(-)cad/PrusaSlicer/files/patch-src_libslic3r_pchheader.hpp (+15 lines)
Added Link Here
1
--- src/libslic3r/pchheader.hpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/pchheader.hpp
3
@@ -93,12 +93,9 @@
4
 #include <boost/thread.hpp>
5
 #include <boost/version.hpp>
6
 
7
-#include <tbb/atomic.h>
8
 #include <tbb/parallel_for.h>
9
 #include <tbb/spin_mutex.h>
10
-#include <tbb/mutex.h>
11
 #include <tbb/task_group.h>
12
-#include <tbb/task_scheduler_init.h>
13
 
14
 #include <Eigen/Dense>
15
 #include <Eigen/Geometry>
(-)cad/PrusaSlicer/files/patch-src_libslic3r_utils.cpp (+22 lines)
Added Link Here
1
--- src/libslic3r/utils.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/libslic3r/utils.cpp
3
@@ -43,7 +43,7 @@
4
 #include <boost/nowide/convert.hpp>
5
 #include <boost/nowide/cstdio.hpp>
6
 
7
-#include <tbb/task_scheduler_init.h>
8
+#include <tbb/global_control.h>
9
 
10
 #if defined(__linux__) || defined(__GNUC__ )
11
 #include <strings.h>
12
@@ -118,9 +118,7 @@ void trace(unsigned int level, const char *message)
13
 void disable_multi_threading()
14
 {
15
     // Disable parallelization so the Shiny profiler works
16
-    static tbb::task_scheduler_init *tbb_init = nullptr;
17
-    if (tbb_init == nullptr)
18
-        tbb_init = new tbb::task_scheduler_init(1);
19
+    tbb::global_control(tbb::global_control::max_allowed_parallelism, 1);
20
 }
21
 
22
 static std::string g_var_dir;
(-)cad/PrusaSlicer/files/patch-src_slic3r_GUI_BackgroundSlicingProcess.cpp (+29 lines)
Added Link Here
1
--- src/slic3r/GUI/BackgroundSlicingProcess.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/slic3r/GUI/BackgroundSlicingProcess.cpp
3
@@ -465,7 +465,7 @@ void BackgroundSlicingProcess::schedule_export(const s
4
 		return;
5
 
6
 	// Guard against entering the export step before changing the export path.
7
-	tbb::mutex::scoped_lock lock(m_print->state_mutex());
8
+	std::scoped_lock<std::mutex> lock(m_print->state_mutex());
9
 	this->invalidate_step(bspsGCodeFinalize);
10
 	m_export_path = path;
11
 	m_export_path_on_removable_media = export_path_on_removable_media;
12
@@ -478,7 +478,7 @@ void BackgroundSlicingProcess::schedule_upload(Slic3r:
13
 		return;
14
 
15
 	// Guard against entering the export step before changing the export path.
16
-	tbb::mutex::scoped_lock lock(m_print->state_mutex());
17
+	std::scoped_lock<std::mutex> lock(m_print->state_mutex());
18
 	this->invalidate_step(bspsGCodeFinalize);
19
 	m_export_path.clear();
20
 	m_upload_job = std::move(upload_job);
21
@@ -491,7 +491,7 @@ void BackgroundSlicingProcess::reset_export()
22
 		m_export_path.clear();
23
 		m_export_path_on_removable_media = false;
24
 		// invalidate_step expects the mutex to be locked.
25
-		tbb::mutex::scoped_lock lock(m_print->state_mutex());
26
+		std::scoped_lock<std::mutex> lock(m_print->state_mutex());
27
 		this->invalidate_step(bspsGCodeFinalize);
28
 	}
29
 }
(-)cad/PrusaSlicer/files/patch-src_slic3r_GUI_BackgroundSlicingProcess.hpp (+11 lines)
Added Link Here
1
--- src/slic3r/GUI/BackgroundSlicingProcess.hpp.orig	2021-08-14 22:52:55 UTC
2
+++ src/slic3r/GUI/BackgroundSlicingProcess.hpp
3
@@ -213,7 +213,7 @@ class BackgroundSlicingProcess (private)
4
 	State 						m_state = STATE_INITIAL;
5
 
6
     PrintState<BackgroundSlicingProcessStep, bspsCount>   	m_step_state;
7
-    mutable tbb::mutex                      				m_step_state_mutex;
8
+    mutable std::mutex                      				m_step_state_mutex;
9
 	bool                set_step_started(BackgroundSlicingProcessStep step);
10
 	void                set_step_done(BackgroundSlicingProcessStep step);
11
 	bool 				is_step_done(BackgroundSlicingProcessStep step) const;
(-)cad/PrusaSlicer/files/patch-src_slic3r_GUI_InstanceCheck.hpp (+11 lines)
Added Link Here
1
--- src/slic3r/GUI/InstanceCheck.hpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/slic3r/GUI/InstanceCheck.hpp
3
@@ -13,7 +13,7 @@
4
 
5
 #if __linux__
6
 #include <boost/thread.hpp>
7
-#include <tbb/mutex.h>
8
+#include <mutex>
9
 #include <condition_variable>
10
 #endif // __linux__
11
 
(-)cad/PrusaSlicer/files/patch-src_slic3r_GUI_Mouse3DController.cpp (+154 lines)
Added Link Here
1
--- src/slic3r/GUI/Mouse3DController.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/slic3r/GUI/Mouse3DController.cpp
3
@@ -66,7 +66,7 @@ void update_maximum(std::atomic<T>& maximum_value, T c
4
 
5
 void Mouse3DController::State::append_translation(const Vec3d& translation, size_t input_queue_max_size)
6
 {
7
-	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
8
+    std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
9
     while (m_input_queue.size() >= input_queue_max_size)
10
         m_input_queue.pop_front();
11
     m_input_queue.emplace_back(QueueItem::translation(translation));
12
@@ -77,7 +77,7 @@ void Mouse3DController::State::append_translation(cons
13
 
14
 void Mouse3DController::State::append_rotation(const Vec3f& rotation, size_t input_queue_max_size)
15
 {
16
-	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
17
+    std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
18
     while (m_input_queue.size() >= input_queue_max_size)
19
         m_input_queue.pop_front();
20
     m_input_queue.emplace_back(QueueItem::rotation(rotation.cast<double>()));
21
@@ -92,7 +92,7 @@ void Mouse3DController::State::append_rotation(const V
22
 
23
 void Mouse3DController::State::append_button(unsigned int id, size_t /* input_queue_max_size */)
24
 {
25
-	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
26
+    std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
27
     m_input_queue.emplace_back(QueueItem::buttons(id));
28
 #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
29
     update_maximum(input_queue_max_size_achieved, m_input_queue.size());
30
@@ -277,7 +277,7 @@ void Mouse3DController::device_attached(const std::str
31
 #if ENABLE_CTRL_M_ON_WINDOWS
32
             m_device_str = format_device_string(vid, pid);
33
             if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) {
34
-                tbb::mutex::scoped_lock lock(m_params_ui_mutex);
35
+                std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
36
                 m_params = m_params_ui = it_params->second;
37
             }
38
             else
39
@@ -295,7 +295,7 @@ void Mouse3DController::device_detached(const std::str
40
     int pid = 0;
41
     if (sscanf(device.c_str(), "\\\\?\\HID#VID_%x&PID_%x&", &vid, &pid) == 2) {
42
         if (std::find(_3DCONNEXION_VENDORS.begin(), _3DCONNEXION_VENDORS.end(), vid) != _3DCONNEXION_VENDORS.end()) {
43
-            tbb::mutex::scoped_lock lock(m_params_ui_mutex);
44
+            std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
45
             m_params_by_device[format_device_string(vid, pid)] = m_params_ui;
46
         }
47
     }
48
@@ -307,12 +307,12 @@ void Mouse3DController::device_detached(const std::str
49
 // Filter out mouse scroll events produced by the 3DConnexion driver.
50
 bool Mouse3DController::State::process_mouse_wheel()
51
 {
52
-	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
53
-	if (m_mouse_wheel_counter == 0)
54
-    	// No 3DConnexion rotation has been captured since the last mouse scroll event.
55
+    std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
56
+    if (m_mouse_wheel_counter == 0)
57
+        // No 3DConnexion rotation has been captured since the last mouse scroll event.
58
         return false;
59
     if (std::find_if(m_input_queue.begin(), m_input_queue.end(), [](const QueueItem &item){ return item.is_rotation(); }) != m_input_queue.end()) {
60
-    	// There is a rotation stored in the queue. Suppress one mouse scroll event.
61
+        // There is a rotation stored in the queue. Suppress one mouse scroll event.
62
         -- m_mouse_wheel_counter;
63
         return true;
64
     }
65
@@ -329,7 +329,7 @@ bool Mouse3DController::State::apply(const Mouse3DCont
66
     std::deque<QueueItem> input_queue;
67
     {
68
     	// Atomically move m_input_queue to input_queue.
69
-    	tbb::mutex::scoped_lock lock(m_input_queue_mutex);
70
+    	std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
71
     	input_queue = std::move(m_input_queue);
72
         m_input_queue.clear();
73
     }
74
@@ -418,7 +418,7 @@ bool Mouse3DController::apply(Camera& camera)
75
 #if ENABLE_CTRL_M_ON_WINDOWS
76
 #ifdef _WIN32
77
     {
78
-        tbb::mutex::scoped_lock lock(m_params_ui_mutex);
79
+        std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
80
         if (m_params_ui_changed) {
81
             m_params = m_params_ui;
82
             m_params_ui_changed = false;
83
@@ -447,7 +447,7 @@ void Mouse3DController::render_settings_dialog(GLCanva
84
     Params params_copy;
85
     bool   params_changed = false;
86
     {
87
-    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
88
+    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
89
     	params_copy = m_params_ui;
90
     }
91
 
92
@@ -565,7 +565,7 @@ void Mouse3DController::render_settings_dialog(GLCanva
93
 
94
     if (params_changed) {
95
         // Synchronize front end parameters to back end.
96
-    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
97
+    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
98
         auto pthis = const_cast<Mouse3DController*>(this);
99
 #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
100
         if (params_copy.input_queue_max_size != params_copy.input_queue_max_size)
101
@@ -586,7 +586,7 @@ void Mouse3DController::connected(std::string device_n
102
 	m_device_str = device_name;
103
     // Copy the parameters for m_device_str into the current parameters.
104
     if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) {
105
-    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
106
+    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
107
     	m_params = m_params_ui = it_params->second;
108
     }
109
     m_connected = true;
110
@@ -597,7 +597,7 @@ void Mouse3DController::disconnected()
111
     // Copy the current parameters for m_device_str into the parameter database.
112
     assert(m_connected == ! m_device_str.empty());
113
     if (m_connected) {
114
-        tbb::mutex::scoped_lock lock(m_params_ui_mutex);
115
+        std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
116
         m_params_by_device[m_device_str] = m_params_ui;
117
 	    m_device_str.clear();
118
 	    m_connected = false;
119
@@ -621,7 +621,7 @@ bool Mouse3DController::handle_input(const DataPacketA
120
     {
121
     	// Synchronize parameters between the UI thread and the background thread.
122
     	//FIXME is this necessary on OSX? Are these notifications triggered from the main thread or from a worker thread?
123
-    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
124
+    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
125
     	if (m_params_ui_changed) {
126
     		m_params = m_params_ui;
127
     		m_params_ui_changed = false;
128
@@ -733,7 +733,7 @@ void Mouse3DController::run()
129
 
130
     for (;;) {
131
         {
132
-        	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
133
+        	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
134
         	if (m_stop)
135
         		break;
136
         	if (m_params_ui_changed) {
137
@@ -998,7 +998,7 @@ bool Mouse3DController::connect_device()
138
 #endif // ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
139
         // Copy the parameters for m_device_str into the current parameters.
140
         if (auto it_params = m_params_by_device.find(m_device_str); it_params != m_params_by_device.end()) {
141
-	    	tbb::mutex::scoped_lock lock(m_params_ui_mutex);
142
+	    	std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
143
 	    	m_params = m_params_ui = it_params->second;
144
 	    }
145
     }
146
@@ -1023,7 +1023,7 @@ void Mouse3DController::disconnect_device()
147
 	    BOOST_LOG_TRIVIAL(info) << "Disconnected device: " << m_device_str;
148
         // Copy the current parameters for m_device_str into the parameter database.
149
         {
150
-	        tbb::mutex::scoped_lock lock(m_params_ui_mutex);
151
+	        std::scoped_lock<std::mutex> lock(m_params_ui_mutex);
152
 	        m_params_by_device[m_device_str] = m_params_ui;
153
 	    }
154
 	    m_device_str.clear();
(-)cad/PrusaSlicer/files/patch-src_slic3r_GUI_Mouse3DController.hpp (+49 lines)
Added Link Here
1
--- src/slic3r/GUI/Mouse3DController.hpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/slic3r/GUI/Mouse3DController.hpp
3
@@ -10,12 +10,12 @@
4
 
5
 #include <queue>
6
 #include <atomic>
7
+#include <mutex>
8
 #include <thread>
9
 #include <vector>
10
 #include <chrono>
11
 #include <condition_variable>
12
 
13
-#include <tbb/mutex.h>
14
 
15
 namespace Slic3r {
16
 
17
@@ -85,7 +85,7 @@ class Mouse3DController
18
     	// m_input_queue is accessed by the background thread and by the UI thread. Access to m_input_queue
19
     	// is guarded with m_input_queue_mutex.
20
         std::deque<QueueItem> m_input_queue;
21
-        mutable tbb::mutex	  m_input_queue_mutex;
22
+        mutable std::mutex	  m_input_queue_mutex;
23
 
24
 #ifdef WIN32
25
         // When the 3Dconnexion driver is running the system gets, by default, mouse wheel events when rotations around the X axis are detected.
26
@@ -112,12 +112,12 @@ class Mouse3DController
27
 
28
 #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT
29
         Vec3d               get_first_vector_of_type(unsigned int type) const {
30
-            tbb::mutex::scoped_lock lock(m_input_queue_mutex);
31
+            std::scoped_lock<std::mutex> lock(m_input_queue_mutex);
32
             auto it = std::find_if(m_input_queue.begin(), m_input_queue.end(), [type](const QueueItem& item) { return item.type_or_buttons == type; });
33
             return (it == m_input_queue.end()) ? Vec3d::Zero() : it->vector;
34
         }
35
         size_t              input_queue_size_current() const { 
36
-        	tbb::mutex::scoped_lock lock(m_input_queue_mutex); 
37
+        	std::scoped_lock<std::mutex> lock(m_input_queue_mutex); 
38
         	return m_input_queue.size(); 
39
         }
40
         std::atomic<size_t> input_queue_max_size_achieved;
41
@@ -133,7 +133,7 @@ class Mouse3DController
42
     // UI thread will read / write this copy.
43
     Params 				m_params_ui;
44
     bool 	            m_params_ui_changed { false };
45
-    mutable tbb::mutex	m_params_ui_mutex;
46
+    mutable std::mutex	m_params_ui_mutex;
47
 
48
     // This is a database of parametes of all 3DConnexion devices ever connected.
49
     // This database is loaded from AppConfig on application start and it is stored to AppConfig on application exit.
(-)cad/PrusaSlicer/files/patch-src_slic3r_GUI_OpenGLManager.cpp (-2 / +2 lines)
Lines 1-6 Link Here
1
--- src/slic3r/GUI/OpenGLManager.cpp.orig	2021-08-03 16:17:35 UTC
1
--- src/slic3r/GUI/OpenGLManager.cpp.orig	2021-04-16 11:41:00 UTC
2
+++ src/slic3r/GUI/OpenGLManager.cpp
2
+++ src/slic3r/GUI/OpenGLManager.cpp
3
@@ -237,7 +237,8 @@ bool OpenGLManager::init_gl()
3
@@ -239,7 +239,8 @@ bool OpenGLManager::init_gl()
4
     if (!m_gl_initialized) {
4
     if (!m_gl_initialized) {
5
         if (glewInit() != GLEW_OK) {
5
         if (glewInit() != GLEW_OK) {
6
             BOOST_LOG_TRIVIAL(error) << "Unable to init glew library";
6
             BOOST_LOG_TRIVIAL(error) << "Unable to init glew library";
(-)cad/PrusaSlicer/files/patch-src_slic3r_GUI_RemovableDriveManager.cpp (+104 lines)
Added Link Here
1
--- src/slic3r/GUI/RemovableDriveManager.cpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/slic3r/GUI/RemovableDriveManager.cpp
3
@@ -84,7 +84,7 @@ void RemovableDriveManager::eject_drive()
4
 	this->update();
5
 #endif // REMOVABLE_DRIVE_MANAGER_OS_CALLBACKS
6
 	BOOST_LOG_TRIVIAL(info) << "Ejecting started"; 
7
-	tbb::mutex::scoped_lock lock(m_drives_mutex);
8
+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
9
 	auto it_drive_data = this->find_last_save_path_drive_data();
10
 	if (it_drive_data != m_current_drives.end()) {
11
 		// get handle to device
12
@@ -130,7 +130,7 @@ std::string RemovableDriveManager::get_removable_drive
13
 	this->update();
14
 #endif // REMOVABLE_DRIVE_MANAGER_OS_CALLBACKS
15
 
16
-	tbb::mutex::scoped_lock lock(m_drives_mutex);
17
+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
18
 	if (m_current_drives.empty())
19
 		return std::string();
20
 	std::size_t found = path.find_last_of("\\");
21
@@ -146,7 +146,7 @@ std::string RemovableDriveManager::get_removable_drive
22
 
23
 std::string RemovableDriveManager::get_removable_drive_from_path(const std::string& path)
24
 {
25
-	tbb::mutex::scoped_lock lock(m_drives_mutex);
26
+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
27
 	std::size_t found = path.find_last_of("\\");
28
 	std::string new_path = path.substr(0, found);
29
 	int letter = PathGetDriveNumberW(boost::nowide::widen(new_path).c_str());	
30
@@ -285,7 +285,7 @@ void RemovableDriveManager::eject_drive()
31
 
32
 	DriveData drive_data;
33
 	{
34
-		tbb::mutex::scoped_lock lock(m_drives_mutex);
35
+		std::scoped_lock<std::mutex> lock(m_drives_mutex);
36
 		auto it_drive_data = this->find_last_save_path_drive_data();
37
 		if (it_drive_data == m_current_drives.end())
38
 			return;
39
@@ -341,7 +341,7 @@ void RemovableDriveManager::eject_drive()
40
 		if (success) {
41
 			// Remove the drive_data from m_current drives, searching by value, not by pointer, as m_current_drives may get modified during
42
 			// asynchronous execution on m_eject_thread.
43
-			tbb::mutex::scoped_lock lock(m_drives_mutex);
44
+			std::scoped_lock<std::mutex> lock(m_drives_mutex);
45
 			auto it = std::find(m_current_drives.begin(), m_current_drives.end(), drive_data);
46
 			if (it != m_current_drives.end())
47
 				m_current_drives.erase(it);
48
@@ -361,7 +361,7 @@ std::string RemovableDriveManager::get_removable_drive
49
 	std::size_t found = path.find_last_of("/");
50
 	std::string new_path = found == path.size() - 1 ? path.substr(0, found) : path;
51
 
52
-	tbb::mutex::scoped_lock lock(m_drives_mutex);
53
+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
54
 	for (const DriveData &data : m_current_drives)
55
 		if (search_for_drives_internal::compare_filesystem_id(new_path, data.path))
56
 			return path;
57
@@ -377,7 +377,7 @@ std::string RemovableDriveManager::get_removable_drive
58
     new_path = new_path.substr(0, found);
59
     
60
 	// check if same filesystem
61
-	tbb::mutex::scoped_lock lock(m_drives_mutex);
62
+	std::scoped_lock<std::mutex> lock(m_drives_mutex);
63
 	for (const DriveData &drive_data : m_current_drives)
64
 		if (search_for_drives_internal::compare_filesystem_id(new_path, drive_data.path))
65
 			return drive_data.path;
66
@@ -452,7 +452,7 @@ RemovableDriveManager::RemovableDrivesStatus Removable
67
 
68
 	RemovableDriveManager::RemovableDrivesStatus out;
69
 	{
70
-		tbb::mutex::scoped_lock lock(m_drives_mutex);
71
+		std::scoped_lock<std::mutex> lock(m_drives_mutex);
72
 		out.has_eject = 
73
 			// Cannot control eject on Chromium.
74
 			platform_flavor() != PlatformFlavor::LinuxOnChromium &&
75
@@ -468,17 +468,17 @@ RemovableDriveManager::RemovableDrivesStatus Removable
76
 // Update is called from thread_proc() and from most of the public methods on demand.
77
 void RemovableDriveManager::update()
78
 {
79
-	tbb::mutex::scoped_lock inside_update_lock;
80
+	std::unique_lock<std::mutex> inside_update_lock(m_inside_update_mutex, std::defer_lock);
81
 #ifdef _WIN32
82
 	// All wake up calls up to now are now consumed when the drive enumeration starts.
83
 	m_wakeup = false;
84
 #endif // _WIN32
85
-	if (inside_update_lock.try_acquire(m_inside_update_mutex)) {
86
+	if (inside_update_lock.try_lock()) {
87
 		// Got the lock without waiting. That means, the update was not running.
88
 		// Run the update.
89
 		std::vector<DriveData> current_drives = this->search_for_removable_drives();
90
 		// Post update events.
91
-		tbb::mutex::scoped_lock lock(m_drives_mutex);
92
+		std::scoped_lock<std::mutex> lock(m_drives_mutex);
93
 		std::sort(current_drives.begin(), current_drives.end());
94
 		if (current_drives != m_current_drives) {
95
 			assert(m_callback_evt_handler);
96
@@ -489,7 +489,7 @@ void RemovableDriveManager::update()
97
 	} else {
98
 		// Acquiring the m_iniside_update lock failed, therefore another update is running.
99
 		// Just block until the other instance of update() finishes.
100
-		inside_update_lock.acquire(m_inside_update_mutex);
101
+		inside_update_lock.lock();
102
 	}
103
 }
104
 
(-)cad/PrusaSlicer/files/patch-src_slic3r_GUI_RemovableDriveManager.hpp (+23 lines)
Added Link Here
1
--- src/slic3r/GUI/RemovableDriveManager.hpp.orig	2021-07-16 10:14:03 UTC
2
+++ src/slic3r/GUI/RemovableDriveManager.hpp
3
@@ -5,7 +5,7 @@
4
 #include <string>
5
 
6
 #include <boost/thread.hpp>
7
-#include <tbb/mutex.h>
8
+#include <mutex>
9
 #include <condition_variable>
10
 
11
 // Custom wxWidget events
12
@@ -111,9 +111,9 @@ class RemovableDriveManager (private)
13
 	// m_current_drives is guarded by m_drives_mutex
14
 	// sorted ascending by path
15
 	std::vector<DriveData> 	m_current_drives;
16
-	mutable tbb::mutex 		m_drives_mutex;
17
+	mutable std::mutex 		m_drives_mutex;
18
 	// Locking the update() function to avoid that the function is executed multiple times.
19
-	mutable tbb::mutex 		m_inside_update_mutex;
20
+	mutable std::mutex 		m_inside_update_mutex;
21
 
22
 	// Returns drive path (same as path in DriveData) if exists otherwise empty string.
23
 	std::string 			get_removable_drive_from_path(const std::string& path);

Return to bug 255363