Initial implementation of a CMake build system for the Slic3r XS module.
Based on https://github.com/CReimer/Slic3r/tree/makefile_pr Big thanks to @CReimer for his huge effort.
This commit is contained in:
parent
507f2ff45e
commit
5673205d2e
29
CMakeLists.txt
Normal file
29
CMakeLists.txt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Boost 1.63 requires CMake 3.7 or newer
|
||||||
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
|
||||||
|
project(Slic3r)
|
||||||
|
|
||||||
|
if (MSVC OR MINGW OR APPLE)
|
||||||
|
set(SLIC3R_STATIC_INITIAL 1)
|
||||||
|
else ()
|
||||||
|
set(SLIC3R_STATIC_INITIAL 0)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
option(SLIC3R_STATIC "Compile Slic3r with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
|
||||||
|
option(SLIC3R_PROFILE "Compile Slic3r with an invasive Shiny profiler" 0)
|
||||||
|
option(SLIC3R_HAS_BROKEN_CROAK "Compile Slic3r for a broken Strawberry Perl 64bit" 0)
|
||||||
|
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
|
||||||
|
|
||||||
|
if (MSVC AND SLIC3R_MSVC_COMPILE_PARALLEL)
|
||||||
|
set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS} /MP)
|
||||||
|
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} /MP)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
add_subdirectory(xs)
|
||||||
|
|
||||||
|
install(PROGRAMS slic3r.pl DESTINATION bin RENAME slic3r-prusa3d)
|
||||||
|
|
||||||
|
file(GLOB MyVar var/*.png)
|
||||||
|
install(FILES ${MyVar} DESTINATION share/slic3r-prusa3d)
|
||||||
|
install(FILES lib/Slic3r.pm DESTINATION lib/slic3r-prusa3d)
|
||||||
|
install(DIRECTORY lib/Slic3r DESTINATION lib/slic3r-prusa3d)
|
86
cmake/modules/FindEigen3.cmake
Normal file
86
cmake/modules/FindEigen3.cmake
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# - Try to find Eigen3 lib
|
||||||
|
#
|
||||||
|
# This module supports requiring a minimum version, e.g. you can do
|
||||||
|
# find_package(Eigen3 3.1.2)
|
||||||
|
# to require version 3.1.2 or newer of Eigen3.
|
||||||
|
#
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# EIGEN3_FOUND - system has eigen lib with correct version
|
||||||
|
# EIGEN3_INCLUDE_DIR - the eigen include directory
|
||||||
|
# EIGEN3_VERSION - eigen version
|
||||||
|
|
||||||
|
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
|
||||||
|
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
|
||||||
|
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
||||||
|
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
|
||||||
|
|
||||||
|
if(NOT Eigen3_FIND_VERSION)
|
||||||
|
if(NOT Eigen3_FIND_VERSION_MAJOR)
|
||||||
|
set(Eigen3_FIND_VERSION_MAJOR 2)
|
||||||
|
endif(NOT Eigen3_FIND_VERSION_MAJOR)
|
||||||
|
if(NOT Eigen3_FIND_VERSION_MINOR)
|
||||||
|
set(Eigen3_FIND_VERSION_MINOR 91)
|
||||||
|
endif(NOT Eigen3_FIND_VERSION_MINOR)
|
||||||
|
if(NOT Eigen3_FIND_VERSION_PATCH)
|
||||||
|
set(Eigen3_FIND_VERSION_PATCH 0)
|
||||||
|
endif(NOT Eigen3_FIND_VERSION_PATCH)
|
||||||
|
|
||||||
|
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
|
||||||
|
endif(NOT Eigen3_FIND_VERSION)
|
||||||
|
|
||||||
|
macro(_eigen3_check_version)
|
||||||
|
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
|
||||||
|
|
||||||
|
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
|
||||||
|
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
|
||||||
|
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
|
||||||
|
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
|
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
|
||||||
|
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||||
|
set(EIGEN3_VERSION_OK FALSE)
|
||||||
|
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||||
|
set(EIGEN3_VERSION_OK TRUE)
|
||||||
|
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
|
||||||
|
|
||||||
|
if(NOT EIGEN3_VERSION_OK)
|
||||||
|
|
||||||
|
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
|
||||||
|
"but at least version ${Eigen3_FIND_VERSION} is required")
|
||||||
|
endif(NOT EIGEN3_VERSION_OK)
|
||||||
|
endmacro(_eigen3_check_version)
|
||||||
|
|
||||||
|
if (EIGEN3_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# in cache already
|
||||||
|
_eigen3_check_version()
|
||||||
|
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
|
||||||
|
|
||||||
|
else (EIGEN3_INCLUDE_DIR)
|
||||||
|
|
||||||
|
# specific additional paths for some OS
|
||||||
|
if (WIN32)
|
||||||
|
set(EIGEN_ADDITIONAL_SEARCH_PATHS ${EIGEN_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/Eigen/include" "C:/Program Files (x86)/Eigen/include")
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
|
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
|
||||||
|
PATHS
|
||||||
|
${CMAKE_INSTALL_PREFIX}/include
|
||||||
|
${EIGEN_ADDITIONAL_SEARCH_PATHS}
|
||||||
|
${KDE4_INCLUDE_DIR}
|
||||||
|
PATH_SUFFIXES eigen3 eigen
|
||||||
|
)
|
||||||
|
|
||||||
|
if(EIGEN3_INCLUDE_DIR)
|
||||||
|
_eigen3_check_version()
|
||||||
|
endif(EIGEN3_INCLUDE_DIR)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
|
||||||
|
|
||||||
|
mark_as_advanced(EIGEN3_INCLUDE_DIR)
|
||||||
|
|
||||||
|
endif(EIGEN3_INCLUDE_DIR)
|
303
cmake/modules/FindTBB.cmake
Normal file
303
cmake/modules/FindTBB.cmake
Normal file
@ -0,0 +1,303 @@
|
|||||||
|
# The MIT License (MIT)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015 Justus Calvin
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
#
|
||||||
|
# FindTBB
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# Find TBB include directories and libraries.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# find_package(TBB [major[.minor]] [EXACT]
|
||||||
|
# [QUIET] [REQUIRED]
|
||||||
|
# [[COMPONENTS] [components...]]
|
||||||
|
# [OPTIONAL_COMPONENTS components...])
|
||||||
|
#
|
||||||
|
# where the allowed components are tbbmalloc and tbb_preview. Users may modify
|
||||||
|
# the behavior of this module with the following variables:
|
||||||
|
#
|
||||||
|
# * TBB_ROOT_DIR - The base directory the of TBB installation.
|
||||||
|
# * TBB_INCLUDE_DIR - The directory that contains the TBB headers files.
|
||||||
|
# * TBB_LIBRARY - The directory that contains the TBB library files.
|
||||||
|
# * TBB_<library>_LIBRARY - The path of the TBB the corresponding TBB library.
|
||||||
|
# These libraries, if specified, override the
|
||||||
|
# corresponding library search results, where <library>
|
||||||
|
# may be tbb, tbb_debug, tbbmalloc, tbbmalloc_debug,
|
||||||
|
# tbb_preview, or tbb_preview_debug.
|
||||||
|
# * TBB_USE_DEBUG_BUILD - The debug version of tbb libraries, if present, will
|
||||||
|
# be used instead of the release version.
|
||||||
|
#
|
||||||
|
# Users may modify the behavior of this module with the following environment
|
||||||
|
# variables:
|
||||||
|
#
|
||||||
|
# * TBB_INSTALL_DIR
|
||||||
|
# * TBBROOT
|
||||||
|
# * LIBRARY_PATH
|
||||||
|
#
|
||||||
|
# This module will set the following variables:
|
||||||
|
#
|
||||||
|
# * TBB_FOUND - Set to false, or undefined, if we haven’t found, or
|
||||||
|
# don’t want to use TBB.
|
||||||
|
# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
|
||||||
|
# not available.
|
||||||
|
# * TBB_VERSION - The full version string
|
||||||
|
# * TBB_VERSION_MAJOR - The major version
|
||||||
|
# * TBB_VERSION_MINOR - The minor version
|
||||||
|
# * TBB_INTERFACE_VERSION - The interface version number defined in
|
||||||
|
# tbb/tbb_stddef.h.
|
||||||
|
# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of
|
||||||
|
# <library>, where <library> may be tbb, tbb_debug,
|
||||||
|
# tbbmalloc, tbbmalloc_debug, tbb_preview, or
|
||||||
|
# tbb_preview_debug.
|
||||||
|
# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of
|
||||||
|
# <library>, where <library> may be tbb, tbb_debug,
|
||||||
|
# tbbmalloc, tbbmalloc_debug, tbb_preview, or
|
||||||
|
# tbb_preview_debug.
|
||||||
|
#
|
||||||
|
# The following varibles should be used to build and link with TBB:
|
||||||
|
#
|
||||||
|
# * TBB_INCLUDE_DIRS - The include directory for TBB.
|
||||||
|
# * TBB_LIBRARIES - The libraries to link against to use TBB.
|
||||||
|
# * TBB_LIBRARIES_RELEASE - The release libraries to link against to use TBB.
|
||||||
|
# * TBB_LIBRARIES_DEBUG - The debug libraries to link against to use TBB.
|
||||||
|
# * TBB_DEFINITIONS - Definitions to use when compiling code that uses
|
||||||
|
# TBB.
|
||||||
|
# * TBB_DEFINITIONS_RELEASE - Definitions to use when compiling release code that
|
||||||
|
# uses TBB.
|
||||||
|
# * TBB_DEFINITIONS_DEBUG - Definitions to use when compiling debug code that
|
||||||
|
# uses TBB.
|
||||||
|
#
|
||||||
|
# This module will also create the "tbb" target that may be used when building
|
||||||
|
# executables and libraries.
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
if(NOT TBB_FOUND)
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Check the build type
|
||||||
|
##################################
|
||||||
|
|
||||||
|
if(NOT DEFINED TBB_USE_DEBUG_BUILD)
|
||||||
|
if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug|RelWithDebInfo|RELWITHDEBINFO|relwithdebinfo)")
|
||||||
|
set(TBB_BUILD_TYPE DEBUG)
|
||||||
|
else()
|
||||||
|
set(TBB_BUILD_TYPE RELEASE)
|
||||||
|
endif()
|
||||||
|
elseif(TBB_USE_DEBUG_BUILD)
|
||||||
|
set(TBB_BUILD_TYPE DEBUG)
|
||||||
|
else()
|
||||||
|
set(TBB_BUILD_TYPE RELEASE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Set the TBB search directories
|
||||||
|
##################################
|
||||||
|
|
||||||
|
# Define search paths based on user input and environment variables
|
||||||
|
set(TBB_SEARCH_DIR ${TBB_ROOT_DIR} $ENV{TBB_INSTALL_DIR} $ENV{TBBROOT})
|
||||||
|
|
||||||
|
# Define the search directories based on the current platform
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
|
set(TBB_DEFAULT_SEARCH_DIR "C:/Program Files/Intel/TBB"
|
||||||
|
"C:/Program Files (x86)/Intel/TBB")
|
||||||
|
|
||||||
|
# Set the target architecture
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(TBB_ARCHITECTURE "intel64")
|
||||||
|
else()
|
||||||
|
set(TBB_ARCHITECTURE "ia32")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set the TBB search library path search suffix based on the version of VC
|
||||||
|
if(WINDOWS_STORE)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11_ui")
|
||||||
|
elseif(MSVC14)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc14")
|
||||||
|
elseif(MSVC12)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc12")
|
||||||
|
elseif(MSVC11)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc11")
|
||||||
|
elseif(MSVC10)
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc10")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add the library path search suffix for the VC independent version of TBB
|
||||||
|
list(APPEND TBB_LIB_PATH_SUFFIX "lib/${TBB_ARCHITECTURE}/vc_mt")
|
||||||
|
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
# OS X
|
||||||
|
set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
|
||||||
|
|
||||||
|
# TODO: Check to see which C++ library is being used by the compiler.
|
||||||
|
if(NOT ${CMAKE_SYSTEM_VERSION} VERSION_LESS 13.0)
|
||||||
|
# The default C++ library on OS X 10.9 and later is libc++
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/libc++" "lib")
|
||||||
|
else()
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib")
|
||||||
|
endif()
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
# Linux
|
||||||
|
set(TBB_DEFAULT_SEARCH_DIR "/opt/intel/tbb")
|
||||||
|
|
||||||
|
# TODO: Check compiler version to see the suffix should be <arch>/gcc4.1 or
|
||||||
|
# <arch>/gcc4.1. For now, assume that the compiler is more recent than
|
||||||
|
# gcc 4.4.x or later.
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/intel64/gcc4.4")
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
|
||||||
|
set(TBB_LIB_PATH_SUFFIX "lib/ia32/gcc4.4")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Find the TBB include dir
|
||||||
|
##################################
|
||||||
|
|
||||||
|
find_path(TBB_INCLUDE_DIRS tbb/tbb.h
|
||||||
|
HINTS ${TBB_INCLUDE_DIR} ${TBB_SEARCH_DIR}
|
||||||
|
PATHS ${TBB_DEFAULT_SEARCH_DIR}
|
||||||
|
PATH_SUFFIXES include)
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Set version strings
|
||||||
|
##################################
|
||||||
|
|
||||||
|
if(TBB_INCLUDE_DIRS)
|
||||||
|
file(READ "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" _tbb_version_file)
|
||||||
|
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1"
|
||||||
|
TBB_VERSION_MAJOR "${_tbb_version_file}")
|
||||||
|
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1"
|
||||||
|
TBB_VERSION_MINOR "${_tbb_version_file}")
|
||||||
|
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1"
|
||||||
|
TBB_INTERFACE_VERSION "${_tbb_version_file}")
|
||||||
|
set(TBB_VERSION "${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Find TBB components
|
||||||
|
##################################
|
||||||
|
|
||||||
|
if(TBB_VERSION VERSION_LESS 4.3)
|
||||||
|
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb)
|
||||||
|
else()
|
||||||
|
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find each component
|
||||||
|
foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
|
||||||
|
if(";${TBB_FIND_COMPONENTS};tbb;" MATCHES ";${_comp};")
|
||||||
|
|
||||||
|
# Search for the libraries
|
||||||
|
find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}
|
||||||
|
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
|
||||||
|
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
|
||||||
|
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
|
||||||
|
|
||||||
|
find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug
|
||||||
|
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
|
||||||
|
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
|
||||||
|
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
|
||||||
|
|
||||||
|
if(TBB_${_comp}_LIBRARY_DEBUG)
|
||||||
|
list(APPEND TBB_LIBRARIES_DEBUG "${TBB_${_comp}_LIBRARY_DEBUG}")
|
||||||
|
endif()
|
||||||
|
if(TBB_${_comp}_LIBRARY_RELEASE)
|
||||||
|
list(APPEND TBB_LIBRARIES_RELEASE "${TBB_${_comp}_LIBRARY_RELEASE}")
|
||||||
|
endif()
|
||||||
|
if(TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE} AND NOT TBB_${_comp}_LIBRARY)
|
||||||
|
set(TBB_${_comp}_LIBRARY "${TBB_${_comp}_LIBRARY_${TBB_BUILD_TYPE}}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
|
||||||
|
set(TBB_${_comp}_FOUND TRUE)
|
||||||
|
else()
|
||||||
|
set(TBB_${_comp}_FOUND FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Mark internal variables as advanced
|
||||||
|
mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
|
||||||
|
mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
|
||||||
|
mark_as_advanced(TBB_${_comp}_LIBRARY)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Set compile flags and libraries
|
||||||
|
##################################
|
||||||
|
|
||||||
|
set(TBB_DEFINITIONS_RELEASE "")
|
||||||
|
set(TBB_DEFINITIONS_DEBUG "-DTBB_USE_DEBUG=1")
|
||||||
|
|
||||||
|
if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
|
||||||
|
set(TBB_DEFINITIONS "${TBB_DEFINITIONS_${TBB_BUILD_TYPE}}")
|
||||||
|
set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
|
||||||
|
elseif(TBB_LIBRARIES_RELEASE)
|
||||||
|
set(TBB_DEFINITIONS "${TBB_DEFINITIONS_RELEASE}")
|
||||||
|
set(TBB_LIBRARIES "${TBB_LIBRARIES_RELEASE}")
|
||||||
|
elseif(TBB_LIBRARIES_DEBUG)
|
||||||
|
set(TBB_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}")
|
||||||
|
set(TBB_LIBRARIES "${TBB_LIBRARIES_DEBUG}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package_handle_standard_args(TBB
|
||||||
|
REQUIRED_VARS TBB_INCLUDE_DIRS TBB_LIBRARIES
|
||||||
|
HANDLE_COMPONENTS
|
||||||
|
VERSION_VAR TBB_VERSION)
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Create targets
|
||||||
|
##################################
|
||||||
|
|
||||||
|
if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
|
||||||
|
add_library(tbb SHARED IMPORTED)
|
||||||
|
set_target_properties(tbb PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS}
|
||||||
|
IMPORTED_LOCATION ${TBB_LIBRARIES})
|
||||||
|
if(TBB_LIBRARIES_RELEASE AND TBB_LIBRARIES_DEBUG)
|
||||||
|
set_target_properties(tbb PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:TBB_USE_DEBUG=1>"
|
||||||
|
IMPORTED_LOCATION_DEBUG ${TBB_LIBRARIES_DEBUG}
|
||||||
|
IMPORTED_LOCATION_RELWITHDEBINFO ${TBB_LIBRARIES_DEBUG}
|
||||||
|
IMPORTED_LOCATION_RELEASE ${TBB_LIBRARIES_RELEASE}
|
||||||
|
IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE}
|
||||||
|
)
|
||||||
|
elseif(TBB_LIBRARIES_RELEASE)
|
||||||
|
set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${TBB_LIBRARIES_RELEASE})
|
||||||
|
else()
|
||||||
|
set_target_properties(tbb PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS "${TBB_DEFINITIONS_DEBUG}"
|
||||||
|
IMPORTED_LOCATION ${TBB_LIBRARIES_DEBUG}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARIES)
|
||||||
|
|
||||||
|
unset(TBB_ARCHITECTURE)
|
||||||
|
unset(TBB_BUILD_TYPE)
|
||||||
|
unset(TBB_LIB_PATH_SUFFIX)
|
||||||
|
unset(TBB_DEFAULT_SEARCH_DIR)
|
||||||
|
|
||||||
|
endif()
|
265
xs/CMakeLists.txt
Normal file
265
xs/CMakeLists.txt
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
# Enable c++11 language standard
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
# Add our own cmake module path
|
||||||
|
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
|
||||||
|
|
||||||
|
set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
|
||||||
|
include_directories(${LIBDIR})
|
||||||
|
|
||||||
|
# Bring back SLIC3R_DYNAMIC logic from Build.PL
|
||||||
|
if (DEFINED SLIC3R_DYNAMIC AND NOT SLIC3R_DYNAMIC)
|
||||||
|
set(SLIC3R_STATIC 1)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Bring back SLIC3R_NOGUI logic from Build.PL
|
||||||
|
# Map SLIC3R_PRUS to SLIC3R_GUI
|
||||||
|
#if (DEFINED SLIC3R_NOGUI AND NOT SLIC3R_NOGUI OR SLIC3R_PRUS)
|
||||||
|
# set(SLIC3R_GUI 0)
|
||||||
|
#else ()
|
||||||
|
set(SLIC3R_GUI 1)
|
||||||
|
#endif ()
|
||||||
|
|
||||||
|
# Generate XS typemap file
|
||||||
|
find_package(Perl REQUIRED)
|
||||||
|
set(MyTypemap ${CMAKE_CURRENT_BINARY_DIR}/typemap)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${MyTypemap}
|
||||||
|
COMMAND ${PERL_EXECUTABLE} -MExtUtils::Typemaps -MExtUtils::Typemaps::Basic -e "$typemap = ExtUtils::Typemaps->new(file => \"${CMAKE_CURRENT_LIST_DIR}/xsp/my.map\"); $typemap->merge(typemap => ExtUtils::Typemaps::Basic->new); $typemap->write(file => \"${MyTypemap}\")"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
# Generate main.xs file
|
||||||
|
set(MyMainXs ${CMAKE_CURRENT_BINARY_DIR}/main.xs)
|
||||||
|
file(GLOB files xsp/*.xsp)
|
||||||
|
foreach (file ${files})
|
||||||
|
if (MSVC)
|
||||||
|
# Visual Studio C compiler has issues with FILE pragmas containing quotes.
|
||||||
|
set(INCLUDE_COMMANDS "${INCLUDE_COMMANDS}INCLUDE_COMMAND: $^X -MExtUtils::XSpp::Cmd -e xspp -- -t ${CMAKE_CURRENT_LIST_DIR}/xsp/typemap.xspt ${file}\n")
|
||||||
|
else ()
|
||||||
|
set(INCLUDE_COMMANDS "${INCLUDE_COMMANDS}INCLUDE_COMMAND: $^X -MExtUtils::XSpp::Cmd -e xspp -- -t \"${CMAKE_CURRENT_LIST_DIR}/xsp/typemap.xspt\" \"${file}\"\n")
|
||||||
|
endif ()
|
||||||
|
endforeach ()
|
||||||
|
configure_file(main.xs.in ${MyMainXs} @ONLY) # Insert INCLUDE_COMMANDS into main.xs
|
||||||
|
|
||||||
|
# Generate XS.cpp file
|
||||||
|
set(MyXsC "${CMAKE_CURRENT_BINARY_DIR}/XS.cpp")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${MyXsC}
|
||||||
|
DEPENDS ${MyTemplate} ${MyTypemap}
|
||||||
|
COMMAND COMMAND xsubpp -typemap typemap -output ${MyXsC} -hiertype ${MyMainXs}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Find and define all source files
|
||||||
|
file(GLOB MySrc src/*.cpp)
|
||||||
|
file(GLOB MyAdmesh src/admesh/*.cpp)
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(${MyAdmesh} PROPERTIES LANGUAGE CXX) # admesh has C++ syntax in it's source but the files are *.c
|
||||||
|
|
||||||
|
file(GLOB MyGuiSrc src/slic3r/GUI/*.cpp)
|
||||||
|
file(GLOB_RECURSE MyLibSlic3rSrc src/libslic3r/*.cpp)
|
||||||
|
file(GLOB_RECURSE MyPoly2TriSrc src/poly2tri/*.cc)
|
||||||
|
file(GLOB MyShinySrc src/Shiny/*.c)
|
||||||
|
|
||||||
|
# Define target file
|
||||||
|
add_library(XS SHARED ${MyXsC} ${MySrc} ${MyAdmesh} ${MyGuiSrc} ${MyLibSlic3rSrc} ${MyPoly2TriSrc} ${MyShinySrc})
|
||||||
|
|
||||||
|
# Add the OpenGL and GLU libraries.
|
||||||
|
if (SLIC3R_GUI)
|
||||||
|
if (MSVC)
|
||||||
|
target_link_libraries(XS OpenGL32.Lib GlU32.Lib)
|
||||||
|
elseif (MINGW)
|
||||||
|
target_link_libraries(XS -lopengl32)
|
||||||
|
elseif (APPLE)
|
||||||
|
target_link_libraries(XS -framework OpenGL)
|
||||||
|
else ()
|
||||||
|
target_link_libraries(XS -lGL -lGLU)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
target_include_directories(XS PRIVATE src src/libslic3r) # Local include directories
|
||||||
|
target_compile_definitions(XS PRIVATE -DSLIC3RXS)
|
||||||
|
set_target_properties(XS PROPERTIES PREFIX "") # Prevent cmake from generating libXS.so instead of XS.so
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE")
|
||||||
|
target_link_libraries(XS -framework IOKit -framework CoreFoundation -lc++)
|
||||||
|
elseif (MSVC)
|
||||||
|
target_link_libraries(XS )
|
||||||
|
else ()
|
||||||
|
target_link_libraries(XS -lc++)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Windows specific stuff
|
||||||
|
if (WIN32)
|
||||||
|
target_compile_definitions(XS PRIVATE -D_USE_MATH_DEFINES -DNOGDI -DNOMINMAX -D_WIN32 -DHAS_BOOL)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
## Configuration flags
|
||||||
|
if (SLIC3R_GUI)
|
||||||
|
message("Slic3r will be built with GUI support")
|
||||||
|
# target_compile_definitions(XS PRIVATE -DSLIC3R_GUI -DSLIC3R_PRUS)
|
||||||
|
target_compile_definitions(XS PRIVATE -DSLIC3R_GUI)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (SLIC3R_PROFILE)
|
||||||
|
message("Slic3r will be built with a Shiny invasive profiler")
|
||||||
|
target_compile_definitions(XS PRIVATE -DSLIC3R_PROFILE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (SLIC3R_HAS_BROKEN_CROAK)
|
||||||
|
target_compile_definitions(XS PRIVATE -DSLIC3R_HAS_BROKEN_CROAK)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||||
|
target_compile_definitions(XS PRIVATE -DSLIC3R_DEBUG -DDEBUG -D_DEBUG)
|
||||||
|
else ()
|
||||||
|
target_compile_definitions(XS PRIVATE -DNDEBUG)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Perl specific stuff
|
||||||
|
find_package(PerlLibs REQUIRED)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${PERL_EXECUTABLE} -MExtUtils::Embed -e "
|
||||||
|
use Text::ParseWords;
|
||||||
|
my \$line;
|
||||||
|
{ local *STDOUT; open STDOUT, '>', \\\$line; ccflags; }
|
||||||
|
\$line =~ s/\\\\/\\\\\\\\/g;
|
||||||
|
my @words = shellwords(\$line);
|
||||||
|
print join(';', @words)"
|
||||||
|
OUTPUT_VARIABLE PERL_CCLAGS
|
||||||
|
)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${PERL_EXECUTABLE} -MExtUtils::Embed -e "
|
||||||
|
use Text::ParseWords;
|
||||||
|
my \$line;
|
||||||
|
{ local *STDOUT; open STDOUT, '>', \\\$line; ldopts; }
|
||||||
|
\$line =~ s/\\\\/\\\\\\\\/g;
|
||||||
|
my @words = shellwords(\$line);
|
||||||
|
print join(';', @words)"
|
||||||
|
OUTPUT_VARIABLE PERL_LDFLAGS
|
||||||
|
)
|
||||||
|
target_include_directories(XS PRIVATE ${PERL_INCLUDE_PATH})
|
||||||
|
|
||||||
|
message("PERL_INCLUDE_PATH: ${PERL_INCLUDE_PATH}")
|
||||||
|
message("PERL_LIBRARY: ${PERL_LIBRARY}")
|
||||||
|
message("PERL_EXECUTABLE: ${PERL_EXECUTABLE}")
|
||||||
|
message("PERL_SITESEARCH: ${PERL_SITESEARCH}")
|
||||||
|
message("PERL_SITELIB: ${PERL_SITELIB}")
|
||||||
|
message("PERL_VENDORARCH: ${PERL_VENDORARCH}")
|
||||||
|
message("PERL_VENDORLIB: ${PERL_VENDORLIB}")
|
||||||
|
message("PERL_ARCHLIB: ${PERL_ARCHLIB}")
|
||||||
|
message("PERL_PRIVLIB: ${PERL_PRIVLIB}")
|
||||||
|
message("PERL_EXTRA_C_FLAGS: ${PERL_EXTRA_C_FLAGS}")
|
||||||
|
message("PERL_CCLAGS: ${PERL_CCLAGS}")
|
||||||
|
message("PERL_LDFLAGS: ${PERL_LDFLAGS}")
|
||||||
|
|
||||||
|
target_compile_options(XS PRIVATE ${PERL_CCLAGS})
|
||||||
|
#target_link_libraries(XS ${PERL_LDFLAGS})
|
||||||
|
target_link_libraries(XS C:\\wperl64d\\lib\\CORE\\perl524.lib)
|
||||||
|
|
||||||
|
## REQUIRED packages
|
||||||
|
|
||||||
|
# Find and configure boost
|
||||||
|
if (SLIC3R_STATIC)
|
||||||
|
# Use static boost libraries.
|
||||||
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
|
# Use boost libraries linked statically to the C++ runtime.
|
||||||
|
# set(Boost_USE_STATIC_RUNTIME ON)
|
||||||
|
endif ()
|
||||||
|
find_package(Boost REQUIRED COMPONENTS system filesystem thread log locale)
|
||||||
|
if (Boost_FOUND)
|
||||||
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(XS ${Boost_LIBRARIES})
|
||||||
|
target_compile_definitions(XS PRIVATE -DBOOST_ASIO_DISABLE_KQUEUE -DBOOST_LIBS -DBOOST_ALL_NO_LIB)
|
||||||
|
if (NOT SLIC3R_STATIC)
|
||||||
|
target_compile_definitions(XS PRIVATE -DBOOST_LOG_DYN_LINK)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Find and configure intel-tbb
|
||||||
|
find_package(TBB REQUIRED)
|
||||||
|
if (TBB_FOUND)
|
||||||
|
include_directories(${TBB_INCLUDE_DIRS})
|
||||||
|
add_definitions(${TBB_DEFINITIONS})
|
||||||
|
target_link_libraries(XS ${TBB_LIBRARIES})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Find and configure wxWidgets
|
||||||
|
set(wxWidgets_UseAlienWx 1)
|
||||||
|
if (wxWidgets_UseAlienWx)
|
||||||
|
# ${PROJECT_SOURCE_DIR}/cmake/helpers/alien_wx_to_cmake.pl
|
||||||
|
else ()
|
||||||
|
find_package(wxWidgets REQUIRED)
|
||||||
|
if (wxWidgets_FOUND)
|
||||||
|
include(${wxWidgets_USE_FILE})
|
||||||
|
target_link_libraries(XS ${wxWidgets_LIBRARIES})
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
## OPTIONAL packages
|
||||||
|
|
||||||
|
# Find eigen3 or use bundled version
|
||||||
|
if (NOT SLIC3R_STATIC)
|
||||||
|
find_package(Eigen3)
|
||||||
|
endif ()
|
||||||
|
if (NOT Eigen3_FOUND)
|
||||||
|
set(Eigen3_FOUND 1)
|
||||||
|
set(EIGEN3_INCLUDE_DIR ${LIBDIR}/eigen/)
|
||||||
|
endif ()
|
||||||
|
include_directories(${EIGEN3_INCLUDE_DIR})
|
||||||
|
|
||||||
|
# Find expat or use bundled version
|
||||||
|
if (NOT SLIC3R_STATIC)
|
||||||
|
find_package(EXPAT)
|
||||||
|
endif ()
|
||||||
|
if (NOT EXPAT_FOUND)
|
||||||
|
add_library(expat STATIC
|
||||||
|
${LIBDIR}/expat/xmlparse.c
|
||||||
|
${LIBDIR}/expat/xmlrole.c
|
||||||
|
${LIBDIR}/expat/xmltok.c
|
||||||
|
)
|
||||||
|
set(EXPAT_FOUND 1)
|
||||||
|
set(EXPAT_INCLUDE_DIRS ${LIBDIR}/expat/)
|
||||||
|
set(EXPAT_LIBRARIES expat)
|
||||||
|
endif ()
|
||||||
|
include_directories(${EXPAT_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(XS ${EXPAT_LIBRARIES})
|
||||||
|
|
||||||
|
# Find glew or use bundled version
|
||||||
|
if (NOT SLIC3R_STATIC)
|
||||||
|
find_package(GLEW)
|
||||||
|
endif ()
|
||||||
|
if (NOT GLEW_FOUND)
|
||||||
|
add_library(glew STATIC ${LIBDIR}/glew/src/glew.c)
|
||||||
|
set(GLEW_FOUND 1)
|
||||||
|
set(GLEW_INCLUDE_DIRS ${LIBDIR}/glew/include/)
|
||||||
|
set(GLEW_LIBRARIES glew)
|
||||||
|
target_compile_definitions(glew PRIVATE -DGLEW_STATIC)
|
||||||
|
target_compile_definitions(XS PRIVATE -DGLEW_STATIC)
|
||||||
|
endif ()
|
||||||
|
include_directories(${GLEW_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(XS ${GLEW_LIBRARIES})
|
||||||
|
|
||||||
|
add_library(nowide STATIC
|
||||||
|
${LIBDIR}/boost/nowide/args.hpp
|
||||||
|
${LIBDIR}/boost/nowide/cenv.hpp
|
||||||
|
${LIBDIR}/boost/nowide/config.hpp
|
||||||
|
${LIBDIR}/boost/nowide/convert.hpp
|
||||||
|
${LIBDIR}/boost/nowide/cstdio.hpp
|
||||||
|
${LIBDIR}/boost/nowide/cstdlib.hpp
|
||||||
|
${LIBDIR}/boost/nowide/filebuf.hpp
|
||||||
|
${LIBDIR}/boost/nowide/fstream.hpp
|
||||||
|
${LIBDIR}/boost/nowide/integration/filesystem.hpp
|
||||||
|
${LIBDIR}/boost/nowide/iostream.cpp
|
||||||
|
${LIBDIR}/boost/nowide/iostream.hpp
|
||||||
|
${LIBDIR}/boost/nowide/stackstring.hpp
|
||||||
|
${LIBDIR}/boost/nowide/system.hpp
|
||||||
|
${LIBDIR}/boost/nowide/utf8_codecvt.hpp
|
||||||
|
${LIBDIR}/boost/nowide/windows.hpp
|
||||||
|
)
|
||||||
|
target_link_libraries(XS nowide)
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
install(TARGETS XS DESTINATION lib/slic3r-prusa3d/auto/Slic3r/XS)
|
||||||
|
install(FILES lib/Slic3r/XS.pm DESTINATION lib/slic3r-prusa3d/Slic3r)
|
27
xs/main.xs.in
Normal file
27
xs/main.xs.in
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include <cstring>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <ostream>
|
||||||
|
#include <sstream>
|
||||||
|
#include <libslic3r/GCodeSender.hpp>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
#include "EXTERN.h"
|
||||||
|
#include "perl.h"
|
||||||
|
#include "XSUB.h"
|
||||||
|
#include "ppport.h"
|
||||||
|
#undef do_open
|
||||||
|
#undef do_close
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#undef XS_EXTERNAL
|
||||||
|
#define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
|
||||||
|
#endif /* MSVC */
|
||||||
|
|
||||||
|
MODULE = Slic3r::XS PACKAGE = Slic3r::XS
|
||||||
|
|
||||||
|
@INCLUDE_COMMANDS@
|
@ -30,7 +30,8 @@
|
|||||||
** THE POSSIBILITY OF SUCH DAMAGE.
|
** THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef SLIC3R_GUI
|
#if 1
|
||||||
|
// #ifdef SLIC3R_GUI
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#ifdef SLIC3R_GUI
|
#if 0
|
||||||
|
// #ifdef SLIC3R_GUI
|
||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
#endif /* SLIC3R_GUI */
|
#endif /* SLIC3R_GUI */
|
||||||
|
|
||||||
|
@ -49,8 +49,10 @@ Model Model::read_from_file(const std::string &input_file, bool add_default_inst
|
|||||||
else if (boost::algorithm::iends_with(input_file, ".amf") ||
|
else if (boost::algorithm::iends_with(input_file, ".amf") ||
|
||||||
boost::algorithm::iends_with(input_file, ".amf.xml"))
|
boost::algorithm::iends_with(input_file, ".amf.xml"))
|
||||||
result = load_amf(input_file.c_str(), &model);
|
result = load_amf(input_file.c_str(), &model);
|
||||||
|
#ifdef SLIC3R_PRUS
|
||||||
else if (boost::algorithm::iends_with(input_file, ".prusa"))
|
else if (boost::algorithm::iends_with(input_file, ".prusa"))
|
||||||
result = load_prus(input_file.c_str(), &model);
|
result = load_prus(input_file.c_str(), &model);
|
||||||
|
#endif /* SLIC3R_PRUS */
|
||||||
else
|
else
|
||||||
throw std::runtime_error("Unknown file format. Input file must have .stl, .obj, .amf(.xml) or .prusa extension.");
|
throw std::runtime_error("Unknown file format. Input file must have .stl, .obj, .amf(.xml) or .prusa extension.");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user