Merge branch 'master_slic3rPE_PR' into masterPE
1
.gitignore
vendored
@ -12,3 +12,4 @@ xs/assertlib*
|
||||
.init_bundle.ini
|
||||
local-lib
|
||||
build*
|
||||
deps/deps-build
|
||||
|
25
Build.PL
@ -1,5 +1,10 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
print "This script is currently used for installing Perl dependenices for running\n";
|
||||
print "the libslic3r unit / integration tests through Perl prove.\n";
|
||||
print "If you don't plan to run the unit / integration tests, you don't need to\n";
|
||||
print "install these dependencies to build and run Slic3r.\n";
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
@ -30,20 +35,7 @@ my %recommends = qw(
|
||||
);
|
||||
|
||||
my $sudo = grep { $_ eq '--sudo' } @ARGV;
|
||||
my $gui = grep { $_ eq '--gui' } @ARGV;
|
||||
my $nolocal = grep { $_ eq '--nolocal' } @ARGV;
|
||||
if ($gui) {
|
||||
%prereqs = qw(
|
||||
Class::Accessor 0
|
||||
Wx 0.9918
|
||||
);
|
||||
%recommends = qw(
|
||||
Wx::GLCanvas 0
|
||||
);
|
||||
if ($^O eq 'MSWin32') {
|
||||
$recommends{"Win32::TieRegistry"} = 0;
|
||||
}
|
||||
}
|
||||
|
||||
my @missing_prereqs = ();
|
||||
if ($ENV{SLIC3R_NO_AUTO}) {
|
||||
@ -129,13 +121,6 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
print "\n";
|
||||
if ($gui) {
|
||||
print "Perl dependencies for the Slic3r GUI were installed.\n";
|
||||
} else {
|
||||
print "Perl dependencies for Slic3r were installed.\n";
|
||||
print "If you also want to use the GUI you can now run `perl Build.PL --gui` to install the required modules.\n";
|
||||
}
|
||||
print "\n";
|
||||
print "In the next step, you need to build the Slic3r C++ library.\n";
|
||||
print "1) Create a build directory and change to it\n";
|
||||
|
194
CMakeLists.txt
@ -1,6 +1,10 @@
|
||||
project(Slic3r)
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
include("version.inc")
|
||||
set(SLIC3R_RESOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
|
||||
file(TO_NATIVE_PATH "${SLIC3R_RESOURCES_DIR}" SLIC3R_RESOURCES_DIR_WIN)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "No build type selected, default to Release")
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
|
||||
@ -18,42 +22,27 @@ endif()
|
||||
|
||||
option(SLIC3R_STATIC "Compile Slic3r with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
|
||||
option(SLIC3R_GUI "Compile Slic3r with GUI components (OpenGL, wxWidgets)" 1)
|
||||
option(SLIC3R_PRUSACONTROL "Compile Slic3r with the PrusaControl prject file format (requires wxWidgets base library)" 1)
|
||||
option(SLIC3R_PROFILE "Compile Slic3r with an invasive Shiny profiler" 0)
|
||||
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
|
||||
option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
|
||||
option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0)
|
||||
option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0)
|
||||
option(SLIC3R_SYNTAXONLY "Only perform source code correctness checking, no binary output (UNIX only)" 0)
|
||||
|
||||
if (MSVC AND SLIC3R_MSVC_COMPILE_PARALLEL)
|
||||
add_compile_options(/MP)
|
||||
# Proposal for C++ unit tests and sandboxes
|
||||
option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF)
|
||||
option(SLIC3R_BUILD_TESTS "Build unit tests" OFF)
|
||||
|
||||
if (MSVC)
|
||||
if (SLIC3R_MSVC_COMPILE_PARALLEL)
|
||||
add_compile_options(/MP)
|
||||
endif ()
|
||||
# /bigobj (Increase Number of Sections in .Obj file)
|
||||
# error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm90' or greater
|
||||
add_compile_options(-bigobj -Zm316)
|
||||
endif ()
|
||||
|
||||
# Find the Perl interpreter, add local-lib to PATH and PERL5LIB environment variables,
|
||||
# so the locally installed modules (mainly the Alien::wxPerl) will be reached.
|
||||
if (WIN32)
|
||||
set(ENV_PATH_SEPARATOR ";")
|
||||
else()
|
||||
set(ENV_PATH_SEPARATOR ":")
|
||||
endif()
|
||||
set(ENV{PATH} "${PROJECT_SOURCE_DIR}/local-lib/bin${ENV_PATH_SEPARATOR}$ENV{PATH}")
|
||||
set(PERL_INCLUDE "${PROJECT_SOURCE_DIR}/local-lib/lib/perl5${ENV_PATH_SEPARATOR}$ENV{PERL5LIB}")
|
||||
message("PATH: $ENV{PATH}")
|
||||
message("PERL_INCLUDE: ${PERL_INCLUDE}")
|
||||
find_package(Perl REQUIRED)
|
||||
if (WIN32)
|
||||
# On Windows passing the PERL5LIB variable causes various problems (such as with MAX_PATH and others),
|
||||
# basically I've found no good way to do it on Windows.
|
||||
set(PERL5LIB_ENV_CMD "")
|
||||
else()
|
||||
set(PERL5LIB_ENV_CMD ${CMAKE_COMMAND} -E env PERL5LIB=${PERL_INCLUDE})
|
||||
endif()
|
||||
|
||||
# CMAKE_PREFIX_PATH is used to point CMake to the remaining dependencies (Boost, TBB, ...)
|
||||
# We pick it from environment if it is not defined in another way
|
||||
if(NOT DEFINED CMAKE_PREFIX_PATH)
|
||||
if(DEFINED ENV{CMAKE_PREFIX_PATH})
|
||||
set(CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
|
||||
|
||||
# Add our own cmake module path.
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
|
||||
@ -63,11 +52,13 @@ enable_testing ()
|
||||
# Enable C++11 language standard.
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Enable C11 language standard.
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
# To be able to link libslic3r with the Perl XS module.
|
||||
# Once we get rid of Perl and libslic3r is linked statically, we can get rid of -fPIC
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# WIN10SDK_PATH is used to point CMake to the WIN10 SDK installation directory.
|
||||
# We pick it from environment if it is not defined in another way
|
||||
if(WIN32)
|
||||
@ -82,17 +73,59 @@ if(WIN32)
|
||||
message("STL fixing by the Netfabb service will not be compiled")
|
||||
unset(WIN10SDK_PATH)
|
||||
endif()
|
||||
if(WIN10SDK_PATH)
|
||||
message("Building with Win10 Netfabb STL fixing service support")
|
||||
add_definitions(-DHAS_WIN10SDK)
|
||||
include_directories("${WIN10SDK_PATH}/Include")
|
||||
else()
|
||||
message("Building without Win10 Netfabb STL fixing service support")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "OS X Deployment target (SDK version)" FORCE)
|
||||
endif ()
|
||||
message(STATUS "Mac OS deployment target (SDK version): ${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# Workaround for an old CMake, which does not understand CMAKE_CXX_STANDARD.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-reorder" )
|
||||
add_compile_options(-std=c++11 -Wall -Wno-reorder)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
endif()
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
|
||||
# Adding -fext-numeric-literals to enable GCC extensions on definitions of quad float literals, which are required by Boost.
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals" )
|
||||
add_compile_options(-fext-numeric-literals)
|
||||
|
||||
if (SLIC3R_SYNTAXONLY)
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "true")
|
||||
set(CMAKE_C_ARCHIVE_CREATE "true")
|
||||
set(CMAKE_CXX_ARCHIVE_APPEND "true")
|
||||
set(CMAKE_C_ARCHIVE_APPEND "true")
|
||||
set(CMAKE_RANLIB "true")
|
||||
set(CMAKE_C_LINK_EXECUTABLE "true")
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "true")
|
||||
|
||||
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> -fsyntax-only <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> && touch <OBJECT>")
|
||||
set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> -fsyntax-only <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE> && touch <OBJECT>")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error.
|
||||
add_compile_options(-Werror=return-type)
|
||||
|
||||
if (SLIC3R_ASAN)
|
||||
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lasan")
|
||||
endif ()
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# Where all the bundled libraries reside?
|
||||
@ -100,12 +133,12 @@ set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
|
||||
# For the bundled boost libraries (boost::nowide)
|
||||
include_directories(${LIBDIR})
|
||||
# For libslic3r.h
|
||||
include_directories(${LIBDIR}/libslic3r ${LIBDIR}/clipper ${LIBDIR}/polypartition)
|
||||
include_directories(${LIBDIR}/clipper ${LIBDIR}/polypartition)
|
||||
#set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
if(WIN32)
|
||||
# BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
|
||||
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601)
|
||||
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE -DWXINTL_NO_GETTEXT_MACRO)
|
||||
@ -115,25 +148,19 @@ if (SLIC3R_PROFILE)
|
||||
add_definitions(-DSLIC3R_PROFILE)
|
||||
endif ()
|
||||
|
||||
# Perl specific stuff
|
||||
find_package(PerlLibs REQUIRED)
|
||||
set(PerlEmbed_DEBUG 1)
|
||||
find_package(PerlEmbed REQUIRED)
|
||||
# If the Perl is compiled with optimization off, disable optimization over the whole project.
|
||||
if (WIN32 AND ";${PerlEmbed_CCFLAGS};" MATCHES ";[-/]Od;")
|
||||
# Disable optimization even with debugging on.
|
||||
if (0)
|
||||
message(STATUS "Perl compiled without optimization. Disabling optimization for the Slic3r build.")
|
||||
message("Old CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
message("Old CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
message("Old CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Od /Zi /EHsc /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_C_FLAGS_RELEASE "/MD /Od /Zi /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /EHsc /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_CXX_FLAGS "/MD /Od /Zi /EHsc /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_C_FLAGS "/MD /Od /Zi /DNDEBUG /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_C_FLAGS_RELEASE "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_CXX_FLAGS "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
|
||||
set(CMAKE_C_FLAGS "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
|
||||
endif()
|
||||
# The following line will add -fPIC on Linux to make the XS.so rellocable.
|
||||
add_definitions(${PerlEmbed_CCCDLFLAGS})
|
||||
|
||||
# Find and configure boost
|
||||
if(SLIC3R_STATIC)
|
||||
@ -143,6 +170,7 @@ if(SLIC3R_STATIC)
|
||||
# set(Boost_USE_STATIC_RUNTIME ON)
|
||||
endif()
|
||||
#set(Boost_DEBUG ON)
|
||||
# set(Boost_COMPILER "-vc120")
|
||||
find_package(Boost REQUIRED COMPONENTS system filesystem thread log locale regex)
|
||||
if(Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
@ -170,33 +198,7 @@ endif()
|
||||
# The Intel TBB library will use the std::exception_ptr feature of C++11.
|
||||
add_definitions(-DTBB_USE_CAPTURED_EXCEPTION=0)
|
||||
|
||||
# Find and configure wxWidgets
|
||||
if (SLIC3R_PRUSACONTROL)
|
||||
set(wxWidgets_UseAlienWx 1)
|
||||
if (wxWidgets_UseAlienWx)
|
||||
set(AlienWx_DEBUG 1)
|
||||
find_package(AlienWx REQUIRED COMPONENTS base core adv html gl)
|
||||
include_directories(${AlienWx_INCLUDE_DIRS})
|
||||
#add_compile_options(${AlienWx_CXX_FLAGS})
|
||||
add_definitions(${AlienWx_DEFINITIONS})
|
||||
set(wxWidgets_LIBRARIES ${AlienWx_LIBRARIES})
|
||||
# On Linux / gtk, we need to have a direct access to gtk+ for some workarounds.
|
||||
if (AlienWx_GUI_TOOLKIT STREQUAL "gtk2")
|
||||
pkg_check_modules(GTK2 gtk+-2.0)
|
||||
include_directories(${GTK2_INCLUDE_DIRS})
|
||||
endif()
|
||||
if (AlienWx_GUI_TOOLKIT STREQUAL "gtk3")
|
||||
pkg_check_modules(GTK3 gtk+-3.0)
|
||||
include_directories(${GTK3_INCLUDE_DIRS})
|
||||
endif()
|
||||
else ()
|
||||
find_package(wxWidgets REQUIRED COMPONENTS base core adv html gl)
|
||||
include(${wxWidgets_USE_FILE})
|
||||
endif ()
|
||||
#FIXME rewrite the PRUS format to miniz!
|
||||
# add_definitions(-DSLIC3R_GUI -DSLIC3R_PRUS)
|
||||
endif()
|
||||
|
||||
#set(CURL_DEBUG 1)
|
||||
find_package(CURL REQUIRED)
|
||||
include_directories(${CURL_INCLUDE_DIRS})
|
||||
|
||||
@ -259,32 +261,34 @@ endif ()
|
||||
include_directories(${GLEW_INCLUDE_DIRS})
|
||||
|
||||
# l10n
|
||||
add_subdirectory(resources/localization)
|
||||
set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/localization")
|
||||
add_custom_target(pot
|
||||
# FIXME: file list stale
|
||||
COMMAND xgettext --keyword=L --from-code=UTF-8 --debug
|
||||
-f "${L10N_DIR}/list.txt"
|
||||
-o "${L10N_DIR}/Slic3rPE.pot"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Generate pot file from strings in the source tree"
|
||||
)
|
||||
|
||||
# libslic3r, Slic3r GUI and the slic3r executable.
|
||||
add_subdirectory(src)
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT slic3r_app_console)
|
||||
|
||||
# Perl bindings, currently only used for the unit / integration tests of libslic3r.
|
||||
add_subdirectory(xs)
|
||||
|
||||
get_filename_component(PERL_BIN_PATH "${PERL_EXECUTABLE}" DIRECTORY)
|
||||
if (MSVC)
|
||||
# By default the startup project in MSVC is the 'ALL_BUILD' cmake-created project,
|
||||
# but we want 'slic3r' as the startup one because debugging run command is associated with it.
|
||||
# (Unfortunatelly it cannot be associated with ALL_BUILD using CMake.)
|
||||
# Note: For some reason this needs to be set in the top-level CMakeLists.txt
|
||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT XS)
|
||||
set(PERL_PROVE "${PERL_BIN_PATH}/prove.bat")
|
||||
else ()
|
||||
set(PERL_PROVE "${PERL_BIN_PATH}/prove")
|
||||
# Also runs the unit / integration tests.
|
||||
#FIXME Port the tests into C++ to finally get rid of the Perl!
|
||||
if (SLIC3R_PERL_XS)
|
||||
add_subdirectory(xs)
|
||||
endif ()
|
||||
|
||||
add_test (NAME xs COMMAND "${PERL_EXECUTABLE}" ${PERL_PROVE} -I ${PROJECT_SOURCE_DIR}/local-lib/lib/perl5 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/xs)
|
||||
add_test (NAME integration COMMAND "${PERL_EXECUTABLE}" ${PERL_PROVE} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
if(SLIC3R_BUILD_SANDBOXES)
|
||||
add_subdirectory(sandboxes)
|
||||
endif()
|
||||
|
||||
#install(PROGRAMS slic3r.pl DESTINATION bin RENAME slic3r-prusa3d)
|
||||
if(SLIC3R_BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
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)
|
||||
|
@ -5,34 +5,62 @@
|
||||
# FindCURL
|
||||
# --------
|
||||
#
|
||||
# Find curl
|
||||
#
|
||||
# Find the native CURL headers and libraries.
|
||||
#
|
||||
# ::
|
||||
# IMPORTED Targets
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
|
||||
# CURL_LIBRARIES - List of libraries when using curl.
|
||||
# CURL_FOUND - True if curl found.
|
||||
# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
|
||||
# This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if
|
||||
# curl has been found.
|
||||
#
|
||||
# Result Variables
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This module defines the following variables:
|
||||
#
|
||||
# ``CURL_FOUND``
|
||||
# True if curl found.
|
||||
#
|
||||
# ``CURL_INCLUDE_DIRS``
|
||||
# where to find curl/curl.h, etc.
|
||||
#
|
||||
# ``CURL_LIBRARIES``
|
||||
# List of libraries when using curl.
|
||||
#
|
||||
# ``CURL_VERSION_STRING``
|
||||
# The version of curl found.
|
||||
|
||||
# Look for the header file.
|
||||
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
|
||||
mark_as_advanced(CURL_INCLUDE_DIR)
|
||||
|
||||
# Look for the library (sorted from most current/relevant entry to least).
|
||||
find_library(CURL_LIBRARY NAMES
|
||||
curl
|
||||
# Windows MSVC Makefile:
|
||||
libcurl_a
|
||||
# Windows MSVC prebuilts:
|
||||
curllib
|
||||
libcurl_imp
|
||||
curllib_static
|
||||
# Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
|
||||
libcurl
|
||||
)
|
||||
mark_as_advanced(CURL_LIBRARY)
|
||||
if(NOT CURL_LIBRARY)
|
||||
# Look for the library (sorted from most current/relevant entry to least).
|
||||
find_library(CURL_LIBRARY_RELEASE NAMES
|
||||
curl
|
||||
# Windows MSVC prebuilts:
|
||||
curllib
|
||||
libcurl_imp
|
||||
curllib_static
|
||||
# Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
|
||||
libcurl
|
||||
# Static library on Windows
|
||||
libcurl_a
|
||||
)
|
||||
mark_as_advanced(CURL_LIBRARY_RELEASE)
|
||||
|
||||
find_library(CURL_LIBRARY_DEBUG NAMES
|
||||
# Windows MSVC CMake builds in debug configuration on vcpkg:
|
||||
libcurl-d_imp
|
||||
libcurl-d
|
||||
# Static library on Windows, compiled in debug mode
|
||||
libcurl_a_debug
|
||||
)
|
||||
mark_as_advanced(CURL_LIBRARY_DEBUG)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations_SLIC3R.cmake)
|
||||
select_library_configurations_SLIC3R(CURL)
|
||||
endif()
|
||||
|
||||
if(CURL_INCLUDE_DIR)
|
||||
foreach(_curl_version_header curlver.h curl.h)
|
||||
@ -46,7 +74,8 @@ if(CURL_INCLUDE_DIR)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(CURL
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs_SLIC3R.cmake)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS_SLIC3R(CURL
|
||||
REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR
|
||||
VERSION_VAR CURL_VERSION_STRING)
|
||||
|
||||
@ -54,6 +83,29 @@ if(CURL_FOUND)
|
||||
set(CURL_LIBRARIES ${CURL_LIBRARY})
|
||||
set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
|
||||
|
||||
message(STATUS " Curl libraries: = ${CURL_LIBRARIES}")
|
||||
message(STATUS " Curl include dirs: = ${CURL_INCLUDE_DIRS}")
|
||||
if(NOT TARGET CURL::libcurl)
|
||||
add_library(CURL::libcurl UNKNOWN IMPORTED)
|
||||
set_target_properties(CURL::libcurl PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}")
|
||||
|
||||
if(EXISTS "${CURL_LIBRARY}")
|
||||
set_target_properties(CURL::libcurl PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${CURL_LIBRARY}")
|
||||
endif()
|
||||
if(CURL_LIBRARY_RELEASE)
|
||||
set_property(TARGET CURL::libcurl APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS RELEASE)
|
||||
set_target_properties(CURL::libcurl PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}")
|
||||
endif()
|
||||
if(CURL_LIBRARY_DEBUG)
|
||||
set_property(TARGET CURL::libcurl APPEND PROPERTY
|
||||
IMPORTED_CONFIGURATIONS DEBUG)
|
||||
set_target_properties(CURL::libcurl PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,28 +0,0 @@
|
||||
###############################################################################
|
||||
# Find Flann
|
||||
#
|
||||
# This sets the following variables:
|
||||
# FLANN_FOUND - True if FLANN was found.
|
||||
# FLANN_INCLUDE_DIRS - Directories containing the FLANN include files.
|
||||
# FLANN_LIBRARIES - Libraries needed to use FLANN.
|
||||
# FLANN_DEFINITIONS - Compiler flags for FLANN.
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PC_FLANN flann)
|
||||
set(FLANN_DEFINITIONS ${PC_FLANN_CFLAGS_OTHER})
|
||||
|
||||
find_path(FLANN_INCLUDE_DIR flann/flann.hpp
|
||||
HINTS ${PC_FLANN_INCLUDEDIR} ${PC_FLANN_INCLUDE_DIRS})
|
||||
|
||||
find_library(FLANN_LIBRARY flann_cpp
|
||||
HINTS ${PC_FLANN_LIBDIR} ${PC_FLANN_LIBRARY_DIRS})
|
||||
|
||||
set(FLANN_INCLUDE_DIRS ${FLANN_INCLUDE_DIR})
|
||||
set(FLANN_LIBRARIES ${FLANN_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Flann DEFAULT_MSG
|
||||
FLANN_LIBRARY FLANN_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(FLANN_LIBRARY FLANN_INCLUDE_DIR)
|
||||
|
392
cmake/modules/FindPackageHandleStandardArgs_SLIC3R.cmake
Normal file
@ -0,0 +1,392 @@
|
||||
# Modified from the CMake github master,
|
||||
# required by the bundled FindCURL.cmake
|
||||
|
||||
|
||||
|
||||
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindPackageHandleStandardArgs
|
||||
-----------------------------
|
||||
|
||||
This module provides a function intended to be used in :ref:`Find Modules`
|
||||
implementing :command:`find_package(<PackageName>)` calls. It handles the
|
||||
``REQUIRED``, ``QUIET`` and version-related arguments of ``find_package``.
|
||||
It also sets the ``<PackageName>_FOUND`` variable. The package is
|
||||
considered found if all variables listed contain valid results, e.g.
|
||||
valid filepaths.
|
||||
|
||||
.. command:: find_package_handle_standard_args
|
||||
|
||||
There are two signatures::
|
||||
|
||||
find_package_handle_standard_args(<PackageName>
|
||||
(DEFAULT_MSG|<custom-failure-message>)
|
||||
<required-var>...
|
||||
)
|
||||
|
||||
find_package_handle_standard_args(<PackageName>
|
||||
[FOUND_VAR <result-var>]
|
||||
[REQUIRED_VARS <required-var>...]
|
||||
[VERSION_VAR <version-var>]
|
||||
[HANDLE_COMPONENTS]
|
||||
[CONFIG_MODE]
|
||||
[FAIL_MESSAGE <custom-failure-message>]
|
||||
)
|
||||
|
||||
The ``<PackageName>_FOUND`` variable will be set to ``TRUE`` if all
|
||||
the variables ``<required-var>...`` are valid and any optional
|
||||
constraints are satisfied, and ``FALSE`` otherwise. A success or
|
||||
failure message may be displayed based on the results and on
|
||||
whether the ``REQUIRED`` and/or ``QUIET`` option was given to
|
||||
the :command:`find_package` call.
|
||||
|
||||
The options are:
|
||||
|
||||
``(DEFAULT_MSG|<custom-failure-message>)``
|
||||
In the simple signature this specifies the failure message.
|
||||
Use ``DEFAULT_MSG`` to ask for a default message to be computed
|
||||
(recommended). Not valid in the full signature.
|
||||
|
||||
``FOUND_VAR <result-var>``
|
||||
Obsolete. Specifies either ``<PackageName>_FOUND`` or
|
||||
``<PACKAGENAME>_FOUND`` as the result variable. This exists only
|
||||
for compatibility with older versions of CMake and is now ignored.
|
||||
Result variables of both names are always set for compatibility.
|
||||
|
||||
``REQUIRED_VARS <required-var>...``
|
||||
Specify the variables which are required for this package.
|
||||
These may be named in the generated failure message asking the
|
||||
user to set the missing variable values. Therefore these should
|
||||
typically be cache entries such as ``FOO_LIBRARY`` and not output
|
||||
variables like ``FOO_LIBRARIES``.
|
||||
|
||||
``VERSION_VAR <version-var>``
|
||||
Specify the name of a variable that holds the version of the package
|
||||
that has been found. This version will be checked against the
|
||||
(potentially) specified required version given to the
|
||||
:command:`find_package` call, including its ``EXACT`` option.
|
||||
The default messages include information about the required
|
||||
version and the version which has been actually found, both
|
||||
if the version is ok or not.
|
||||
|
||||
``HANDLE_COMPONENTS``
|
||||
Enable handling of package components. In this case, the command
|
||||
will report which components have been found and which are missing,
|
||||
and the ``<PackageName>_FOUND`` variable will be set to ``FALSE``
|
||||
if any of the required components (i.e. not the ones listed after
|
||||
the ``OPTIONAL_COMPONENTS`` option of :command:`find_package`) are
|
||||
missing.
|
||||
|
||||
``CONFIG_MODE``
|
||||
Specify that the calling find module is a wrapper around a
|
||||
call to ``find_package(<PackageName> NO_MODULE)``. This implies
|
||||
a ``VERSION_VAR`` value of ``<PackageName>_VERSION``. The command
|
||||
will automatically check whether the package configuration file
|
||||
was found.
|
||||
|
||||
``FAIL_MESSAGE <custom-failure-message>``
|
||||
Specify a custom failure message instead of using the default
|
||||
generated message. Not recommended.
|
||||
|
||||
Example for the simple signature:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package_handle_standard_args(LibXml2 DEFAULT_MSG
|
||||
LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
|
||||
|
||||
The ``LibXml2`` package is considered to be found if both
|
||||
``LIBXML2_LIBRARY`` and ``LIBXML2_INCLUDE_DIR`` are valid.
|
||||
Then also ``LibXml2_FOUND`` is set to ``TRUE``. If it is not found
|
||||
and ``REQUIRED`` was used, it fails with a
|
||||
:command:`message(FATAL_ERROR)`, independent whether ``QUIET`` was
|
||||
used or not. If it is found, success will be reported, including
|
||||
the content of the first ``<required-var>``. On repeated CMake runs,
|
||||
the same message will not be printed again.
|
||||
|
||||
Example for the full signature:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package_handle_standard_args(LibArchive
|
||||
REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
|
||||
VERSION_VAR LibArchive_VERSION)
|
||||
|
||||
In this case, the ``LibArchive`` package is considered to be found if
|
||||
both ``LibArchive_LIBRARY`` and ``LibArchive_INCLUDE_DIR`` are valid.
|
||||
Also the version of ``LibArchive`` will be checked by using the version
|
||||
contained in ``LibArchive_VERSION``. Since no ``FAIL_MESSAGE`` is given,
|
||||
the default messages will be printed.
|
||||
|
||||
Another example for the full signature:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
|
||||
find_package_handle_standard_args(Automoc4 CONFIG_MODE)
|
||||
|
||||
In this case, a ``FindAutmoc4.cmake`` module wraps a call to
|
||||
``find_package(Automoc4 NO_MODULE)`` and adds an additional search
|
||||
directory for ``automoc4``. Then the call to
|
||||
``find_package_handle_standard_args`` produces a proper success/failure
|
||||
message.
|
||||
#]=======================================================================]
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage_SLIC3R.cmake)
|
||||
|
||||
# internal helper macro
|
||||
macro(_FPHSA_FAILURE_MESSAGE _msg)
|
||||
if (${_NAME}_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "${_msg}")
|
||||
else ()
|
||||
if (NOT ${_NAME}_FIND_QUIETLY)
|
||||
message(STATUS "${_msg}")
|
||||
endif ()
|
||||
endif ()
|
||||
endmacro()
|
||||
|
||||
|
||||
# internal helper macro to generate the failure message when used in CONFIG_MODE:
|
||||
macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
|
||||
# <PackageName>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
|
||||
if(${_NAME}_CONFIG)
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing:${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
|
||||
else()
|
||||
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
|
||||
# List them all in the error message:
|
||||
if(${_NAME}_CONSIDERED_CONFIGS)
|
||||
set(configsText "")
|
||||
list(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
|
||||
math(EXPR configsCount "${configsCount} - 1")
|
||||
foreach(currentConfigIndex RANGE ${configsCount})
|
||||
list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
|
||||
list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
|
||||
string(APPEND configsText " ${filename} (version ${version})\n")
|
||||
endforeach()
|
||||
if (${_NAME}_NOT_FOUND_MESSAGE)
|
||||
string(APPEND configsText " Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n")
|
||||
endif()
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
|
||||
|
||||
else()
|
||||
# Simple case: No Config-file was found at all:
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
function(FIND_PACKAGE_HANDLE_STANDARD_ARGS_SLIC3R _NAME _FIRST_ARG)
|
||||
|
||||
# Set up the arguments for `cmake_parse_arguments`.
|
||||
set(options CONFIG_MODE HANDLE_COMPONENTS)
|
||||
set(oneValueArgs FAIL_MESSAGE VERSION_VAR FOUND_VAR)
|
||||
set(multiValueArgs REQUIRED_VARS)
|
||||
|
||||
# Check whether we are in 'simple' or 'extended' mode:
|
||||
set(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
|
||||
list(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
|
||||
|
||||
if(${INDEX} EQUAL -1)
|
||||
set(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
|
||||
set(FPHSA_REQUIRED_VARS ${ARGN})
|
||||
set(FPHSA_VERSION_VAR)
|
||||
else()
|
||||
cmake_parse_arguments(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
|
||||
|
||||
if(FPHSA_UNPARSED_ARGUMENTS)
|
||||
message(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
|
||||
endif()
|
||||
|
||||
if(NOT FPHSA_FAIL_MESSAGE)
|
||||
set(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
|
||||
endif()
|
||||
|
||||
# In config-mode, we rely on the variable <PackageName>_CONFIG, which is set by find_package()
|
||||
# when it successfully found the config-file, including version checking:
|
||||
if(FPHSA_CONFIG_MODE)
|
||||
list(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
|
||||
list(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
|
||||
set(FPHSA_VERSION_VAR ${_NAME}_VERSION)
|
||||
endif()
|
||||
|
||||
if(NOT FPHSA_REQUIRED_VARS)
|
||||
message(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# now that we collected all arguments, process them
|
||||
|
||||
if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
|
||||
set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
|
||||
endif()
|
||||
|
||||
list(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
|
||||
|
||||
string(TOUPPER ${_NAME} _NAME_UPPER)
|
||||
string(TOLOWER ${_NAME} _NAME_LOWER)
|
||||
|
||||
if(FPHSA_FOUND_VAR)
|
||||
if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$" OR FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
|
||||
set(_FOUND_VAR ${FPHSA_FOUND_VAR})
|
||||
else()
|
||||
message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
|
||||
endif()
|
||||
else()
|
||||
set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
|
||||
endif()
|
||||
|
||||
# collect all variables which were not found, so they can be printed, so the
|
||||
# user knows better what went wrong (#6375)
|
||||
set(MISSING_VARS "")
|
||||
set(DETAILS "")
|
||||
# check if all passed variables are valid
|
||||
set(FPHSA_FOUND_${_NAME} TRUE)
|
||||
foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
|
||||
if(NOT ${_CURRENT_VAR})
|
||||
set(FPHSA_FOUND_${_NAME} FALSE)
|
||||
string(APPEND MISSING_VARS " ${_CURRENT_VAR}")
|
||||
else()
|
||||
string(APPEND DETAILS "[${${_CURRENT_VAR}}]")
|
||||
endif()
|
||||
endforeach()
|
||||
if(FPHSA_FOUND_${_NAME})
|
||||
set(${_NAME}_FOUND TRUE)
|
||||
set(${_NAME_UPPER}_FOUND TRUE)
|
||||
else()
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
set(${_NAME_UPPER}_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
# component handling
|
||||
unset(FOUND_COMPONENTS_MSG)
|
||||
unset(MISSING_COMPONENTS_MSG)
|
||||
|
||||
if(FPHSA_HANDLE_COMPONENTS)
|
||||
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
||||
if(${_NAME}_${comp}_FOUND)
|
||||
|
||||
if(NOT DEFINED FOUND_COMPONENTS_MSG)
|
||||
set(FOUND_COMPONENTS_MSG "found components: ")
|
||||
endif()
|
||||
string(APPEND FOUND_COMPONENTS_MSG " ${comp}")
|
||||
|
||||
else()
|
||||
|
||||
if(NOT DEFINED MISSING_COMPONENTS_MSG)
|
||||
set(MISSING_COMPONENTS_MSG "missing components: ")
|
||||
endif()
|
||||
string(APPEND MISSING_COMPONENTS_MSG " ${comp}")
|
||||
|
||||
if(${_NAME}_FIND_REQUIRED_${comp})
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
string(APPEND MISSING_VARS " ${comp}")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endforeach()
|
||||
set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
|
||||
string(APPEND DETAILS "[c${COMPONENT_MSG}]")
|
||||
endif()
|
||||
|
||||
# version handling:
|
||||
set(VERSION_MSG "")
|
||||
set(VERSION_OK TRUE)
|
||||
|
||||
# check with DEFINED here as the requested or found version may be "0"
|
||||
if (DEFINED ${_NAME}_FIND_VERSION)
|
||||
if(DEFINED ${FPHSA_VERSION_VAR})
|
||||
set(_FOUND_VERSION ${${FPHSA_VERSION_VAR}})
|
||||
|
||||
if(${_NAME}_FIND_VERSION_EXACT) # exact version required
|
||||
# count the dots in the version string
|
||||
string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${_FOUND_VERSION}")
|
||||
# add one dot because there is one dot more than there are components
|
||||
string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS)
|
||||
if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT)
|
||||
# Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT
|
||||
# is at most 4 here. Therefore a simple lookup table is used.
|
||||
if (${_NAME}_FIND_VERSION_COUNT EQUAL 1)
|
||||
set(_VERSION_REGEX "[^.]*")
|
||||
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2)
|
||||
set(_VERSION_REGEX "[^.]*\\.[^.]*")
|
||||
elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3)
|
||||
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*")
|
||||
else ()
|
||||
set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
|
||||
endif ()
|
||||
string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${_FOUND_VERSION}")
|
||||
unset(_VERSION_REGEX)
|
||||
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD)
|
||||
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
|
||||
set(VERSION_OK FALSE)
|
||||
else ()
|
||||
set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")")
|
||||
endif ()
|
||||
unset(_VERSION_HEAD)
|
||||
else ()
|
||||
if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _FOUND_VERSION)
|
||||
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
|
||||
set(VERSION_OK FALSE)
|
||||
else ()
|
||||
set(VERSION_MSG "(found suitable exact version \"${_FOUND_VERSION}\")")
|
||||
endif ()
|
||||
endif ()
|
||||
unset(_VERSION_DOTS)
|
||||
|
||||
else() # minimum version specified:
|
||||
if (${_NAME}_FIND_VERSION VERSION_GREATER _FOUND_VERSION)
|
||||
set(VERSION_MSG "Found unsuitable version \"${_FOUND_VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
|
||||
set(VERSION_OK FALSE)
|
||||
else ()
|
||||
set(VERSION_MSG "(found suitable version \"${_FOUND_VERSION}\", minimum required is \"${${_NAME}_FIND_VERSION}\")")
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
# if the package was not found, but a version was given, add that to the output:
|
||||
if(${_NAME}_FIND_VERSION_EXACT)
|
||||
set(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
|
||||
else()
|
||||
set(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
else ()
|
||||
# Check with DEFINED as the found version may be 0.
|
||||
if(DEFINED ${FPHSA_VERSION_VAR})
|
||||
set(VERSION_MSG "(found version \"${${FPHSA_VERSION_VAR}}\")")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if(VERSION_OK)
|
||||
string(APPEND DETAILS "[v${${FPHSA_VERSION_VAR}}(${${_NAME}_FIND_VERSION})]")
|
||||
else()
|
||||
set(${_NAME}_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
|
||||
# print the result:
|
||||
if (${_NAME}_FOUND)
|
||||
FIND_PACKAGE_MESSAGE_SLIC3R(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
|
||||
else ()
|
||||
|
||||
if(FPHSA_CONFIG_MODE)
|
||||
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
|
||||
else()
|
||||
if(NOT VERSION_OK)
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
|
||||
else()
|
||||
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing:${MISSING_VARS}) ${VERSION_MSG}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
|
||||
set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
|
||||
set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
|
||||
endfunction()
|
54
cmake/modules/FindPackageMessage_SLIC3R.cmake
Normal file
@ -0,0 +1,54 @@
|
||||
# Modified from the CMake github master.
|
||||
# required by the bundled FindCURL.cmake
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# FindPackageMessage
|
||||
# ------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
# FIND_PACKAGE_MESSAGE(<name> "message for user" "find result details")
|
||||
#
|
||||
# This macro is intended to be used in FindXXX.cmake modules files. It
|
||||
# will print a message once for each unique find result. This is useful
|
||||
# for telling the user where a package was found. The first argument
|
||||
# specifies the name (XXX) of the package. The second argument
|
||||
# specifies the message to display. The third argument lists details
|
||||
# about the find result so that if they change the message will be
|
||||
# displayed again. The macro also obeys the QUIET argument to the
|
||||
# find_package command.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# if(X11_FOUND)
|
||||
# FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
|
||||
# "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
|
||||
# else()
|
||||
# ...
|
||||
# endif()
|
||||
|
||||
function(FIND_PACKAGE_MESSAGE_SLIC3R pkg msg details)
|
||||
# Avoid printing a message repeatedly for the same find result.
|
||||
if(NOT ${pkg}_FIND_QUIETLY)
|
||||
string(REPLACE "\n" "" details "${details}")
|
||||
set(DETAILS_VAR FIND_PACKAGE_MESSAGE_DETAILS_${pkg})
|
||||
if(NOT "${details}" STREQUAL "${${DETAILS_VAR}}")
|
||||
# The message has not yet been printed.
|
||||
message(STATUS "${msg}")
|
||||
|
||||
# Save the find details in the cache to avoid printing the same
|
||||
# message again.
|
||||
set("${DETAILS_VAR}" "${details}"
|
||||
CACHE INTERNAL "Details about finding ${pkg}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
@ -280,7 +280,7 @@ if(NOT TBB_FOUND)
|
||||
##################################
|
||||
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.0 AND TBB_FOUND)
|
||||
add_library(tbb SHARED IMPORTED)
|
||||
add_library(tbb UNKNOWN IMPORTED)
|
||||
set_target_properties(tbb PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS}
|
||||
IMPORTED_LOCATION ${TBB_LIBRARIES})
|
||||
@ -288,7 +288,7 @@ if(NOT TBB_FOUND)
|
||||
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_RELWITHDEBINFO ${TBB_LIBRARIES_RELEASE}
|
||||
IMPORTED_LOCATION_RELEASE ${TBB_LIBRARIES_RELEASE}
|
||||
IMPORTED_LOCATION_MINSIZEREL ${TBB_LIBRARIES_RELEASE}
|
||||
)
|
||||
@ -310,6 +310,7 @@ if(NOT TBB_FOUND)
|
||||
unset(TBB_DEFAULT_SEARCH_DIR)
|
||||
|
||||
if(TBB_DEBUG)
|
||||
message(STATUS " TBB_FOUND = ${TBB_FOUND}")
|
||||
message(STATUS " TBB_INCLUDE_DIRS = ${TBB_INCLUDE_DIRS}")
|
||||
message(STATUS " TBB_DEFINITIONS = ${TBB_DEFINITIONS}")
|
||||
message(STATUS " TBB_LIBRARIES = ${TBB_LIBRARIES}")
|
||||
|
214
cmake/modules/PrecompiledHeader.cmake
Normal file
@ -0,0 +1,214 @@
|
||||
# Function for setting up precompiled headers. Usage:
|
||||
#
|
||||
# add_library/executable(target
|
||||
# pchheader.c pchheader.cpp pchheader.h)
|
||||
#
|
||||
# add_precompiled_header(target pchheader.h
|
||||
# [FORCEINCLUDE]
|
||||
# [SOURCE_C pchheader.c]
|
||||
# [SOURCE_CXX pchheader.cpp])
|
||||
#
|
||||
# Options:
|
||||
#
|
||||
# FORCEINCLUDE: Add compiler flags to automatically include the
|
||||
# pchheader.h from every source file. Works with both GCC and
|
||||
# MSVC. This is recommended.
|
||||
#
|
||||
# SOURCE_C/CXX: Specifies the .c/.cpp source file that includes
|
||||
# pchheader.h for generating the pre-compiled header
|
||||
# output. Defaults to pchheader.c. Only required for MSVC.
|
||||
#
|
||||
# Caveats:
|
||||
#
|
||||
# * Its not currently possible to use the same precompiled-header in
|
||||
# more than a single target in the same directory (No way to set
|
||||
# the source file properties differently for each target).
|
||||
#
|
||||
# * MSVC: A source file with the same name as the header must exist
|
||||
# and be included in the target (E.g. header.cpp). Name of file
|
||||
# can be changed using the SOURCE_CXX/SOURCE_C options.
|
||||
#
|
||||
# License:
|
||||
#
|
||||
# Copyright (C) 2009-2017 Lars Christensen <larsch@belunktum.dk>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person
|
||||
# obtaining a copy of this software and associated documentation files
|
||||
# (the 'Software') 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.
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
macro(combine_arguments _variable)
|
||||
set(_result "")
|
||||
foreach(_element ${${_variable}})
|
||||
set(_result "${_result} \"${_element}\"")
|
||||
endforeach()
|
||||
string(STRIP "${_result}" _result)
|
||||
set(${_variable} "${_result}")
|
||||
endmacro()
|
||||
|
||||
function(export_all_flags _filename)
|
||||
set(_include_directories "$<TARGET_PROPERTY:${_target},INCLUDE_DIRECTORIES>")
|
||||
set(_compile_definitions "$<TARGET_PROPERTY:${_target},COMPILE_DEFINITIONS>")
|
||||
set(_compile_flags "$<TARGET_PROPERTY:${_target},COMPILE_FLAGS>")
|
||||
set(_compile_options "$<TARGET_PROPERTY:${_target},COMPILE_OPTIONS>")
|
||||
set(_include_directories "$<$<BOOL:${_include_directories}>:-I$<JOIN:${_include_directories},\n-I>\n>")
|
||||
set(_compile_definitions "$<$<BOOL:${_compile_definitions}>:-D$<JOIN:${_compile_definitions},\n-D>\n>")
|
||||
set(_compile_flags "$<$<BOOL:${_compile_flags}>:$<JOIN:${_compile_flags},\n>\n>")
|
||||
set(_compile_options "$<$<BOOL:${_compile_options}>:$<JOIN:${_compile_options},\n>\n>")
|
||||
file(GENERATE OUTPUT "${_filename}" CONTENT "${_compile_definitions}${_include_directories}${_compile_flags}${_compile_options}\n")
|
||||
endfunction()
|
||||
|
||||
function(add_precompiled_header _target _input)
|
||||
cmake_parse_arguments(_PCH "FORCEINCLUDE" "SOURCE_CXX;SOURCE_C" "" ${ARGN})
|
||||
|
||||
get_filename_component(_input_we ${_input} NAME_WE)
|
||||
if(NOT _PCH_SOURCE_CXX)
|
||||
set(_PCH_SOURCE_CXX "${_input_we}.cpp")
|
||||
endif()
|
||||
if(NOT _PCH_SOURCE_C)
|
||||
set(_PCH_SOURCE_C "${_input_we}.c")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(_pch_cxx_pch "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/cxx_${_input_we}.pch")
|
||||
set(_pch_c_pch "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/c_${_input_we}.pch")
|
||||
|
||||
get_target_property(sources ${_target} SOURCES)
|
||||
foreach(_source ${sources})
|
||||
set(_pch_compile_flags "")
|
||||
if(_source MATCHES \\.\(cc|cxx|cpp|c\)$)
|
||||
if(_source MATCHES \\.\(cpp|cxx|cc\)$)
|
||||
set(_pch_header "${_input}")
|
||||
set(_pch "${_pch_cxx_pch}")
|
||||
else()
|
||||
set(_pch_header "${_input}")
|
||||
set(_pch "${_pch_c_pch}")
|
||||
endif()
|
||||
|
||||
if(_source STREQUAL "${_PCH_SOURCE_CXX}")
|
||||
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_cxx_pch}\" \"/Yc${_input}\"")
|
||||
set(_pch_source_cxx_found TRUE)
|
||||
set_source_files_properties("${_source}" PROPERTIES OBJECT_OUTPUTS "${_pch_cxx_pch}")
|
||||
elseif(_source STREQUAL "${_PCH_SOURCE_C}")
|
||||
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_c_pch}\" \"/Yc${_input}\"")
|
||||
set(_pch_source_c_found TRUE)
|
||||
set_source_files_properties("${_source}" PROPERTIES OBJECT_OUTPUTS "${_pch_c_pch}")
|
||||
else()
|
||||
if(_source MATCHES \\.\(cpp|cxx|cc\)$)
|
||||
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_cxx_pch}\" \"/Yu${_input}\"")
|
||||
set(_pch_source_cxx_needed TRUE)
|
||||
set_source_files_properties("${_source}" PROPERTIES OBJECT_DEPENDS "${_pch_cxx_pch}")
|
||||
else()
|
||||
set(_pch_compile_flags "${_pch_compile_flags} \"/Fp${_pch_c_pch}\" \"/Yu${_input}\"")
|
||||
set(_pch_source_c_needed TRUE)
|
||||
set_source_files_properties("${_source}" PROPERTIES OBJECT_DEPENDS "${_pch_c_pch}")
|
||||
endif()
|
||||
if(_PCH_FORCEINCLUDE)
|
||||
set(_pch_compile_flags "${_pch_compile_flags} /FI${_input}")
|
||||
endif(_PCH_FORCEINCLUDE)
|
||||
endif()
|
||||
|
||||
get_source_file_property(_object_depends "${_source}" OBJECT_DEPENDS)
|
||||
if(NOT _object_depends)
|
||||
set(_object_depends)
|
||||
endif()
|
||||
if(_PCH_FORCEINCLUDE)
|
||||
list(APPEND _object_depends "${CMAKE_CURRENT_SOURCE_DIR}/${_pch_header}")
|
||||
endif()
|
||||
|
||||
set_source_files_properties(${_source} PROPERTIES
|
||||
COMPILE_FLAGS "${_pch_compile_flags}"
|
||||
OBJECT_DEPENDS "${_object_depends}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(_pch_source_cxx_needed AND NOT _pch_source_cxx_found)
|
||||
message(FATAL_ERROR "A source file ${_PCH_SOURCE_CXX} for ${_input} is required for MSVC builds. Can be set with the SOURCE_CXX option.")
|
||||
endif()
|
||||
if(_pch_source_c_needed AND NOT _pch_source_c_found)
|
||||
message(FATAL_ERROR "A source file ${_PCH_SOURCE_C} for ${_input} is required for MSVC builds. Can be set with the SOURCE_C option.")
|
||||
endif()
|
||||
endif(MSVC)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
get_filename_component(_name ${_input} NAME)
|
||||
set(_pch_header "${CMAKE_CURRENT_SOURCE_DIR}/${_input}")
|
||||
set(_pch_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch")
|
||||
set(_pchfile "${_pch_binary_dir}/${_input}")
|
||||
set(_outdir "${CMAKE_CURRENT_BINARY_DIR}/${_target}_pch/${_name}.gch")
|
||||
file(MAKE_DIRECTORY "${_outdir}")
|
||||
set(_output_cxx "${_outdir}/.c++")
|
||||
set(_output_c "${_outdir}/.c")
|
||||
|
||||
set(_pch_flags_file "${_pch_binary_dir}/compile_flags.rsp")
|
||||
export_all_flags("${_pch_flags_file}")
|
||||
set(_compiler_FLAGS "@${_pch_flags_file}")
|
||||
add_custom_command(
|
||||
OUTPUT "${_pchfile}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy "${_pch_header}" "${_pchfile}"
|
||||
DEPENDS "${_pch_header}"
|
||||
COMMENT "Updating ${_name}")
|
||||
add_custom_command(
|
||||
OUTPUT "${_output_cxx}"
|
||||
COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" "${_pchfile}"
|
||||
DEPENDS "${_pchfile}" "${_pch_flags_file}"
|
||||
COMMENT "Precompiling ${_name} for ${_target} (C++)")
|
||||
add_custom_command(
|
||||
OUTPUT "${_output_c}"
|
||||
COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" "${_pchfile}"
|
||||
DEPENDS "${_pchfile}" "${_pch_flags_file}"
|
||||
COMMENT "Precompiling ${_name} for ${_target} (C)")
|
||||
|
||||
get_property(_sources TARGET ${_target} PROPERTY SOURCES)
|
||||
foreach(_source ${_sources})
|
||||
set(_pch_compile_flags "")
|
||||
|
||||
if(_source MATCHES \\.\(cc|cxx|cpp|c\)$)
|
||||
get_source_file_property(_pch_compile_flags "${_source}" COMPILE_FLAGS)
|
||||
if(NOT _pch_compile_flags)
|
||||
set(_pch_compile_flags)
|
||||
endif()
|
||||
separate_arguments(_pch_compile_flags)
|
||||
list(APPEND _pch_compile_flags -Winvalid-pch)
|
||||
if(_PCH_FORCEINCLUDE)
|
||||
list(APPEND _pch_compile_flags -include "${_pchfile}")
|
||||
else(_PCH_FORCEINCLUDE)
|
||||
list(APPEND _pch_compile_flags "-I${_pch_binary_dir}")
|
||||
endif(_PCH_FORCEINCLUDE)
|
||||
|
||||
get_source_file_property(_object_depends "${_source}" OBJECT_DEPENDS)
|
||||
if(NOT _object_depends)
|
||||
set(_object_depends)
|
||||
endif()
|
||||
list(APPEND _object_depends "${_pchfile}")
|
||||
if(_source MATCHES \\.\(cc|cxx|cpp\)$)
|
||||
list(APPEND _object_depends "${_output_cxx}")
|
||||
else()
|
||||
list(APPEND _object_depends "${_output_c}")
|
||||
endif()
|
||||
|
||||
combine_arguments(_pch_compile_flags)
|
||||
set_source_files_properties(${_source} PROPERTIES
|
||||
COMPILE_FLAGS "${_pch_compile_flags}"
|
||||
OBJECT_DEPENDS "${_object_depends}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
endfunction()
|
77
cmake/modules/SelectLibraryConfigurations_SLIC3R.cmake
Normal file
@ -0,0 +1,77 @@
|
||||
# Modified from the CMake github master.
|
||||
# required by the bundled FindCURL.cmake
|
||||
|
||||
|
||||
|
||||
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#.rst:
|
||||
# SelectLibraryConfigurations
|
||||
# ---------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
# select_library_configurations( basename )
|
||||
#
|
||||
# This macro takes a library base name as an argument, and will choose
|
||||
# good values for basename_LIBRARY, basename_LIBRARIES,
|
||||
# basename_LIBRARY_DEBUG, and basename_LIBRARY_RELEASE depending on what
|
||||
# has been found and set. If only basename_LIBRARY_RELEASE is defined,
|
||||
# basename_LIBRARY will be set to the release value, and
|
||||
# basename_LIBRARY_DEBUG will be set to basename_LIBRARY_DEBUG-NOTFOUND.
|
||||
# If only basename_LIBRARY_DEBUG is defined, then basename_LIBRARY will
|
||||
# take the debug value, and basename_LIBRARY_RELEASE will be set to
|
||||
# basename_LIBRARY_RELEASE-NOTFOUND.
|
||||
#
|
||||
# If the generator supports configuration types, then basename_LIBRARY
|
||||
# and basename_LIBRARIES will be set with debug and optimized flags
|
||||
# specifying the library to be used for the given configuration. If no
|
||||
# build type has been set or the generator in use does not support
|
||||
# configuration types, then basename_LIBRARY and basename_LIBRARIES will
|
||||
# take only the release value, or the debug value if the release one is
|
||||
# not set.
|
||||
|
||||
# This macro was adapted from the FindQt4 CMake module and is maintained by Will
|
||||
# Dicharry <wdicharry@stellarscience.com>.
|
||||
|
||||
macro( select_library_configurations_SLIC3R basename )
|
||||
if(NOT ${basename}_LIBRARY_RELEASE)
|
||||
set(${basename}_LIBRARY_RELEASE "${basename}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library.")
|
||||
endif()
|
||||
if(NOT ${basename}_LIBRARY_DEBUG)
|
||||
set(${basename}_LIBRARY_DEBUG "${basename}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library.")
|
||||
endif()
|
||||
|
||||
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
|
||||
NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE AND
|
||||
( _isMultiConfig OR CMAKE_BUILD_TYPE ) )
|
||||
# if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
|
||||
# single-config generators, set optimized and debug libraries
|
||||
set( ${basename}_LIBRARY "" )
|
||||
foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
|
||||
list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
|
||||
endforeach()
|
||||
foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
|
||||
list( APPEND ${basename}_LIBRARY debug "${_libname}" )
|
||||
endforeach()
|
||||
elseif( ${basename}_LIBRARY_RELEASE )
|
||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
|
||||
elseif( ${basename}_LIBRARY_DEBUG )
|
||||
set( ${basename}_LIBRARY ${${basename}_LIBRARY_DEBUG} )
|
||||
else()
|
||||
set( ${basename}_LIBRARY "${basename}_LIBRARY-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
|
||||
|
||||
if( ${basename}_LIBRARY )
|
||||
set( ${basename}_FOUND TRUE )
|
||||
endif()
|
||||
|
||||
mark_as_advanced( ${basename}_LIBRARY_RELEASE
|
||||
${basename}_LIBRARY_DEBUG
|
||||
)
|
||||
endmacro()
|
75
deps/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
#
|
||||
# This CMake project downloads, configures and builds Slic3r PE dependencies on Unix and Windows.
|
||||
#
|
||||
# When using this script, it's recommended to perform an out-of-source build using CMake.
|
||||
#
|
||||
# All the dependencies are installed in a `destdir` directory in the root of the build directory,
|
||||
# in a traditional Unix-style prefix structure. The destdir can be used directly by CMake
|
||||
# when building Slic3r - to do this, set the CMAKE_PREFIX_PATH to ${destdir}/usr/local.
|
||||
#
|
||||
# For better clarity of console output, it's recommended to _not_ use a parallelized build
|
||||
# for the top-level command, ie. use `make -j 1` or `ninja -j 1` to force single-threaded top-level
|
||||
# build. This doesn't degrade performance as individual dependencies are built in parallel fashion
|
||||
# if supported by the dependency.
|
||||
#
|
||||
# On Windows, architecture (64 vs 32 bits) is judged based on the compiler variant.
|
||||
# To build dependencies for either 64 or 32 bit OS, use the respective compiler command line.
|
||||
#
|
||||
# WARNING: On UNIX platforms wxWidgets hardcode the destdir path into its `wx-conffig` utility,
|
||||
# therefore, unfortunatelly, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
|
||||
#
|
||||
|
||||
project(Slic3r-deps)
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
include(ExternalProject)
|
||||
include(ProcessorCount)
|
||||
|
||||
ProcessorCount(NPROC)
|
||||
if (NPROC EQUAL 0)
|
||||
set(NPROC 1)
|
||||
endif ()
|
||||
|
||||
set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
|
||||
option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON)
|
||||
|
||||
message(STATUS "Slic3r deps DESTDIR: ${DESTDIR}")
|
||||
message(STATUS "Slic3r deps debug build: ${DEP_DEBUG}")
|
||||
|
||||
if (MSVC)
|
||||
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||
message(STATUS "\nDetected 64-bit compiler => building 64-bit deps bundle\n")
|
||||
set(DEPS_BITS 64)
|
||||
include("deps-windows.cmake")
|
||||
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
||||
message(STATUS "\nDetected 32-bit compiler => building 32-bit deps bundle\n")
|
||||
set(DEPS_BITS 32)
|
||||
include("deps-windows.cmake")
|
||||
else ()
|
||||
message(FATAL_ERROR "Unable to detect architecture")
|
||||
endif ()
|
||||
elseif (APPLE)
|
||||
set(DEPS_OSX_TARGET "10.9" CACHE STRING "OS X SDK version to build against")
|
||||
set(DEPS_OSX_SYSROOT
|
||||
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${DEPS_OSX_TARGET}.sdk"
|
||||
CACHE PATH "OS X SDK directory"
|
||||
)
|
||||
|
||||
include("deps-macos.cmake")
|
||||
else ()
|
||||
include("deps-linux.cmake")
|
||||
endif()
|
||||
|
||||
add_custom_target(deps ALL
|
||||
DEPENDS
|
||||
dep_boost
|
||||
dep_tbb
|
||||
dep_libcurl
|
||||
dep_wxwidgets
|
||||
dep_gtest
|
||||
dep_nlopt
|
||||
dep_libpng
|
||||
)
|
||||
|
||||
# Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands
|
||||
# because they seem to generate bogus build files (possibly a bug in ExternalProject).
|
118
deps/deps-linux.cmake
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
|
||||
set(DEP_CMAKE_OPTS "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
|
||||
|
||||
include("deps-unix-common.cmake")
|
||||
|
||||
|
||||
ExternalProject_Add(dep_boost
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz"
|
||||
URL_HASH SHA256=bd0df411efd9a585e5a2212275f8762079fed8842264954675a4fddc46cfcf60
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ./bootstrap.sh
|
||||
--with-libraries=system,filesystem,thread,log,locale,regex
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
BUILD_COMMAND ./b2
|
||||
-j ${NPROC}
|
||||
--reconfigure
|
||||
link=static
|
||||
variant=release
|
||||
threading=multi
|
||||
boost.locale.icu=off
|
||||
cflags=-fPIC
|
||||
cxxflags=-fPIC
|
||||
install
|
||||
INSTALL_COMMAND "" # b2 does that already
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_libopenssl
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0g.tar.gz"
|
||||
URL_HASH SHA256=8e9516b8635bb9113c51a7b5b27f9027692a56b104e75b709e588c3ffd6a0422
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ./config
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
no-shared
|
||||
no-ssl3-method
|
||||
no-dynamic-engine
|
||||
-Wa,--noexecstack
|
||||
BUILD_COMMAND make depend && make "-j${NPROC}"
|
||||
INSTALL_COMMAND make install_sw
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_libcurl
|
||||
EXCLUDE_FROM_ALL 1
|
||||
DEPENDS dep_libopenssl
|
||||
URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
|
||||
URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ./configure
|
||||
--enable-static
|
||||
--disable-shared
|
||||
"--with-ssl=${DESTDIR}/usr/local"
|
||||
--with-pic
|
||||
--enable-ipv6
|
||||
--enable-versioned-symbols
|
||||
--enable-threaded-resolver
|
||||
--with-random=/dev/urandom
|
||||
--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt
|
||||
--disable-ldap
|
||||
--disable-ldaps
|
||||
--disable-manual
|
||||
--disable-rtsp
|
||||
--disable-dict
|
||||
--disable-telnet
|
||||
--disable-pop3
|
||||
--disable-imap
|
||||
--disable-smb
|
||||
--disable-smtp
|
||||
--disable-gopher
|
||||
--disable-crypto-auth
|
||||
--without-gssapi
|
||||
--without-libpsl
|
||||
--without-libidn2
|
||||
--without-gnutls
|
||||
--without-polarssl
|
||||
--without-mbedtls
|
||||
--without-cyassl
|
||||
--without-nss
|
||||
--without-axtls
|
||||
--without-brotli
|
||||
--without-libmetalink
|
||||
--without-libssh
|
||||
--without-libssh2
|
||||
--without-librtmp
|
||||
--without-nghttp2
|
||||
--without-zsh-functions-dir
|
||||
BUILD_COMMAND make "-j${NPROC}"
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_wxwidgets
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
|
||||
URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e
|
||||
BUILD_IN_SOURCE 1
|
||||
PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/wxwidgets-pngprefix.h" src/png/pngprefix.h
|
||||
CONFIGURE_COMMAND ./configure
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
--disable-shared
|
||||
--with-gtk=2
|
||||
--with-opengl
|
||||
--enable-unicode
|
||||
--enable-graphics_ctx
|
||||
--with-regex=builtin
|
||||
--with-libpng=builtin
|
||||
--with-libxpm=builtin
|
||||
--with-libjpeg=builtin
|
||||
--with-libtiff=builtin
|
||||
--with-zlib=builtin
|
||||
--with-expat=builtin
|
||||
--disable-precomp-headers
|
||||
--enable-debug_info
|
||||
--enable-debug_gdb
|
||||
--disable-debug
|
||||
--disable-debug_flag
|
||||
BUILD_COMMAND make "-j${NPROC}" && make -C locale allmo
|
||||
INSTALL_COMMAND make install
|
||||
)
|
103
deps/deps-macos.cmake
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
|
||||
set(DEP_CMAKE_OPTS
|
||||
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON"
|
||||
"-DCMAKE_OSX_SYSROOT=${DEPS_OSX_SYSROOT}"
|
||||
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${DEPS_OSX_TARGET}"
|
||||
)
|
||||
|
||||
include("deps-unix-common.cmake")
|
||||
|
||||
|
||||
ExternalProject_Add(dep_boost
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz"
|
||||
URL_HASH SHA256=bd0df411efd9a585e5a2212275f8762079fed8842264954675a4fddc46cfcf60
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ./bootstrap.sh
|
||||
--with-libraries=system,filesystem,thread,log,locale,regex
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
BUILD_COMMAND ./b2
|
||||
-j ${NPROC}
|
||||
--reconfigure
|
||||
link=static
|
||||
variant=release
|
||||
threading=multi
|
||||
boost.locale.icu=off
|
||||
"cflags=-fPIC -mmacosx-version-min=${DEPS_OSX_TARGET}"
|
||||
"cxxflags=-fPIC -mmacosx-version-min=${DEPS_OSX_TARGET}"
|
||||
install
|
||||
INSTALL_COMMAND "" # b2 does that already
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_libcurl
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
|
||||
URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ./configure
|
||||
--enable-static
|
||||
--disable-shared
|
||||
"--with-ssl=${DESTDIR}/usr/local"
|
||||
--with-pic
|
||||
--enable-ipv6
|
||||
--enable-versioned-symbols
|
||||
--enable-threaded-resolver
|
||||
--with-darwinssl
|
||||
--without-ssl # disables OpenSSL
|
||||
--disable-ldap
|
||||
--disable-ldaps
|
||||
--disable-manual
|
||||
--disable-rtsp
|
||||
--disable-dict
|
||||
--disable-telnet
|
||||
--disable-pop3
|
||||
--disable-imap
|
||||
--disable-smb
|
||||
--disable-smtp
|
||||
--disable-gopher
|
||||
--disable-crypto-auth
|
||||
--without-gssapi
|
||||
--without-libpsl
|
||||
--without-libidn2
|
||||
--without-gnutls
|
||||
--without-polarssl
|
||||
--without-mbedtls
|
||||
--without-cyassl
|
||||
--without-nss
|
||||
--without-axtls
|
||||
--without-brotli
|
||||
--without-libmetalink
|
||||
--without-libssh
|
||||
--without-libssh2
|
||||
--without-librtmp
|
||||
--without-nghttp2
|
||||
--without-zsh-functions-dir
|
||||
BUILD_COMMAND make "-j${NPROC}"
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_wxwidgets
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
|
||||
URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e
|
||||
BUILD_IN_SOURCE 1
|
||||
PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}/wxwidgets-pngprefix.h" src/png/pngprefix.h
|
||||
CONFIGURE_COMMAND ./configure
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
--disable-shared
|
||||
--with-osx_cocoa
|
||||
"--with-macosx-version-min=${DEPS_OSX_TARGET}"
|
||||
"--with-macosx-sdk=${DEPS_OSX_SYSROOT}"
|
||||
--with-opengl
|
||||
--with-regex=builtin
|
||||
--with-libpng=builtin
|
||||
--with-libxpm=builtin
|
||||
--with-libjpeg=builtin
|
||||
--with-libtiff=builtin
|
||||
--with-zlib=builtin
|
||||
--with-expat=builtin
|
||||
--disable-debug
|
||||
--disable-debug_flag
|
||||
BUILD_COMMAND make "-j${NPROC}" && make -C locale allmo
|
||||
INSTALL_COMMAND make install
|
||||
)
|
50
deps/deps-unix-common.cmake
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
# The unix common part expects DEP_CMAKE_OPTS to be set
|
||||
|
||||
ExternalProject_Add(dep_tbb
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
|
||||
URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
|
||||
CMAKE_ARGS
|
||||
-DTBB_BUILD_SHARED=OFF
|
||||
-DTBB_BUILD_TESTS=OFF
|
||||
${DEP_CMAKE_OPTS}
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_gtest
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz"
|
||||
URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
|
||||
CMAKE_ARGS -DBUILD_GMOCK=OFF ${DEP_CMAKE_OPTS}
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_nlopt
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"
|
||||
URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DNLOPT_PYTHON=OFF
|
||||
-DNLOPT_OCTAVE=OFF
|
||||
-DNLOPT_MATLAB=OFF
|
||||
-DNLOPT_GUILE=OFF
|
||||
${DEP_CMAKE_OPTS}
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_libpng
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "http://prdownloads.sourceforge.net/libpng/libpng-1.6.35.tar.xz?download"
|
||||
URL_HASH SHA256=23912ec8c9584917ed9b09c5023465d71709dce089be503c7867fec68a93bcd7
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DPNG_SHARED=OFF
|
||||
-DPNG_TESTS=OFF
|
||||
${DEP_CMAKE_OPTS}
|
||||
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
|
||||
INSTALL_COMMAND ""
|
||||
)
|
228
deps/deps-windows.cmake
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
|
||||
if (${DEPS_BITS} EQUAL 32)
|
||||
set(DEP_MSVC_GEN "Visual Studio 12")
|
||||
else ()
|
||||
set(DEP_MSVC_GEN "Visual Studio 12 Win64")
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
if (${DEP_DEBUG})
|
||||
set(DEP_BOOST_DEBUG "debug")
|
||||
else ()
|
||||
set(DEP_BOOST_DEBUG "")
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(dep_boost
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://dl.bintray.com/boostorg/release/1.63.0/source/boost_1_63_0.tar.gz"
|
||||
URL_HASH SHA256=fe34a4e119798e10b8cc9e565b3b0284e9fd3977ec8a1b19586ad1dec397088b
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND bootstrap.bat
|
||||
BUILD_COMMAND b2.exe
|
||||
-j "${NPROC}"
|
||||
--with-system
|
||||
--with-filesystem
|
||||
--with-thread
|
||||
--with-log
|
||||
--with-locale
|
||||
--with-regex
|
||||
"--prefix=${DESTDIR}/usr/local"
|
||||
"address-model=${DEPS_BITS}"
|
||||
toolset=msvc-12.0
|
||||
link=static
|
||||
variant=release
|
||||
threading=multi
|
||||
boost.locale.icu=off
|
||||
"${DEP_BOOST_DEBUG}" release install
|
||||
INSTALL_COMMAND "" # b2 does that already
|
||||
)
|
||||
|
||||
|
||||
ExternalProject_Add(dep_tbb
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
|
||||
URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_DEBUG_POSTFIX=_debug
|
||||
-DTBB_BUILD_SHARED=OFF
|
||||
-DTBB_BUILD_TESTS=OFF
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
BUILD_COMMAND msbuild /P:Configuration=Release INSTALL.vcxproj
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(dep_tbb BINARY_DIR)
|
||||
ExternalProject_Add_Step(dep_tbb build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND msbuild /P:Configuration=Debug INSTALL.vcxproj
|
||||
WORKING_DIRECTORY "${BINARY_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
||||
ExternalProject_Add(dep_gtest
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz"
|
||||
URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DBUILD_GMOCK=OFF
|
||||
-Dgtest_force_shared_crt=ON
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
BUILD_COMMAND msbuild /P:Configuration=Release INSTALL.vcxproj
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(dep_gtest BINARY_DIR)
|
||||
ExternalProject_Add_Step(dep_gtest build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND msbuild /P:Configuration=Debug INSTALL.vcxproj
|
||||
WORKING_DIRECTORY "${BINARY_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
||||
ExternalProject_Add(dep_nlopt
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"
|
||||
URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DNLOPT_PYTHON=OFF
|
||||
-DNLOPT_OCTAVE=OFF
|
||||
-DNLOPT_MATLAB=OFF
|
||||
-DNLOPT_GUILE=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DCMAKE_DEBUG_POSTFIX=d
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
BUILD_COMMAND msbuild /P:Configuration=Release INSTALL.vcxproj
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(dep_nlopt BINARY_DIR)
|
||||
ExternalProject_Add_Step(dep_nlopt build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND msbuild /P:Configuration=Debug INSTALL.vcxproj
|
||||
WORKING_DIRECTORY "${BINARY_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
||||
ExternalProject_Add(dep_zlib
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://zlib.net/zlib-1.2.11.tar.xz"
|
||||
URL_HASH SHA256=4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
"-DINSTALL_BIN_DIR=${CMAKE_CURRENT_BINARY_DIR}\\fallout" # I found no better way of preventing zlib creating & installing DLLs :-/
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
BUILD_COMMAND msbuild /P:Configuration=Release INSTALL.vcxproj
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(dep_zlib BINARY_DIR)
|
||||
ExternalProject_Add_Step(dep_zlib build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND msbuild /P:Configuration=Debug INSTALL.vcxproj
|
||||
WORKING_DIRECTORY "${BINARY_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
||||
ExternalProject_Add(dep_libpng
|
||||
DEPENDS dep_zlib
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "http://prdownloads.sourceforge.net/libpng/libpng-1.6.35.tar.xz?download"
|
||||
URL_HASH SHA256=23912ec8c9584917ed9b09c5023465d71709dce089be503c7867fec68a93bcd7
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DPNG_SHARED=OFF
|
||||
-DPNG_TESTS=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
"-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
|
||||
BUILD_COMMAND msbuild /P:Configuration=Release INSTALL.vcxproj
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(dep_libpng BINARY_DIR)
|
||||
ExternalProject_Add_Step(dep_libpng build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND msbuild /P:Configuration=Debug INSTALL.vcxproj
|
||||
WORKING_DIRECTORY "${BINARY_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
||||
if (${DEPS_BITS} EQUAL 32)
|
||||
set(DEP_LIBCURL_TARGET "x86")
|
||||
else ()
|
||||
set(DEP_LIBCURL_TARGET "x64")
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(dep_libcurl
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
|
||||
URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND cd winbuild && nmake /f Makefile.vc mode=static VC=12 GEN_PDB=yes DEBUG=no "MACHINE=${DEP_LIBCURL_TARGET}"
|
||||
INSTALL_COMMAND cd builds\\libcurl-*-release-*-winssl
|
||||
&& "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"
|
||||
&& "${CMAKE_COMMAND}" -E copy_directory lib "${DESTDIR}\\usr\\local\\lib"
|
||||
)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(dep_libcurl SOURCE_DIR)
|
||||
ExternalProject_Add_Step(dep_libcurl build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND cd winbuild && nmake /f Makefile.vc mode=static VC=12 GEN_PDB=yes DEBUG=yes "MACHINE=${DEP_LIBCURL_TARGET}"
|
||||
WORKING_DIRECTORY "${SOURCE_DIR}"
|
||||
)
|
||||
ExternalProject_Add_Step(dep_libcurl install_debug
|
||||
DEPENDEES install
|
||||
COMMAND cd builds\\libcurl-*-debug-*-winssl
|
||||
&& "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"
|
||||
&& "${CMAKE_COMMAND}" -E copy_directory lib "${DESTDIR}\\usr\\local\\lib"
|
||||
WORKING_DIRECTORY "${SOURCE_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
||||
if (${DEPS_BITS} EQUAL 32)
|
||||
set(DEP_WXWIDGETS_TARGET "")
|
||||
set(DEP_WXWIDGETS_LIBDIR "vc_lib")
|
||||
else ()
|
||||
set(DEP_WXWIDGETS_TARGET "TARGET_CPU=X64")
|
||||
set(DEP_WXWIDGETS_LIBDIR "vc_x64_lib")
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(dep_wxwidgets
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
|
||||
URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e
|
||||
BUILD_IN_SOURCE 1
|
||||
PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}\\wxwidgets-pngprefix.h" src\\png\\pngprefix.h
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND cd build\\msw && nmake /f makefile.vc BUILD=release SHARED=0 UNICODE=1 USE_GUI=1 "${DEP_WXWIDGETS_TARGET}"
|
||||
INSTALL_COMMAND "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"
|
||||
&& "${CMAKE_COMMAND}" -E copy_directory "lib\\${DEP_WXWIDGETS_LIBDIR}" "${DESTDIR}\\usr\\local\\lib\\${DEP_WXWIDGETS_LIBDIR}"
|
||||
)
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(dep_wxwidgets SOURCE_DIR)
|
||||
ExternalProject_Add_Step(dep_wxwidgets build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND cd build\\msw && nmake /f makefile.vc BUILD=debug SHARED=0 UNICODE=1 USE_GUI=1 "${DEP_WXWIDGETS_TARGET}"
|
||||
WORKING_DIRECTORY "${SOURCE_DIR}"
|
||||
)
|
||||
endif ()
|
168
deps/wxwidgets-pngprefix.h
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
// Patched in Slic3r: These two were missing:
|
||||
#define png_write_eXIf wx_png_write_eXIf
|
||||
#define png_handle_eXIf wx_png_handle_eXIf
|
||||
|
||||
#define png_sRGB_table wx_png_sRGB_table
|
||||
#define png_sRGB_base wx_png_sRGB_base
|
||||
#define png_sRGB_delta wx_png_sRGB_delta
|
||||
#define png_zstream_error wx_png_zstream_error
|
||||
#define png_free_buffer_list wx_png_free_buffer_list
|
||||
#define png_fixed wx_png_fixed
|
||||
#define png_user_version_check wx_png_user_version_check
|
||||
#define png_malloc_base wx_png_malloc_base
|
||||
#define png_malloc_array wx_png_malloc_array
|
||||
#define png_realloc_array wx_png_realloc_array
|
||||
#define png_create_png_struct wx_png_create_png_struct
|
||||
#define png_destroy_png_struct wx_png_destroy_png_struct
|
||||
#define png_free_jmpbuf wx_png_free_jmpbuf
|
||||
#define png_zalloc wx_png_zalloc
|
||||
#define png_zfree wx_png_zfree
|
||||
#define png_default_read_data wx_png_default_read_data
|
||||
#define png_push_fill_buffer wx_png_push_fill_buffer
|
||||
#define png_default_write_data wx_png_default_write_data
|
||||
#define png_default_flush wx_png_default_flush
|
||||
#define png_reset_crc wx_png_reset_crc
|
||||
#define png_write_data wx_png_write_data
|
||||
#define png_read_sig wx_png_read_sig
|
||||
#define png_read_chunk_header wx_png_read_chunk_header
|
||||
#define png_read_data wx_png_read_data
|
||||
#define png_crc_read wx_png_crc_read
|
||||
#define png_crc_finish wx_png_crc_finish
|
||||
#define png_crc_error wx_png_crc_error
|
||||
#define png_calculate_crc wx_png_calculate_crc
|
||||
#define png_flush wx_png_flush
|
||||
#define png_write_IHDR wx_png_write_IHDR
|
||||
#define png_write_PLTE wx_png_write_PLTE
|
||||
#define png_compress_IDAT wx_png_compress_IDAT
|
||||
#define png_write_IEND wx_png_write_IEND
|
||||
#define png_write_gAMA_fixed wx_png_write_gAMA_fixed
|
||||
#define png_write_sBIT wx_png_write_sBIT
|
||||
#define png_write_cHRM_fixed wx_png_write_cHRM_fixed
|
||||
#define png_write_sRGB wx_png_write_sRGB
|
||||
#define png_write_iCCP wx_png_write_iCCP
|
||||
#define png_write_sPLT wx_png_write_sPLT
|
||||
#define png_write_tRNS wx_png_write_tRNS
|
||||
#define png_write_bKGD wx_png_write_bKGD
|
||||
#define png_write_hIST wx_png_write_hIST
|
||||
#define png_write_tEXt wx_png_write_tEXt
|
||||
#define png_write_zTXt wx_png_write_zTXt
|
||||
#define png_write_iTXt wx_png_write_iTXt
|
||||
#define png_set_text_2 wx_png_set_text_2
|
||||
#define png_write_oFFs wx_png_write_oFFs
|
||||
#define png_write_pCAL wx_png_write_pCAL
|
||||
#define png_write_pHYs wx_png_write_pHYs
|
||||
#define png_write_tIME wx_png_write_tIME
|
||||
#define png_write_sCAL_s wx_png_write_sCAL_s
|
||||
#define png_write_finish_row wx_png_write_finish_row
|
||||
#define png_write_start_row wx_png_write_start_row
|
||||
#define png_combine_row wx_png_combine_row
|
||||
#define png_do_read_interlace wx_png_do_read_interlace
|
||||
#define png_do_write_interlace wx_png_do_write_interlace
|
||||
#define png_read_filter_row wx_png_read_filter_row
|
||||
#define png_write_find_filter wx_png_write_find_filter
|
||||
#define png_read_IDAT_data wx_png_read_IDAT_data
|
||||
#define png_read_finish_IDAT wx_png_read_finish_IDAT
|
||||
#define png_read_finish_row wx_png_read_finish_row
|
||||
#define png_read_start_row wx_png_read_start_row
|
||||
#define png_zlib_inflate wx_png_zlib_inflate
|
||||
#define png_read_transform_info wx_png_read_transform_info
|
||||
#define png_do_strip_channel wx_png_do_strip_channel
|
||||
#define png_do_swap wx_png_do_swap
|
||||
#define png_do_packswap wx_png_do_packswap
|
||||
#define png_do_invert wx_png_do_invert
|
||||
#define png_do_bgr wx_png_do_bgr
|
||||
#define png_handle_IHDR wx_png_handle_IHDR
|
||||
#define png_handle_PLTE wx_png_handle_PLTE
|
||||
#define png_handle_IEND wx_png_handle_IEND
|
||||
#define png_handle_bKGD wx_png_handle_bKGD
|
||||
#define png_handle_cHRM wx_png_handle_cHRM
|
||||
#define png_handle_gAMA wx_png_handle_gAMA
|
||||
#define png_handle_hIST wx_png_handle_hIST
|
||||
#define png_handle_iCCP wx_png_handle_iCCP
|
||||
#define png_handle_iTXt wx_png_handle_iTXt
|
||||
#define png_handle_oFFs wx_png_handle_oFFs
|
||||
#define png_handle_pCAL wx_png_handle_pCAL
|
||||
#define png_handle_pHYs wx_png_handle_pHYs
|
||||
#define png_handle_sBIT wx_png_handle_sBIT
|
||||
#define png_handle_sCAL wx_png_handle_sCAL
|
||||
#define png_handle_sPLT wx_png_handle_sPLT
|
||||
#define png_handle_sRGB wx_png_handle_sRGB
|
||||
#define png_handle_tEXt wx_png_handle_tEXt
|
||||
#define png_handle_tIME wx_png_handle_tIME
|
||||
#define png_handle_tRNS wx_png_handle_tRNS
|
||||
#define png_handle_zTXt wx_png_handle_zTXt
|
||||
#define png_check_chunk_name wx_png_check_chunk_name
|
||||
#define png_check_chunk_length wx_png_check_chunk_length
|
||||
#define png_handle_unknown wx_png_handle_unknown
|
||||
#define png_chunk_unknown_handling wx_png_chunk_unknown_handling
|
||||
#define png_do_read_transformations wx_png_do_read_transformations
|
||||
#define png_do_write_transformations wx_png_do_write_transformations
|
||||
#define png_init_read_transformations wx_png_init_read_transformations
|
||||
#define png_push_read_chunk wx_png_push_read_chunk
|
||||
#define png_push_read_sig wx_png_push_read_sig
|
||||
#define png_push_check_crc wx_png_push_check_crc
|
||||
#define png_push_save_buffer wx_png_push_save_buffer
|
||||
#define png_push_restore_buffer wx_png_push_restore_buffer
|
||||
#define png_push_read_IDAT wx_png_push_read_IDAT
|
||||
#define png_process_IDAT_data wx_png_process_IDAT_data
|
||||
#define png_push_process_row wx_png_push_process_row
|
||||
#define png_push_handle_unknown wx_png_push_handle_unknown
|
||||
#define png_push_have_info wx_png_push_have_info
|
||||
#define png_push_have_end wx_png_push_have_end
|
||||
#define png_push_have_row wx_png_push_have_row
|
||||
#define png_push_read_end wx_png_push_read_end
|
||||
#define png_process_some_data wx_png_process_some_data
|
||||
#define png_read_push_finish_row wx_png_read_push_finish_row
|
||||
#define png_push_handle_tEXt wx_png_push_handle_tEXt
|
||||
#define png_push_read_tEXt wx_png_push_read_tEXt
|
||||
#define png_push_handle_zTXt wx_png_push_handle_zTXt
|
||||
#define png_push_read_zTXt wx_png_push_read_zTXt
|
||||
#define png_push_handle_iTXt wx_png_push_handle_iTXt
|
||||
#define png_push_read_iTXt wx_png_push_read_iTXt
|
||||
#define png_colorspace_set_gamma wx_png_colorspace_set_gamma
|
||||
#define png_colorspace_sync_info wx_png_colorspace_sync_info
|
||||
#define png_colorspace_sync wx_png_colorspace_sync
|
||||
#define png_colorspace_set_chromaticities wx_png_colorspace_set_chromaticities
|
||||
#define png_colorspace_set_endpoints wx_png_colorspace_set_endpoints
|
||||
#define png_colorspace_set_sRGB wx_png_colorspace_set_sRGB
|
||||
#define png_colorspace_set_ICC wx_png_colorspace_set_ICC
|
||||
#define png_icc_check_length wx_png_icc_check_length
|
||||
#define png_icc_check_header wx_png_icc_check_header
|
||||
#define png_icc_check_tag_table wx_png_icc_check_tag_table
|
||||
#define png_icc_set_sRGB wx_png_icc_set_sRGB
|
||||
#define png_colorspace_set_rgb_coefficients wx_png_colorspace_set_rgb_coefficients
|
||||
#define png_check_IHDR wx_png_check_IHDR
|
||||
#define png_do_check_palette_indexes wx_png_do_check_palette_indexes
|
||||
#define png_fixed_error wx_png_fixed_error
|
||||
#define png_safecat wx_png_safecat
|
||||
#define png_format_number wx_png_format_number
|
||||
#define png_warning_parameter wx_png_warning_parameter
|
||||
#define png_warning_parameter_unsigned wx_png_warning_parameter_unsigned
|
||||
#define png_warning_parameter_signed wx_png_warning_parameter_signed
|
||||
#define png_formatted_warning wx_png_formatted_warning
|
||||
#define png_app_warning wx_png_app_warning
|
||||
#define png_app_error wx_png_app_error
|
||||
#define png_chunk_report wx_png_chunk_report
|
||||
#define png_ascii_from_fp wx_png_ascii_from_fp
|
||||
#define png_ascii_from_fixed wx_png_ascii_from_fixed
|
||||
#define png_check_fp_number wx_png_check_fp_number
|
||||
#define png_check_fp_string wx_png_check_fp_string
|
||||
#define png_muldiv wx_png_muldiv
|
||||
#define png_muldiv_warn wx_png_muldiv_warn
|
||||
#define png_reciprocal wx_png_reciprocal
|
||||
#define png_reciprocal2 wx_png_reciprocal2
|
||||
#define png_gamma_significant wx_png_gamma_significant
|
||||
#define png_gamma_correct wx_png_gamma_correct
|
||||
#define png_gamma_16bit_correct wx_png_gamma_16bit_correct
|
||||
#define png_gamma_8bit_correct wx_png_gamma_8bit_correct
|
||||
#define png_destroy_gamma_table wx_png_destroy_gamma_table
|
||||
#define png_build_gamma_table wx_png_build_gamma_table
|
||||
#define png_safe_error wx_png_safe_error
|
||||
#define png_safe_warning wx_png_safe_warning
|
||||
#define png_safe_execute wx_png_safe_execute
|
||||
#define png_image_error wx_png_image_error
|
||||
#define png_check_keyword wx_png_check_keyword
|
||||
|
||||
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
# Building Slic3r PE on Linux/UNIX
|
||||
|
@ -1,3 +1,9 @@
|
||||
|
||||
### NOTE: This document is currently outdated wrt. the new post-Perl Slic3rPE. A new build process and the description thereof is a work in progress and is comming soon. Please stay tuned.
|
||||
|
||||
--
|
||||
|
||||
|
||||
# Building Slic3r PE on Microsoft Windows
|
||||
|
||||
The currently supported way of building Slic3r PE on Windows is with CMake and MS Visual Studio 2013
|
||||
|
@ -1,316 +0,0 @@
|
||||
How to build Slic3r on Mac OS X 10.9 Maveric
|
||||
---------------------------------------------
|
||||
Vojtech Bubnik, 2017-12-12
|
||||
|
||||
|
||||
1) Install Mac OS X 10.7 Lion 64 bit with X Code
|
||||
------------------------------------------------
|
||||
|
||||
One has to build the OSX Slic3r on a real Mac, either directly on the system, or on a virtualized OSX. On Mac, two commercial solutions are available to legally virtualize MacOS on MacOS:
|
||||
http://www.parallels.com/eu/products/desktop/
|
||||
http://www.vmware.com/products/workstation/
|
||||
|
||||
Installation of a X Code on an OS X 10.7 Lion needs a bit of work. The latest X Code supported by the Lion on a Virtual Box is 4.21. The trouble is, the certificates of the X Code 4.21 installation package expired. One way to work around the certificate is to flatten the installation package by unpacking and repacking it:
|
||||
pkgutil --expand Foobar.pkg foobar
|
||||
pkgutil --flatten foobar barfoo.pkg
|
||||
|
||||
The flattened package is available here:
|
||||
\\rs.prusa\Development\Slic3r-Prusa\installxcode_421_lion_fixed.pkg
|
||||
|
||||
This installer does not install the X Code directly. Instead, it installs another installer with a set of 47 pkg files. These files have their certificates expired as well. You will find the packages on your MacOS here:
|
||||
/Applications/Install Xcode.app/Contents/Resources/Packages/
|
||||
|
||||
It is best to flatten them in a loop:
|
||||
cd /Applications/Install\ Xcode.app/Contents/Resources/Packages/
|
||||
for f in *.pkg; do
|
||||
pkgutil --expand $f /tmp/$f
|
||||
rm -f $f
|
||||
pkgutil --flatten /tmp/$f $f
|
||||
done
|
||||
|
||||
After that, you may finish the installation of Xcode by running
|
||||
/Applications/Install\ Xcode.app
|
||||
|
||||
|
||||
1b) Installing the Xcode on a newer system
|
||||
-------------------------------------------
|
||||
You will need to register as an Apple developer on
|
||||
https://developer.apple.com/
|
||||
log in and download and install Xcode
|
||||
https://developer.apple.com/downloads/
|
||||
You will likely need to download and install Xcode Command Line Tools, though the Xcode 4.1 came with the command line tools installed.
|
||||
|
||||
|
||||
2) Prepare the development environment
|
||||
--------------------------------------
|
||||
|
||||
Install the brew package manager:
|
||||
http://brew.sh/
|
||||
The brew package manager requires the git command line tool. Normally the git tool is installed as part of the Xcode command line tools.
|
||||
Copy and execute a command line from the top of http://brew.sh/ . It is possible, that the invocation of git fails because of some parameters the old git does not recognize. If so, invoke the git call manually.
|
||||
|
||||
Compile the boost library using brew. Following line compiles a 64bit boost with both static and shared libraries.
|
||||
brew install boost --universal
|
||||
|
||||
Install dylibbundler tool. The dylibbundler tool serves to collect dependent dynamic libraries and fix their linkage. Execute
|
||||
brew install dylibbundler
|
||||
|
||||
Install cmake
|
||||
brew install cmake
|
||||
|
||||
3) Install perl
|
||||
---------------
|
||||
|
||||
We don't want to distribute perl pre-installed on the Mac OS box. First, the system perl installation is not correct on some Mac OS versions, second it is not rellocatable. To compile a 64bit rellocatable perl, we use the perlbrew distribution. The perlbrew distribution installs into a user home directory and it allows switching between multiple versions of perl.
|
||||
http://perlbrew.pl/
|
||||
|
||||
First install perlbrew
|
||||
curl -L http://install.perlbrew.pl | bash
|
||||
Then compile the newest perl with the rellocatable @INC path and with multithreading enabled, execute following line:
|
||||
perlbrew install --threads -Duserelocatableinc --switch perl-5.26.1
|
||||
The --switch parameter switches the active perl to the currently compiled one.
|
||||
Available perl versions could be listed by calling
|
||||
perlbrew available
|
||||
Switch to the newly compiled perl
|
||||
perl5/perlbrew/bin/perlbrew switch perl-5.26.1
|
||||
Install cpanm
|
||||
perlbrew install-cpanm
|
||||
|
||||
Initialize CPAN, install PAR and PAR::Packer modules
|
||||
execute cpan command, from the cpan prompt, run
|
||||
install App::cpanminus
|
||||
install ExtUtils::CppGuess
|
||||
install ExtUtils::Typemaps
|
||||
install ExtUtils::Typemaps::Basic
|
||||
install PAR
|
||||
install PAR::Packer
|
||||
install Module::Build
|
||||
install Module::Pluggable
|
||||
install Module::Runtime
|
||||
install Moo
|
||||
install Test::Pod
|
||||
install Test::Pod::Coverage
|
||||
quit
|
||||
|
||||
4) Download and install Slic3r
|
||||
------------------------------
|
||||
|
||||
git clone git://github.com/alexrj/Slic3r
|
||||
cd Slic3r
|
||||
perl Build.PL
|
||||
|
||||
Now Slic3r shall be compiled. You may try to execute
|
||||
perl slic3r.pl
|
||||
to get a help screen, or
|
||||
perl slic3r.pl some_model.stl
|
||||
to have the model sliced.
|
||||
|
||||
5) Download and compile the GUI libraries needed to execute Slic3r in GUI mode
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Building the Perl Alien-Wx containing a wxWidgets library:
|
||||
We use wxWidgets-3.0.3.
|
||||
patch wxWidgets-3.0.3//src/osx/cocoa/textctrl.mm , see https://github.com/prusa3d/Slic3r/issues/600
|
||||
perl -I. Build.PL --wxWidgets-extraflags="--with-osx_cocoa --with-macosx-version-min=10.9 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin --with-opengl"
|
||||
perl -I. Build
|
||||
perl -I. Build test
|
||||
perl -I. Build
|
||||
|
||||
Building the Perl Wx package:
|
||||
cpan install Wx
|
||||
|
||||
Building the Perl OpenGL package:
|
||||
OpenGL needs to be patched to support MSAA, see the Windows patch.
|
||||
|
||||
|
||||
For the current Slic3r 1.2.30 code base, set the environment variable SLIC3R_STATIC to link a static version of the boost library:
|
||||
export SLIC3R_STATIC=1
|
||||
|
||||
then execute
|
||||
perl Build.PL --gui
|
||||
and keep your fingers crossed. The Build.PL script downloads and compiles the WxWidgets 3.0 through a Alien::Wx PERL package. The WxWidget shared libraries will land into
|
||||
~/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/darwin-thread-multi-2level/Alien/wxWidgets/
|
||||
|
||||
On Maverics, we experienced following issue compiling WxPerl:
|
||||
http://wiki.bolay.net/doku.php?id=acdsn:acdsn-a:mac
|
||||
|
||||
Now you could run the GUI version of slic3r by calling
|
||||
perl slic3r.pl --gui
|
||||
If some dependency is missing, the MacOS system will let you know.
|
||||
|
||||
6) Packing the Slic3r
|
||||
---------------------
|
||||
|
||||
Perl is an operating system on its own. Many modules are shared among multiple applications and it is difficult to extract a stand-alone application from a perl installation manually. Fortunately, tools are available, which automate the process to some extent. One of the tools is the PAR::Packer. The PAR::Packer tool (pp executable) is able to create a standalone executable for a perl script. The standalone executable contains a PAR archive (a zip file) bundled with a perl interpreter. When executed, the bundled executable will decompress most of the PAR archive into a temp folder. Because of that, we will use the PAR::Packer to resolve and collect the dependencies, but we will create an installer manually.
|
||||
|
||||
The PAR::Packer could analyze the dependencies by a statical analysis, or at a runtime. The statical analysis does not resolve the dynamically loaded modules. On the other side, the statical analysis is pessimistic, therefore it often collects unneeded packages. The dynamic analysis may miss some package, if not all branches of a code are executed. We will try to solely depend on the dynamic analysis to keep the installation size minimal. We may need to develop a protocol or an automatic UI tool to exercise as much as possible from the Slic3r GUI to pack the GUI version reliably. Once a reliable list of dependencies is collected, we may not need the PAR::Packer anymore.
|
||||
|
||||
To create a PAR archive of a command line slic3r, execute
|
||||
pp -e -p -x slic3r.pl --xargs cube.stl -o slic3r.par
|
||||
and let the slic3r slice a cube.stl to load the dynamic modules.
|
||||
|
||||
To create a PAR archive of a GUI slic3r, execute
|
||||
pp -e -p -x slic3r.pl --xargs --gui -o slic3r.par
|
||||
and exercise the slic3r gui to load all modules.
|
||||
|
||||
Rename the slic3r.par file to slic3r.zip and decompress. Most of the code needed to execute Slic3r is there, only the perl executable is missing for the command line slic3r, and the WxWidgets shared libraries and the liblzma shared library are missing for the GUI version.
|
||||
|
||||
7) Collecting the dependent shared libraries, making the link paths relative
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
We have linked Slic3r against a static boost library, therefore the command line slic3r is not dependent on any non-system shared library. The situation is different for the GUI slic3r, which links dynamically against WxWidgets and liblzma.
|
||||
|
||||
The trick developed by Apple to allow rellocable shared libraries is to addres a shared library relatively to the path of the executable by encoding a special token @executable_path at the start of the path. Unfortunately the libraries requried by Slic3r are compiled with absolute paths.
|
||||
|
||||
Once the slic3r.par archive is unpacked, one may list the native shared libraries by
|
||||
find ./ -name '*.bundle'
|
||||
and one may list the dependencies by running
|
||||
otool -L somefile.bundle
|
||||
Most of the dependencies point to system directores and these dependences are always fulfilled. Dependencies pointing to the WxWidget libraries need to be fixed. These have a form
|
||||
~/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/darwin-thread-multi-2level/Alien/wxWidgets/osx_cocoa_3_0_2_uni/lib/libwx_*.dylib
|
||||
and we need to replace them with
|
||||
@executable_path/../Frameworks/libwx_*.dylib
|
||||
Another dependency, which needs our attention is
|
||||
/usr/local/Cellar/xz/5.2.2/lib/liblzma.5.dylib
|
||||
|
||||
Fortunately, a tool dylibbundler was developed to address this problem.
|
||||
First install dylibbundler by calling
|
||||
brew dylibbundler
|
||||
|
||||
For some installations, the dylibbundler tool sufficiently fixes all dependencies. Unfortunately, the WxWidgets installation is inconsistent in the versioning, therefore a certain clean-up is required. Namely, the WxWidgets libraries are compiled with the full build number in their file name. For example, the base library is built as libwx_baseu-3.0.0.2.0.dylib and a symlink is created libwx_baseu-3.0.dylib pointing to the full name. Then some of the Wx libraries link against the full name and some against the symlink, leading the dylibbundler to pack both. We solved the problem by whipping up a following script:
|
||||
\\rs.prusa\Development\Slic3r-Prusa\How_to_build_on_MacOSX_Lion\fix_dependencies.sh
|
||||
|
||||
call
|
||||
slic3r_dependencies.sh --fix
|
||||
to collect the shared libraries into Content/Frameworks and to fix their linkage.
|
||||
|
||||
call
|
||||
slic3r_dependencies.sh --show
|
||||
to list dependent libraries in a sorted order. All the non-system dependencies shall start with @executable_path after the fix.
|
||||
|
||||
|
||||
|
||||
8) Packing Slic3r into a dmg image using a bunch of scripts
|
||||
-----------------------------------------------------------
|
||||
|
||||
Instead of relying on the PAR::Packer to collect the dependencies, we have used PAR::Packer to extract the dependencies, we manually cleaned them up and created an installer script.
|
||||
\\rs.prusa\Development\Slic3r-Prusa\How_to_build_on_MacOSX_Lion\Slic3r-Build-MacOS
|
||||
First compile Slic3r, then call build_dmg.sh with a path to the Slic3r source tree as a parameter.
|
||||
The script will collect all dependencies into Slic3r.app and it will create Slic3r.dmg.
|
||||
If SLIC3R_GUI variable is defined, a GUI variant of Slic3r will be packed.
|
||||
|
||||
|
||||
|
||||
|
||||
How to build on Windows
|
||||
-----------------------
|
||||
|
||||
The prefered perl distribution on MS Windows is the Strawberry Perl 5.22.1.3 (32bit)
|
||||
http://strawberryperl.com/
|
||||
|
||||
Let it install into c:\strawberry
|
||||
You may make a copy of the distribution. We recommend to make following copies:
|
||||
For a release command line only build: c:\strawberry-minimal
|
||||
For a release GUI build: c:\strawberry-minimal-gui
|
||||
For a development build with debugging information: c:\strawberry-debug
|
||||
and to make one of them active by making a directory junction:
|
||||
mklink /d c:\Strawberry c:\Strawberry-debug
|
||||
|
||||
Building boost:
|
||||
Slic3r seems to have a trouble with the latest boost 1.60.0 on Windows. Please use 1.59.
|
||||
Decompress it to
|
||||
c:\dev\
|
||||
otherwise it will not be found by the Build.PL on Windows. You may consider to hack xs\Build.PL with your prefered boost path.
|
||||
run
|
||||
bootstrap.bat mingw
|
||||
b2 toolset=gcc
|
||||
|
||||
Install git command line
|
||||
https://git-scm.com/
|
||||
|
||||
Download Slic3r source code
|
||||
git clone git://github.com/alexrj/Slic3r.git
|
||||
|
||||
Run compilation
|
||||
cd Slic3r
|
||||
perl Build.PL
|
||||
perl Build.PL --gui
|
||||
|
||||
With a bit of luck, you will end up with a working Slic3r including GUI.
|
||||
|
||||
|
||||
|
||||
|
||||
Packing on Windows
|
||||
------------------
|
||||
|
||||
Life is easy on Windows. PAR::Packer will help again to collect the dependencies. The basic procedure is the same as for MacOS:
|
||||
|
||||
To create a PAR archive of a command line slic3r, execute
|
||||
pp -e -p -x slic3r.pl --xargs cube.stl -o slic3r.par
|
||||
and let the slic3r slice a cube.stl to load the dynamic modules.
|
||||
|
||||
To create a PAR archive of a GUI slic3r, execute
|
||||
pp -e -p -x slic3r.pl --xargs --gui -o slic3r.par
|
||||
and exercise the slic3r gui to load all modules.
|
||||
|
||||
The standalone installation is then created from the PAR archive by renaming it into a zip and adding following binaries from c:\strawberry to the root of the extracted zip:
|
||||
perl5.22.1.exe
|
||||
perl522.dll
|
||||
libgcc_s_sjlj-1.dll
|
||||
libstdc++-6.dll
|
||||
libwinpthread-1.dll
|
||||
|
||||
The GUI build requires following DLLs in addition:
|
||||
libglut-0_.dll
|
||||
wxbase30u_gcc_custom.dll
|
||||
wxmsw30u_adv_gcc_custom.dll
|
||||
wxmsw30u_core_gcc_custom.dll
|
||||
wxmsw30u_gl_gcc_custom.dll
|
||||
wxmsw30u_html_gcc_custom.dll
|
||||
|
||||
and the var directory with the icons needs to be copied to the destination directory.
|
||||
|
||||
To run the slic3r, move the script\slic3r.pl one level up and create a following tiny windows batch in the root of the unpacked zip:
|
||||
@perl5.22.1.exe slic3r.pl %*
|
||||
A windows shortcut may be created for the GUI version. Instead of the perl.exe, it is better to use the wperl.exe to start the GUI Slic3r, because it does not open a text console.
|
||||
|
||||
The strawberry perl is already rellocatable, which means that the perl interpreter will find the perl modules in the lib directory,
|
||||
and Windows look up the missing DLLs in the directory of the executable, therefore no further rellocation effort is necessary.
|
||||
|
||||
|
||||
Packing on Windows, a single EXE solution
|
||||
-----------------------------------------
|
||||
|
||||
One may try to create a PAR executable for command line slic3r:
|
||||
pp -M Encode::Locale -M Moo -M Thread::Semaphore -M Slic3r::XS -M Unicode::Normalize -o slic3r.exe slic3r.pl
|
||||
|
||||
One may as well create a PAR executable for Windows GUI:
|
||||
pp -M Encode::Locale -M Moo -M Thread::Semaphore -M OpenGL -M Slic3r::XS -M Unicode::Normalize -M Wx -M Class::Accessor -M Wx::DND -M Wx::Grid -M Wx::Print -M Wx::Html -M Wx::GLCanvas -M Math::Trig -M threads -M threads::shared -M Thread::Queue -l C:\strawberry\perl\site\lib\auto\Wx\Wx.xs.dll -o -l C:\strawberry\perl\site\lib\Alien\wxWidgets\msw_3_0_2_uni_gcc_3_4\lib\wxbase30u_gcc_custom.dll -l C:\strawberry\perl\site\lib\Alien\wxWidgets\msw_3_0_2_uni_gcc_3_4\lib\wxmsw30u_core_gcc_custom.dll -l C:\strawberry\perl\site\lib\Alien\wxWidgets\msw_3_0_2_uni_gcc_3_4\lib\wxmsw30u_gl_gcc_custom.dll -l C:\strawberry\perl\site\lib\Alien\wxWidgets\msw_3_0_2_uni_gcc_3_4\lib\wxmsw30u_adv_gcc_custom.dll -l C:\strawberry\perl\site\lib\Alien\wxWidgets\msw_3_0_2_uni_gcc_3_4\lib\wxmsw30u_html_gcc_custom.dll -o slic3r.exe slic3r.pl
|
||||
|
||||
Remember, that these executables will unpack into a temporary directory. The directory may be declared by setting an environment variable PAR_GLOBAL_TEMP. Otherwise the temporaries are unpacked into
|
||||
C:\Users\xxx\AppData\Local\Temp\par-xxxxxx
|
||||
|
||||
|
||||
Debugging the perl, debugging on Windows
|
||||
----------------------------------------
|
||||
|
||||
It is possible to debug perl using the integrated debugger. The EPIC plugin for Eclipse works very well with an older eclipse-SDK-3.6.2. There is a catch though: The Perl debugger does not work correctly with multiple threads running under the Perl interpreter. If that happens, the EPIC plugin gets confused and the debugger stops working. The same happens with the Komodo IDE.
|
||||
|
||||
Debugging the C++ code works fine using the latest Eclipse for C++ and the gdb of MinGW. The gdb packed with the Strawberry distribution does not contain the Python support, so pretty printing of the stl containers only works if another gdb build is used. The one of the QT installation works well.
|
||||
|
||||
It is yet a bit more complicated. The Strawberry MINGW is compiled for a different C++ exception passing model (SJLJ) than the other MINGWs, so one cannot simply combine MINGWs on Windows. For an unknown reason the nice debugger of the QT Creator hangs when debugging the C++ compiled by the Strawberry MINGW. Mabe it is because of the different exception passing models.
|
||||
|
||||
And to disable optimization of the C/C++ code, one has to manually modify Config_heavy.pl in the Perl central installation. The SLIC3R_DEBUG environment variable did not override all the -O2 and -O3 flags that the perl build adds the gcc execution line.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Building boost.
|
||||
|
||||
One may save compilation time by compiling just what Slic3r needs.
|
||||
./bootstrap.sh --with-libraries=system,filesystem,thread,log,locale,regex
|
||||
The -fPIC flag is required on Linux to make the static libraries rellocatable,
|
||||
so they could be embedded into a shared library.
|
||||
It is important to disable boost.locale.icu=off when compiling the static boost library.
|
||||
./bjam -a link=static variant=release threading=multi boost.locale.icu=off --with-locale cxxflags=-fPIC cflags=-fPIC
|
||||
To install on Linux to /usr/local/..., run the line above with the additional install keyword and with sudo.
|
@ -1,135 +0,0 @@
|
||||
|
||||
#
|
||||
# This makefile downloads, configures and builds Slic3r PE dependencies for Unix.
|
||||
# (That is, all dependencies except perl + wxWidgets.)
|
||||
# The libraries are installed in DESTDIR, which you can customize like so:
|
||||
#
|
||||
# DESTDIR=foo/bar make
|
||||
#
|
||||
# The default DESTDIR is ~/slic3r-destdir
|
||||
# If the DESTDIR doesn't exits, the makefile tries to create it
|
||||
#
|
||||
# To pass the DESTDIR path along to cmake, set the use CMAKE_PREFIX_PATH variable
|
||||
# and set it to $DESTDIR/usr/local
|
||||
#
|
||||
# You can also customize the NPROC variable in the same way to configure the number
|
||||
# of cores the build process uses. By default this is set to what the `nproc` command says.
|
||||
#
|
||||
|
||||
|
||||
DESTDIR ?= $(HOME)/slic3r-destdir
|
||||
NPROC ?= $(shell nproc)
|
||||
|
||||
|
||||
BOOST = boost_1_66_0
|
||||
TBB_SHA = a0dc9bf76d0120f917b641ed095360448cabc85b
|
||||
TBB = tbb-$(TBB_SHA)
|
||||
OPENSSL = openssl-OpenSSL_1_1_0g
|
||||
CURL = curl-7.58.0
|
||||
|
||||
.PHONY: all destdir boost libcurl libopenssl libtbb
|
||||
|
||||
all: destdir boost libtbb libcurl
|
||||
@echo
|
||||
@echo "All done!"
|
||||
@echo
|
||||
|
||||
destdir:
|
||||
mkdir -p $(DESTDIR)
|
||||
|
||||
|
||||
|
||||
boost: $(BOOST).tar.gz
|
||||
tar -zxvf $(BOOST).tar.gz
|
||||
cd $(BOOST) && ./bootstrap.sh --with-libraries=system,filesystem,thread,log,locale,regex --prefix=$(DESTDIR)/usr/local
|
||||
cd $(BOOST) && ./b2 \
|
||||
-j $(NPROC) \
|
||||
link=static \
|
||||
variant=release \
|
||||
threading=multi \
|
||||
boost.locale.icu=off \
|
||||
cxxflags=-fPIC cflags=-fPIC \
|
||||
install
|
||||
|
||||
$(BOOST).tar.gz:
|
||||
curl -L -o $@ https://dl.bintray.com/boostorg/release/1.66.0/source/$@
|
||||
|
||||
|
||||
|
||||
libtbb: $(TBB).tar.gz
|
||||
tar -zxvf $(TBB).tar.gz
|
||||
mkdir -p $(TBB)/mybuild
|
||||
cd $(TBB)/mybuild && cmake .. -DTBB_BUILD_SHARED=OFF -DTBB_BUILD_TESTS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
$(MAKE) -C $(TBB)/mybuild -j$(NPROC)
|
||||
$(MAKE) -C $(TBB)/mybuild install DESTDIR=$(DESTDIR)
|
||||
|
||||
$(TBB).tar.gz:
|
||||
curl -L -o $@ https://github.com/wjakob/tbb/archive/$(TBB_SHA).tar.gz
|
||||
|
||||
|
||||
# Note: libcurl build system seems to be a bit wonky about finding openssl (cf. #2378).
|
||||
# It seems that currently the only working option is to set a prefix in the openssl build
|
||||
# and use the `--with-ssl=...` option in libcurl.
|
||||
# Additionally, pkg-config needs to be installed and openssl libs need to NOT be installed on the build system.
|
||||
|
||||
libopenssl: $(OPENSSL).tar.gz
|
||||
tar -zxvf $(OPENSSL).tar.gz
|
||||
cd $(OPENSSL) && ./config --prefix=$(DESTDIR)/usr/local no-shared no-ssl3-method no-dynamic-engine '-Wa,--noexecstack'
|
||||
$(MAKE) -C $(OPENSSL) depend
|
||||
$(MAKE) -C $(OPENSSL) -j$(NPROC)
|
||||
$(MAKE) -C $(OPENSSL) install_sw
|
||||
|
||||
$(OPENSSL).tar.gz:
|
||||
curl -L -o $@ 'https://github.com/openssl/openssl/archive/OpenSSL_1_1_0g.tar.gz'
|
||||
|
||||
|
||||
|
||||
libcurl: libopenssl $(CURL).tar.gz
|
||||
tar -zxvf $(CURL).tar.gz
|
||||
cd $(CURL) && ./configure \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--with-ssl=$(DESTDIR)/usr/local \
|
||||
--with-pic \
|
||||
--enable-ipv6 \
|
||||
--enable-versioned-symbols \
|
||||
--enable-threaded-resolver \
|
||||
--with-random=/dev/urandom \
|
||||
--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
|
||||
--disable-ldap \
|
||||
--disable-ldaps \
|
||||
--disable-manual \
|
||||
--disable-rtsp \
|
||||
--disable-dict \
|
||||
--disable-telnet \
|
||||
--disable-pop3 \
|
||||
--disable-imap \
|
||||
--disable-smb \
|
||||
--disable-smtp \
|
||||
--disable-gopher \
|
||||
--disable-crypto-auth \
|
||||
--without-gssapi \
|
||||
--without-libpsl \
|
||||
--without-libidn2 \
|
||||
--without-gnutls \
|
||||
--without-polarssl \
|
||||
--without-mbedtls \
|
||||
--without-cyassl \
|
||||
--without-nss \
|
||||
--without-axtls \
|
||||
--without-brotli \
|
||||
--without-libmetalink \
|
||||
--without-libssh \
|
||||
--without-libssh2 \
|
||||
--without-librtmp \
|
||||
--without-nghttp2 \
|
||||
--without-zsh-functions-dir
|
||||
$(MAKE) -C $(CURL) -j$(NPROC)
|
||||
$(MAKE) -C $(CURL) install DESTDIR=$(DESTDIR)
|
||||
|
||||
$(CURL).tar.gz:
|
||||
curl -L -o $@ https://curl.haxx.se/download/$@
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf $(BOOST) $(BOOST).tar.gz $(TBB) $(TBB).tar.gz $(OPENSSL) $(OPENSSL).tar.gz $(CURL) $(CURL).tar.gz
|
@ -1,141 +0,0 @@
|
||||
#!powershell
|
||||
#
|
||||
# This script downloads, configures and builds Slic3r PE dependencies for Unix.
|
||||
# (That is, all dependencies except perl + wxWidgets.)
|
||||
#
|
||||
# To use this script, launch the Visual Studio command line,
|
||||
# `cd` into the directory containing this script and use this command:
|
||||
#
|
||||
# powershell .\slic3r-makedeps.ps1
|
||||
#
|
||||
# The dependencies will be downloaded and unpacked into the current dir.
|
||||
# This script WILL NOT try to guess the build architecture (64 vs 32 bits),
|
||||
# it will by default build the 64-bit variant. To build the 32-bit variant, use:
|
||||
#
|
||||
# powershell .\slic3r-makedeps.ps1 -b32
|
||||
#
|
||||
# Built libraries are installed into $destdir,
|
||||
# which by default is C:\local\slic3r-destdir-$bits
|
||||
# You can customize the $destdir using:
|
||||
#
|
||||
# powershell .\slic3r-makedeps.ps1 -destdir C:\foo\bar
|
||||
#
|
||||
# To pass the $destdir path along to cmake, set the use CMAKE_PREFIX_PATH variable
|
||||
# and set it to $destdir\usr\local
|
||||
#
|
||||
# Script requirements: PowerShell 3.0, .NET 4.5
|
||||
#
|
||||
|
||||
|
||||
param(
|
||||
[switch]$b32 = $false,
|
||||
[string]$destdir = ""
|
||||
)
|
||||
|
||||
if ($destdir -eq "") {
|
||||
$destdir = "C:\local\slic3r-destdir-" + ('32', '64')[!$b32]
|
||||
}
|
||||
|
||||
$BOOST = 'boost_1_63_0'
|
||||
$CURL = 'curl-7.58.0'
|
||||
$TBB_SHA = 'a0dc9bf76d0120f917b641ed095360448cabc85b'
|
||||
$TBB = "tbb-$TBB_SHA"
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
# Set up various settings and utilities:
|
||||
[Environment]::CurrentDirectory = Get-Location
|
||||
$NPROC = (Get-WmiObject -class Win32_processor).NumberOfLogicalProcessors
|
||||
Add-Type -A System.IO.Compression.FileSystem
|
||||
# This fxies SSL/TLS errors, credit goes to Ansible; see their `win_get_url.ps1` file
|
||||
$security_protcols = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::SystemDefault
|
||||
if ([Net.SecurityProtocolType].GetMember('Tls11').Count -gt 0) {
|
||||
$security_protcols = $security_protcols -bor [Net.SecurityProtocolType]::Tls11
|
||||
}
|
||||
if ([Net.SecurityProtocolType].GetMember('Tls12').Count -gt 0) {
|
||||
$security_protcols = $security_protcols -bor [Net.SecurityProtocolType]::Tls12
|
||||
}
|
||||
[Net.ServicePointManager]::SecurityProtocol = $security_protcols
|
||||
$webclient = New-Object System.Net.WebClient
|
||||
|
||||
|
||||
# Ensure DESTDIR exists:
|
||||
mkdir $destdir -ea 0
|
||||
mkdir "$destdir\usr\local" -ea 0
|
||||
|
||||
|
||||
# Download sources:
|
||||
echo 'Downloading sources ...'
|
||||
if (!(Test-Path "$BOOST.zip")) { $webclient.DownloadFile("https://dl.bintray.com/boostorg/release/1.63.0/source/$BOOST.zip", "$BOOST.zip") }
|
||||
if (!(Test-Path "$TBB.zip")) { $webclient.DownloadFile("https://github.com/wjakob/tbb/archive/$TBB_SHA.zip", "$TBB.zip") }
|
||||
if (!(Test-Path "$CURL.zip")) { $webclient.DownloadFile("https://curl.haxx.se/download/$CURL.zip", ".\$CURL.zip") }
|
||||
|
||||
|
||||
# Unpack sources:
|
||||
echo 'Unpacking ...'
|
||||
if (!(Test-Path $BOOST)) { [IO.Compression.ZipFile]::ExtractToDirectory("$BOOST.zip", '.') }
|
||||
if (!(Test-Path $TBB)) { [IO.Compression.ZipFile]::ExtractToDirectory("$TBB.zip", '.') }
|
||||
if (!(Test-Path $CURL)) { [IO.Compression.ZipFile]::ExtractToDirectory("$CURL.zip", '.') }
|
||||
|
||||
|
||||
# Build libraries:
|
||||
echo 'Building ...'
|
||||
|
||||
# Build boost
|
||||
pushd "$BOOST"
|
||||
.\bootstrap
|
||||
$adr_mode = ('32', '64')[!$b32]
|
||||
.\b2 `
|
||||
-j "$NPROC" `
|
||||
--with-system `
|
||||
--with-filesystem `
|
||||
--with-thread `
|
||||
--with-log `
|
||||
--with-locale `
|
||||
--with-regex `
|
||||
"--prefix=$destdir/usr/local" `
|
||||
"address-model=$adr_mode" `
|
||||
toolset=msvc-12.0 `
|
||||
link=static `
|
||||
variant=release `
|
||||
threading=multi `
|
||||
boost.locale.icu=off `
|
||||
install
|
||||
popd
|
||||
|
||||
# Build TBB
|
||||
pushd "$TBB"
|
||||
mkdir 'mybuild' -ea 0
|
||||
cd 'mybuild'
|
||||
$generator = ('Visual Studio 12', 'Visual Studio 12 Win64')[!$b32]
|
||||
cmake .. `
|
||||
-G "$generator" `
|
||||
-DCMAKE_CONFIGURATION_TYPES=Release `
|
||||
-DTBB_BUILD_SHARED=OFF `
|
||||
-DTBB_BUILD_TESTS=OFF "-DCMAKE_INSTALL_PREFIX:PATH=$destdir\usr\local"
|
||||
msbuild /P:Configuration=Release INSTALL.vcxproj
|
||||
popd
|
||||
|
||||
# Build libcurl:
|
||||
pushd "$CURL\winbuild"
|
||||
$machine = ("x86", "x64")[!$b32]
|
||||
nmake /f Makefile.vc mode=static VC=12 GEN_PDB=yes DEBUG=no "MACHINE=$machine"
|
||||
Copy-Item -R -Force ..\builds\libcurl-*-winssl\include\* "$destdir\usr\local\include\"
|
||||
Copy-Item -R -Force ..\builds\libcurl-*-winssl\lib\* "$destdir\usr\local\lib\"
|
||||
popd
|
||||
|
||||
|
||||
echo ""
|
||||
echo "All done!"
|
||||
echo ""
|
||||
|
||||
|
||||
}
|
||||
catch [Exception]
|
||||
{
|
||||
# This prints errors in a verbose manner
|
||||
echo $_.Exception|format-list -force
|
||||
}
|
@ -41,6 +41,7 @@ our $PROCESS_COMPLETED_EVENT = Wx::NewEventType;
|
||||
my $PreventListEvents = 0;
|
||||
our $appController;
|
||||
|
||||
# XXX: VK: done, except callback handling and timer
|
||||
sub new {
|
||||
my ($class, $parent, %params) = @_;
|
||||
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||
@ -144,18 +145,104 @@ sub new {
|
||||
$self->schedule_background_process;
|
||||
};
|
||||
|
||||
# callback to react to gizmo scale
|
||||
my $on_gizmo_scale_3D = sub {
|
||||
my ($scale_x, $scale_y, $scale_z) = @_;
|
||||
|
||||
my ($obj_idx, $object) = $self->selected_object;
|
||||
return if !defined $obj_idx;
|
||||
|
||||
my $model_object = $self->{model}->objects->[$obj_idx];
|
||||
my $model_instance = $model_object->instances->[0];
|
||||
|
||||
$self->stop_background_process;
|
||||
|
||||
#FIXME Scale the layer height profile?
|
||||
# my $variation = $scale / $model_instance->scaling_factor;
|
||||
# foreach my $range (@{ $model_object->layer_height_ranges }) {
|
||||
# $range->[0] *= $variation;
|
||||
# $range->[1] *= $variation;
|
||||
# }
|
||||
|
||||
my $scale = Slic3r::Pointf3->new($scale_x, $scale_y, $scale_z);
|
||||
foreach my $inst (@{ $model_object->instances }) {
|
||||
$inst->set_scaling_factors($scale);
|
||||
}
|
||||
Slic3r::GUI::_3DScene::update_gizmos_data($self->{canvas3D}) if ($self->{canvas3D});
|
||||
|
||||
#update print and start background processing
|
||||
$self->{print}->add_model_object($model_object, $obj_idx);
|
||||
|
||||
$self->selection_changed(1); # refresh info (size, volume etc.)
|
||||
$self->update;
|
||||
$self->schedule_background_process;
|
||||
|
||||
};
|
||||
|
||||
# callback to react to gizmo rotate
|
||||
my $on_gizmo_rotate = sub {
|
||||
my ($angle) = @_;
|
||||
$self->rotate(rad2deg($angle), Z, 'absolute');
|
||||
};
|
||||
|
||||
# callback to react to gizmo rotate
|
||||
my $on_gizmo_rotate_3D = sub {
|
||||
my ($angle_x, $angle_y, $angle_z) = @_;
|
||||
|
||||
my ($obj_idx, $object) = $self->selected_object;
|
||||
return if !defined $obj_idx;
|
||||
|
||||
my $model_object = $self->{model}->objects->[$obj_idx];
|
||||
my $model_instance = $model_object->instances->[0];
|
||||
|
||||
$self->stop_background_process;
|
||||
|
||||
my $rotation = Slic3r::Pointf3->new($angle_x, $angle_y, $angle_z);
|
||||
foreach my $inst (@{ $model_object->instances }) {
|
||||
$inst->set_rotations($rotation);
|
||||
}
|
||||
Slic3r::GUI::_3DScene::update_gizmos_data($self->{canvas3D}) if ($self->{canvas3D});
|
||||
|
||||
# update print and start background processing
|
||||
$self->{print}->add_model_object($model_object, $obj_idx);
|
||||
|
||||
$self->selection_changed; # refresh info (size etc.)
|
||||
$self->update;
|
||||
$self->schedule_background_process;
|
||||
};
|
||||
|
||||
# callback to react to gizmo flatten
|
||||
my $on_gizmo_flatten = sub {
|
||||
my ($angle, $axis_x, $axis_y, $axis_z) = @_;
|
||||
$self->rotate(rad2deg($angle), undef, 'absolute', $axis_x, $axis_y, $axis_z) if $angle != 0;
|
||||
};
|
||||
|
||||
# callback to react to gizmo flatten
|
||||
my $on_gizmo_flatten_3D = sub {
|
||||
my ($angle_x, $angle_y, $angle_z) = @_;
|
||||
|
||||
my ($obj_idx, $object) = $self->selected_object;
|
||||
return if !defined $obj_idx;
|
||||
|
||||
my $model_object = $self->{model}->objects->[$obj_idx];
|
||||
my $model_instance = $model_object->instances->[0];
|
||||
|
||||
$self->stop_background_process;
|
||||
|
||||
my $rotation = Slic3r::Pointf3->new($angle_x, $angle_y, $angle_z);
|
||||
foreach my $inst (@{ $model_object->instances }) {
|
||||
$inst->set_rotations($rotation);
|
||||
}
|
||||
Slic3r::GUI::_3DScene::update_gizmos_data($self->{canvas3D}) if ($self->{canvas3D});
|
||||
|
||||
# update print and start background processing
|
||||
$self->{print}->add_model_object($model_object, $obj_idx);
|
||||
|
||||
$self->selection_changed; # refresh info (size etc.)
|
||||
$self->update;
|
||||
$self->schedule_background_process;
|
||||
};
|
||||
|
||||
# callback to update object's geometry info while using gizmos
|
||||
my $on_update_geometry_info = sub {
|
||||
my ($size_x, $size_y, $size_z, $scale_factor) = @_;
|
||||
@ -171,6 +258,21 @@ sub new {
|
||||
}
|
||||
};
|
||||
|
||||
# callback to update object's geometry info while using gizmos
|
||||
my $on_update_geometry_3D_info = sub {
|
||||
my ($size_x, $size_y, $size_z, $scale_x, $scale_y, $scale_z) = @_;
|
||||
|
||||
my ($obj_idx, $object) = $self->selected_object;
|
||||
|
||||
if ((defined $obj_idx) && ($self->{object_info_size})) { # have we already loaded the info pane?
|
||||
$self->{object_info_size}->SetLabel(sprintf("%.2f x %.2f x %.2f", $size_x, $size_y, $size_z));
|
||||
my $model_object = $self->{model}->objects->[$obj_idx];
|
||||
if (my $stats = $model_object->mesh_stats) {
|
||||
$self->{object_info_volume}->SetLabel(sprintf('%.2f', $stats->{volume} * $scale_x * $scale_y * $scale_z));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
# callbacks for toolbar
|
||||
my $on_action_add = sub {
|
||||
$self->add;
|
||||
@ -260,9 +362,13 @@ sub new {
|
||||
Slic3r::GUI::_3DScene::register_on_instance_moved_callback($self->{canvas3D}, $on_instances_moved);
|
||||
Slic3r::GUI::_3DScene::register_on_enable_action_buttons_callback($self->{canvas3D}, $enable_action_buttons);
|
||||
Slic3r::GUI::_3DScene::register_on_gizmo_scale_uniformly_callback($self->{canvas3D}, $on_gizmo_scale_uniformly);
|
||||
Slic3r::GUI::_3DScene::register_on_gizmo_scale_3D_callback($self->{canvas3D}, $on_gizmo_scale_3D);
|
||||
Slic3r::GUI::_3DScene::register_on_gizmo_rotate_callback($self->{canvas3D}, $on_gizmo_rotate);
|
||||
Slic3r::GUI::_3DScene::register_on_gizmo_rotate_3D_callback($self->{canvas3D}, $on_gizmo_rotate_3D);
|
||||
Slic3r::GUI::_3DScene::register_on_gizmo_flatten_callback($self->{canvas3D}, $on_gizmo_flatten);
|
||||
Slic3r::GUI::_3DScene::register_on_gizmo_flatten_3D_callback($self->{canvas3D}, $on_gizmo_flatten_3D);
|
||||
Slic3r::GUI::_3DScene::register_on_update_geometry_info_callback($self->{canvas3D}, $on_update_geometry_info);
|
||||
Slic3r::GUI::_3DScene::register_on_update_geometry_3D_info_callback($self->{canvas3D}, $on_update_geometry_3D_info);
|
||||
Slic3r::GUI::_3DScene::register_action_add_callback($self->{canvas3D}, $on_action_add);
|
||||
Slic3r::GUI::_3DScene::register_action_delete_callback($self->{canvas3D}, $on_action_delete);
|
||||
Slic3r::GUI::_3DScene::register_action_deleteall_callback($self->{canvas3D}, $on_action_deleteall);
|
||||
@ -296,29 +402,42 @@ sub new {
|
||||
}
|
||||
});
|
||||
|
||||
Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{canvas3D}, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{preview3D}->canvas, $self->{canvas3D}); });
|
||||
Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{canvas3D},
|
||||
sub {
|
||||
$self->{preview_iface}->set_viewport_from_scene($self->{canvas3D});
|
||||
});
|
||||
# Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{canvas3D}, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{preview3D}->canvas, $self->{canvas3D}); });
|
||||
}
|
||||
|
||||
Slic3r::GUI::register_on_request_update_callback(sub { $self->schedule_background_process; });
|
||||
|
||||
# Initialize 3D toolpaths preview
|
||||
if ($Slic3r::GUI::have_OpenGL) {
|
||||
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print}, $self->{gcode_preview_data}, $self->{config});
|
||||
Slic3r::GUI::_3DScene::enable_legend_texture($self->{preview3D}->canvas, 1);
|
||||
Slic3r::GUI::_3DScene::enable_dynamic_background($self->{preview3D}->canvas, 1);
|
||||
Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{preview3D}->canvas, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{canvas3D}, $self->{preview3D}->canvas); });
|
||||
$self->{preview_notebook}->AddPage($self->{preview3D}, L('Preview'));
|
||||
$self->{preview_iface} = Slic3r::GUI::create_preview_iface($self->{preview_notebook}, $self->{config}, $self->{print}, $self->{gcode_preview_data});
|
||||
$self->{preview_page_idx} = $self->{preview_notebook}->GetPageCount-1;
|
||||
$self->{preview_iface}->register_on_viewport_changed_callback(sub { $self->{preview_iface}->set_viewport_into_scene($self->{canvas3D}); });
|
||||
# $self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print}, $self->{gcode_preview_data}, $self->{config});
|
||||
# Slic3r::GUI::_3DScene::enable_legend_texture($self->{preview3D}->canvas, 1);
|
||||
# Slic3r::GUI::_3DScene::enable_dynamic_background($self->{preview3D}->canvas, 1);
|
||||
# Slic3r::GUI::_3DScene::register_on_viewport_changed_callback($self->{preview3D}->canvas, sub { Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{canvas3D}, $self->{preview3D}->canvas); });
|
||||
# $self->{preview_notebook}->AddPage($self->{preview3D}, L('Preview'));
|
||||
$self->{preview3D_page_idx} = $self->{preview_notebook}->GetPageCount-1;
|
||||
}
|
||||
|
||||
EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{preview_notebook}, sub {
|
||||
my $preview = $self->{preview_notebook}->GetCurrentPage;
|
||||
if (($preview != $self->{preview3D}) && ($preview != $self->{canvas3D})) {
|
||||
my $page_id = $self->{preview_notebook}->GetSelection;
|
||||
if (($preview != $self->{canvas3D}) && ($page_id != $self->{preview_page_idx})) {
|
||||
# if (($preview != $self->{preview3D}) && ($preview != $self->{canvas3D})) {
|
||||
$preview->OnActivate if $preview->can('OnActivate');
|
||||
} elsif ($preview == $self->{preview3D}) {
|
||||
$self->{preview3D}->reload_print;
|
||||
} elsif ($page_id == $self->{preview_page_idx}) {
|
||||
$self->{preview_iface}->reload_print;
|
||||
# sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
|
||||
Slic3r::GUI::_3DScene::set_as_dirty($self->{preview3D}->canvas);
|
||||
$self->{preview_iface}->set_canvas_as_dirty;
|
||||
# } elsif ($preview == $self->{preview3D}) {
|
||||
# $self->{preview3D}->reload_print;
|
||||
# # sets the canvas as dirty to force a render at the 1st idle event (wxWidgets IsShownOnScreen() is buggy and cannot be used reliably)
|
||||
# Slic3r::GUI::_3DScene::set_as_dirty($self->{preview3D}->canvas);
|
||||
} elsif ($preview == $self->{canvas3D}) {
|
||||
if (Slic3r::GUI::_3DScene::is_reload_delayed($self->{canvas3D})) {
|
||||
my $selections = $self->collect_selections;
|
||||
@ -461,7 +580,8 @@ sub new {
|
||||
|
||||
$_->SetDropTarget(Slic3r::GUI::Plater::DropTarget->new($self))
|
||||
for grep defined($_),
|
||||
$self, $self->{canvas3D}, $self->{preview3D}, $self->{list};
|
||||
$self, $self->{canvas3D}, $self->{preview_iface}, $self->{list};
|
||||
# $self, $self->{canvas3D}, $self->{preview3D}, $self->{list};
|
||||
# $self, $self->{canvas}, $self->{canvas3D}, $self->{preview3D};
|
||||
|
||||
EVT_COMMAND($self, -1, $SLICING_COMPLETED_EVENT, sub {
|
||||
@ -474,6 +594,7 @@ sub new {
|
||||
$self->on_process_completed($event->GetInt ? undef : $event->GetString);
|
||||
});
|
||||
|
||||
# XXX: not done
|
||||
{
|
||||
my $timer_id = Wx::NewId();
|
||||
$self->{apply_config_timer} = Wx::Timer->new($self, $timer_id);
|
||||
@ -488,9 +609,10 @@ sub new {
|
||||
Slic3r::GUI::_3DScene::set_bed_shape($self->{canvas3D}, $self->{config}->bed_shape);
|
||||
Slic3r::GUI::_3DScene::zoom_to_bed($self->{canvas3D});
|
||||
}
|
||||
if ($self->{preview3D}) {
|
||||
Slic3r::GUI::_3DScene::set_bed_shape($self->{preview3D}->canvas, $self->{config}->bed_shape);
|
||||
}
|
||||
$self->{preview_iface}->set_bed_shape($self->{config}->bed_shape) if ($self->{preview_iface});
|
||||
# if ($self->{preview3D}) {
|
||||
# Slic3r::GUI::_3DScene::set_bed_shape($self->{preview3D}->canvas, $self->{config}->bed_shape);
|
||||
# }
|
||||
$self->update;
|
||||
|
||||
{
|
||||
@ -692,12 +814,14 @@ sub new {
|
||||
return $self;
|
||||
}
|
||||
|
||||
# XXX: VK: WIP
|
||||
# sets the callback
|
||||
sub on_select_preset {
|
||||
my ($self, $cb) = @_;
|
||||
$self->{on_select_preset} = $cb;
|
||||
}
|
||||
|
||||
# XXX: merged with on_select_preset
|
||||
# Called from the platter combo boxes selecting the active print, filament or printer.
|
||||
sub _on_select_preset {
|
||||
my ($self, $group, $choice, $idx) = @_;
|
||||
@ -734,6 +858,7 @@ sub _on_select_preset {
|
||||
$self->on_config_change(wxTheApp->{preset_bundle}->full_config);
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub on_layer_editing_toggled {
|
||||
my ($self, $new_state) = @_;
|
||||
Slic3r::GUI::_3DScene::enable_layers_editing($self->{canvas3D}, $new_state);
|
||||
@ -752,11 +877,13 @@ sub on_layer_editing_toggled {
|
||||
$self->{canvas3D}->Update;
|
||||
}
|
||||
|
||||
# XXX: VK: done (Plater::priv::main_frame)
|
||||
sub GetFrame {
|
||||
my ($self) = @_;
|
||||
return &Wx::GetTopLevelParent($self);
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# Called after the Preferences dialog is closed and the program settings are saved.
|
||||
# Update the UI based on the current preferences.
|
||||
sub update_ui_from_settings
|
||||
@ -768,6 +895,7 @@ sub update_ui_from_settings
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
# Update preset combo boxes (Print settings, Filament, Material, Printer) from their respective tabs.
|
||||
# Called by
|
||||
# Slic3r::GUI::Tab::Print::_on_presets_changed
|
||||
@ -813,12 +941,14 @@ sub update_presets {
|
||||
wxTheApp->{preset_bundle}->export_selections(wxTheApp->{app_config});
|
||||
}
|
||||
|
||||
# XXX: VK: done, in on_action_add()
|
||||
sub add {
|
||||
my ($self) = @_;
|
||||
my @input_files = wxTheApp->open_model($self);
|
||||
$self->load_files(\@input_files);
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub load_files {
|
||||
my ($self, $input_files) = @_;
|
||||
|
||||
@ -840,7 +970,7 @@ sub load_files {
|
||||
# Object indices for the UI.
|
||||
my @obj_idx = ();
|
||||
# Collected file names to display the final message on the status bar.
|
||||
my @loaded_files = ();
|
||||
my @loaded_files = (); # XXX: used???
|
||||
# For all input files.
|
||||
for (my $i = 0; $i < @$input_files; $i += 1) {
|
||||
my $input_file = $input_files->[$i];
|
||||
@ -876,7 +1006,7 @@ sub load_files {
|
||||
|
||||
# objects imported from 3mf require a call to center_around_origin to have gizmos working properly and this call
|
||||
# need to be done after looks_like_multipart_object detection
|
||||
if ($input_file =~ /.3[mM][fF]$/)
|
||||
if ($input_file =~ /[.]3[mM][fF]$/)
|
||||
{
|
||||
foreach my $model_object (@{$model->objects}) {
|
||||
$model_object->center_around_origin; # also aligns object to Z = 0
|
||||
@ -909,6 +1039,7 @@ sub load_files {
|
||||
return @obj_idx;
|
||||
}
|
||||
|
||||
# XXX: VK: done, except a few todos
|
||||
sub load_model_objects {
|
||||
my ($self, @model_objects) = @_;
|
||||
|
||||
@ -991,6 +1122,7 @@ sub load_model_objects {
|
||||
return @obj_idx;
|
||||
}
|
||||
|
||||
# XXX: Removed, replaced with bed_shape_bb()
|
||||
sub bed_centerf {
|
||||
my ($self) = @_;
|
||||
|
||||
@ -999,13 +1131,15 @@ sub bed_centerf {
|
||||
return Slic3r::Pointf->new(unscale($bed_center->x), unscale($bed_center->y)); #)
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub remove {
|
||||
my ($self, $obj_idx) = @_;
|
||||
|
||||
$self->stop_background_process;
|
||||
|
||||
# Prevent toolpaths preview from rendering while we modify the Print object
|
||||
$self->{preview3D}->enabled(0) if $self->{preview3D};
|
||||
$self->{preview_iface}->set_enabled(0) if $self->{preview_iface};
|
||||
# $self->{preview3D}->enabled(0) if $self->{preview3D};
|
||||
|
||||
# If no object index is supplied, remove the selected one.
|
||||
if (! defined $obj_idx) {
|
||||
@ -1024,13 +1158,15 @@ sub remove {
|
||||
$self->update;
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub reset {
|
||||
my ($self) = @_;
|
||||
|
||||
$self->stop_background_process;
|
||||
|
||||
# Prevent toolpaths preview from rendering while we modify the Print object
|
||||
$self->{preview3D}->enabled(0) if $self->{preview3D};
|
||||
$self->{preview_iface}->set_enabled(0) if $self->{preview_iface};
|
||||
# $self->{preview3D}->enabled(0) if $self->{preview3D};
|
||||
|
||||
@{$self->{objects}} = ();
|
||||
$self->{model}->clear_objects;
|
||||
@ -1043,6 +1179,7 @@ sub reset {
|
||||
$self->update;
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub increase {
|
||||
my ($self, $copies) = @_;
|
||||
$copies //= 1;
|
||||
@ -1074,6 +1211,7 @@ sub increase {
|
||||
$self->schedule_background_process;
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub decrease {
|
||||
my ($self, $copies_asked) = @_;
|
||||
my $copies = $copies_asked // 1;
|
||||
@ -1101,6 +1239,7 @@ sub decrease {
|
||||
$self->update;
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub set_number_of_copies {
|
||||
my ($self) = @_;
|
||||
# get current number of copies
|
||||
@ -1119,6 +1258,7 @@ sub set_number_of_copies {
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: VK: removed
|
||||
sub _get_number_from_user {
|
||||
my ($self, $title, $prompt_message, $error_message, $default, $only_positive) = @_;
|
||||
for (;;) {
|
||||
@ -1141,6 +1281,7 @@ sub _get_number_from_user {
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
sub rotate {
|
||||
my ($self, $angle, $axis, $relative_key, $axis_x, $axis_y, $axis_z) = @_;
|
||||
$relative_key //= 'absolute'; # relative or absolute coordinates
|
||||
@ -1211,6 +1352,7 @@ sub rotate {
|
||||
$self->update;
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
sub mirror {
|
||||
my ($self, $axis) = @_;
|
||||
|
||||
@ -1240,6 +1382,7 @@ sub mirror {
|
||||
$self->update;
|
||||
}
|
||||
|
||||
# XXX: not done, renamed as Plater::priv::scale()
|
||||
sub changescale {
|
||||
my ($self, $axis, $tosize) = @_;
|
||||
|
||||
@ -1314,6 +1457,7 @@ sub changescale {
|
||||
$self->update;
|
||||
}
|
||||
|
||||
# XXX: VK: WIP
|
||||
sub arrange {
|
||||
my ($self) = @_;
|
||||
|
||||
@ -1331,6 +1475,7 @@ sub arrange {
|
||||
$self->update(0);
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
sub split_object {
|
||||
my $self = shift;
|
||||
|
||||
@ -1362,6 +1507,7 @@ sub split_object {
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# Trigger $self->async_apply_config() after 500ms.
|
||||
# The call is delayed to avoid restarting the background processing during typing into an edit field.
|
||||
sub schedule_background_process {
|
||||
@ -1369,6 +1515,7 @@ sub schedule_background_process {
|
||||
$self->{apply_config_timer}->Start(0.5 * 1000, 1); # 1 = one shot, every half a second.
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# Executed asynchronously by a timer every PROCESS_DELAY (0.5 second).
|
||||
# The timer is started by schedule_background_process(),
|
||||
sub async_apply_config {
|
||||
@ -1391,7 +1538,8 @@ sub async_apply_config {
|
||||
# Reset preview canvases. If the print has been invalidated, the preview canvases will be cleared.
|
||||
# Otherwise they will be just refreshed.
|
||||
$self->{gcode_preview_data}->reset;
|
||||
$self->{preview3D}->reload_print if $self->{preview3D};
|
||||
$self->{preview_iface}->reload_print if $self->{preview_iface};
|
||||
# $self->{preview3D}->reload_print if $self->{preview3D};
|
||||
# We also need to reload 3D scene because of the wipe tower preview box
|
||||
if ($self->{config}->wipe_tower) {
|
||||
my $selections = $self->collect_selections;
|
||||
@ -1402,6 +1550,7 @@ sub async_apply_config {
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# Background processing is started either by the "Slice now" button, by the "Export G-code button" or by async_apply_config().
|
||||
sub start_background_process {
|
||||
my ($self) = @_;
|
||||
@ -1422,13 +1571,16 @@ sub start_background_process {
|
||||
$self->{background_slicing_process}->start;
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# Stop the background processing
|
||||
sub stop_background_process {
|
||||
my ($self) = @_;
|
||||
$self->{background_slicing_process}->stop();
|
||||
$self->{preview3D}->reload_print if $self->{preview3D};
|
||||
$self->{preview_iface}->reload_print if $self->{preview_iface};
|
||||
# $self->{preview3D}->reload_print if $self->{preview3D};
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# Called by the "Slice now" button, which is visible only if the background processing is disabled.
|
||||
sub reslice {
|
||||
# explicitly cancel a previous thread and start a new one.
|
||||
@ -1449,6 +1601,7 @@ sub reslice {
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub export_gcode {
|
||||
my ($self, $output_file) = @_;
|
||||
|
||||
@ -1529,10 +1682,12 @@ sub export_gcode {
|
||||
return $self->{export_gcode_output_file};
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# This message should be called by the background process synchronously.
|
||||
sub on_update_print_preview {
|
||||
my ($self) = @_;
|
||||
$self->{preview3D}->reload_print if $self->{preview3D};
|
||||
$self->{preview_iface}->reload_print if $self->{preview_iface};
|
||||
# $self->{preview3D}->reload_print if $self->{preview3D};
|
||||
|
||||
# in case this was MM print, wipe tower bounding box on 3D tab might need redrawing with exact depth:
|
||||
my $selections = $self->collect_selections;
|
||||
@ -1540,6 +1695,7 @@ sub on_update_print_preview {
|
||||
Slic3r::GUI::_3DScene::reload_scene($self->{canvas3D}, 1);
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# This gets called also if we have no threads.
|
||||
sub on_progress_event {
|
||||
my ($self, $percent, $message) = @_;
|
||||
@ -1550,6 +1706,7 @@ sub on_progress_event {
|
||||
$self->statusbar->SetStatusText("$message...");
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# Called when the G-code export finishes, either successfully or with an error.
|
||||
# This gets called also if we don't have threads.
|
||||
sub on_process_completed {
|
||||
@ -1613,9 +1770,11 @@ sub on_process_completed {
|
||||
$self->object_list_changed;
|
||||
|
||||
# refresh preview
|
||||
$self->{preview3D}->reload_print if $self->{preview3D};
|
||||
$self->{preview_iface}->reload_print if $self->{preview_iface};
|
||||
# $self->{preview3D}->reload_print if $self->{preview3D};
|
||||
}
|
||||
|
||||
# XXX: partially done in the Sidebar
|
||||
# Fill in the "Sliced info" box with the result of the G-code generator.
|
||||
sub print_info_box_show {
|
||||
my ($self, $show) = @_;
|
||||
@ -1690,9 +1849,9 @@ sub print_info_box_show {
|
||||
|
||||
$self->Layout;
|
||||
$panel->Refresh;
|
||||
$self->Layout;
|
||||
}
|
||||
|
||||
# XXX: not done - to be removed
|
||||
sub do_print {
|
||||
my ($self) = @_;
|
||||
|
||||
@ -1706,6 +1865,7 @@ sub do_print {
|
||||
$printer_panel->load_print_job($self->{print_file}, $filament_stats);
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub export_stl {
|
||||
my ($self) = @_;
|
||||
return if !@{$self->{objects}};
|
||||
@ -1716,6 +1876,7 @@ sub export_stl {
|
||||
$self->statusbar->SetStatusText(L("STL file exported to ").$output_file);
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub reload_from_disk {
|
||||
my ($self) = @_;
|
||||
|
||||
@ -1747,6 +1908,7 @@ sub reload_from_disk {
|
||||
$self->remove($obj_idx);
|
||||
}
|
||||
|
||||
# XXX: VK: integrated into Plater::export_stl()
|
||||
sub export_object_stl {
|
||||
my ($self) = @_;
|
||||
my ($obj_idx, $object) = $self->selected_object;
|
||||
@ -1758,6 +1920,7 @@ sub export_object_stl {
|
||||
$self->statusbar->SetStatusText(L("STL file exported to ").$output_file);
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
sub fix_through_netfabb {
|
||||
my ($self) = @_;
|
||||
my ($obj_idx, $object) = $self->selected_object;
|
||||
@ -1786,6 +1949,7 @@ sub fix_through_netfabb {
|
||||
$self->remove($obj_idx);
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub export_amf {
|
||||
my ($self) = @_;
|
||||
return if !@{$self->{objects}};
|
||||
@ -1802,6 +1966,7 @@ sub export_amf {
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub export_3mf {
|
||||
my ($self) = @_;
|
||||
return if !@{$self->{objects}};
|
||||
@ -1818,6 +1983,7 @@ sub export_3mf {
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
# Ask user to select an output file for a given file format (STl, AMF, 3MF).
|
||||
# Propose a default file name based on the 'output_filename_format' configuration value.
|
||||
sub _get_export_file {
|
||||
@ -1867,6 +2033,7 @@ sub _get_export_file {
|
||||
# $self->{objects}[$obj_idx]->thumbnail(undef);
|
||||
#}
|
||||
|
||||
# XXX: VK: done
|
||||
# this method gets called whenever print center is changed or the objects' bounding box changes
|
||||
# (i.e. when an object is added/removed/moved/rotated/scaled)
|
||||
sub update {
|
||||
@ -1882,12 +2049,15 @@ sub update {
|
||||
my $selections = $self->collect_selections;
|
||||
Slic3r::GUI::_3DScene::set_objects_selections($self->{canvas3D}, \@$selections);
|
||||
Slic3r::GUI::_3DScene::reload_scene($self->{canvas3D}, 0);
|
||||
$self->{preview3D}->reset_gcode_preview_data if $self->{preview3D};
|
||||
$self->{preview3D}->reload_print if $self->{preview3D};
|
||||
$self->{preview_iface}->reset_gcode_preview_data if $self->{preview_iface};
|
||||
$self->{preview_iface}->reload_print if $self->{preview_iface};
|
||||
# $self->{preview3D}->reset_gcode_preview_data if $self->{preview3D};
|
||||
# $self->{preview3D}->reload_print if $self->{preview3D};
|
||||
$self->schedule_background_process;
|
||||
$self->Thaw;
|
||||
}
|
||||
|
||||
# XXX: YS: done
|
||||
# When a printer technology is changed, the UI needs to be updated to show/hide needed preset combo boxes.
|
||||
sub show_preset_comboboxes{
|
||||
my ($self, $showSLA) = @_; #if showSLA is oposite value to "ptFFF"
|
||||
@ -1906,6 +2076,7 @@ sub show_preset_comboboxes{
|
||||
$self->Layout;
|
||||
}
|
||||
|
||||
# XXX: YS: done
|
||||
# When a number of extruders changes, the UI needs to be updated to show a single filament selection combo box per extruder.
|
||||
# Also the wxTheApp->{preset_bundle}->filament_presets needs to be resized accordingly
|
||||
# and some reasonable default has to be selected for the additional extruders.
|
||||
@ -1950,6 +2121,7 @@ sub on_extruders_change {
|
||||
$self->Layout;
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
sub on_config_change {
|
||||
my ($self, $config) = @_;
|
||||
|
||||
@ -1959,7 +2131,8 @@ sub on_config_change {
|
||||
if ($opt_key eq 'bed_shape') {
|
||||
# $self->{canvas}->update_bed_size;
|
||||
Slic3r::GUI::_3DScene::set_bed_shape($self->{canvas3D}, $self->{config}->bed_shape) if $self->{canvas3D};
|
||||
Slic3r::GUI::_3DScene::set_bed_shape($self->{preview3D}->canvas, $self->{config}->bed_shape) if $self->{preview3D};
|
||||
$self->{preview_iface}->set_bed_shape($self->{config}->bed_shape) if ($self->{preview_iface});
|
||||
# Slic3r::GUI::_3DScene::set_bed_shape($self->{preview3D}->canvas, $self->{config}->bed_shape) if $self->{preview3D};
|
||||
$update_scheduled = 1;
|
||||
} elsif ($opt_key =~ '^wipe_tower' || $opt_key eq 'single_extruder_multi_material') {
|
||||
$update_scheduled = 1;
|
||||
@ -1994,13 +2167,15 @@ sub on_config_change {
|
||||
} elsif ($opt_key eq 'extruder_colour') {
|
||||
$update_scheduled = 1;
|
||||
my $extruder_colors = $config->get('extruder_colour');
|
||||
$self->{preview3D}->set_number_extruders(scalar(@{$extruder_colors}));
|
||||
$self->{preview_iface}->set_number_extruders(scalar(@{$extruder_colors}));
|
||||
# $self->{preview3D}->set_number_extruders(scalar(@{$extruder_colors}));
|
||||
} elsif ($opt_key eq 'max_print_height') {
|
||||
$update_scheduled = 1;
|
||||
} elsif ($opt_key eq 'printer_model') {
|
||||
# update to force bed selection (for texturing)
|
||||
Slic3r::GUI::_3DScene::set_bed_shape($self->{canvas3D}, $self->{config}->bed_shape) if $self->{canvas3D};
|
||||
Slic3r::GUI::_3DScene::set_bed_shape($self->{preview3D}->canvas, $self->{config}->bed_shape) if $self->{preview3D};
|
||||
$self->{preview_iface}->set_bed_shape($self->{config}->bed_shape) if ($self->{preview_iface});
|
||||
# Slic3r::GUI::_3DScene::set_bed_shape($self->{preview3D}->canvas, $self->{config}->bed_shape) if $self->{preview3D};
|
||||
$update_scheduled = 1;
|
||||
}
|
||||
}
|
||||
@ -2013,6 +2188,7 @@ sub on_config_change {
|
||||
$self->schedule_background_process;
|
||||
}
|
||||
|
||||
# XXX: YS: WIP
|
||||
sub item_changed_selection {
|
||||
my ($self, $obj_idx) = @_;
|
||||
|
||||
@ -2028,6 +2204,7 @@ sub item_changed_selection {
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub collect_selections {
|
||||
my ($self) = @_;
|
||||
my $selections = [];
|
||||
@ -2037,6 +2214,7 @@ sub collect_selections {
|
||||
return $selections;
|
||||
}
|
||||
|
||||
# XXX: YS: done, lambda on LEFT_DOWN
|
||||
# Called when clicked on the filament preset combo box.
|
||||
# When clicked on the icon, show the color picker.
|
||||
sub filament_color_box_lmouse_down
|
||||
@ -2090,6 +2268,7 @@ sub filament_color_box_lmouse_down
|
||||
# }
|
||||
#}
|
||||
|
||||
# XXX: YS: done
|
||||
sub changed_object_settings {
|
||||
my ($self, $obj_idx, $parts_changed, $part_settings_changed) = @_;
|
||||
|
||||
@ -2115,6 +2294,7 @@ sub changed_object_settings {
|
||||
}
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
# Called to update various buttons depending on whether there are any objects or
|
||||
# whether background processing (export of a G-code, sending to Octoprint, forced background re-slicing) is active.
|
||||
sub object_list_changed {
|
||||
@ -2145,6 +2325,7 @@ sub object_list_changed {
|
||||
for grep $self->{"btn_$_"}, qw(reslice export_gcode print send_gcode);
|
||||
}
|
||||
|
||||
# XXX: VK: WIP
|
||||
# Selection of an active 3D object changed.
|
||||
sub selection_changed {
|
||||
my ($self) = @_;
|
||||
@ -2262,6 +2443,7 @@ sub selection_changed {
|
||||
$self->{right_panel}->Thaw;
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub select_object {
|
||||
my ($self, $obj_idx, $child) = @_;
|
||||
|
||||
@ -2282,6 +2464,7 @@ sub select_object {
|
||||
$self->selection_changed(1);
|
||||
}
|
||||
|
||||
# XXX: YS: WIP
|
||||
sub select_object_from_cpp {
|
||||
my ($self, $obj_idx, $vol_idx) = @_;
|
||||
|
||||
@ -2326,16 +2509,19 @@ sub select_object_from_cpp {
|
||||
$self->selection_changed(1);
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub selected_object {
|
||||
my ($self) = @_;
|
||||
my $obj_idx = first { $self->{objects}[$_]->selected } 0..$#{ $self->{objects} };
|
||||
return defined $obj_idx ? ($obj_idx, $self->{objects}[$obj_idx]) : undef;
|
||||
}
|
||||
|
||||
# XXX: VK: done
|
||||
sub statusbar {
|
||||
return $_[0]->GetFrame->{statusbar};
|
||||
}
|
||||
|
||||
# XXX: not done, to be removed (?)
|
||||
sub object_menu {
|
||||
my ($self) = @_;
|
||||
|
||||
@ -2446,20 +2632,26 @@ sub object_menu {
|
||||
return $menu;
|
||||
}
|
||||
|
||||
# XXX: not done
|
||||
# Set a camera direction, zoom to all objects.
|
||||
sub select_view {
|
||||
my ($self, $direction) = @_;
|
||||
my $idx_page = $self->{preview_notebook}->GetSelection;
|
||||
my $page = ($idx_page == &Wx::wxNOT_FOUND) ? L('3D') : $self->{preview_notebook}->GetPageText($idx_page);
|
||||
if ($page eq L('Preview')) {
|
||||
Slic3r::GUI::_3DScene::select_view($self->{preview3D}->canvas, $direction);
|
||||
Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{canvas3D}, $self->{preview3D}->canvas);
|
||||
$self->{preview_iface}->select_view($direction);
|
||||
$self->{preview_iface}->set_viewport_into_scene($self->{canvas3D});
|
||||
# Slic3r::GUI::_3DScene::select_view($self->{preview3D}->canvas, $direction);
|
||||
# Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{canvas3D}, $self->{preview3D}->canvas);
|
||||
} else {
|
||||
Slic3r::GUI::_3DScene::select_view($self->{canvas3D}, $direction);
|
||||
Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{preview3D}->canvas, $self->{canvas3D});
|
||||
$self->{preview_iface}->set_viewport_from_scene($self->{canvas3D});
|
||||
# Slic3r::GUI::_3DScene::set_viewport_from_scene($self->{preview3D}->canvas, $self->{canvas3D});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# XXX: VK: done, in PlaterDropTarget
|
||||
package Slic3r::GUI::Plater::DropTarget;
|
||||
use Wx::DND;
|
||||
use base 'Wx::FileDropTarget';
|
||||
|
@ -122,9 +122,9 @@ sub add_instance {
|
||||
|
||||
my $new_instance = $self->_add_instance;
|
||||
|
||||
$new_instance->set_rotation($args{rotation})
|
||||
$new_instance->set_rotations($args{rotation})
|
||||
if defined $args{rotation};
|
||||
$new_instance->set_scaling_factor($args{scaling_factor})
|
||||
$new_instance->set_scaling_factors($args{scaling_factor})
|
||||
if defined $args{scaling_factor};
|
||||
$new_instance->set_offset($args{offset})
|
||||
if defined $args{offset};
|
||||
|
@ -158,8 +158,12 @@ sub model {
|
||||
$object->add_volume(mesh => $mesh, material_id => $model_name);
|
||||
$object->add_instance(
|
||||
offset => Slic3r::Pointf->new(0,0),
|
||||
rotation => $params{rotation} // 0,
|
||||
scaling_factor => $params{scale} // 1,
|
||||
# 3D full transform
|
||||
rotation => Slic3r::Pointf3->new(0, 0, $params{rotation} // 0),
|
||||
scaling_factor => Slic3r::Pointf3->new($params{scale} // 1, $params{scale} // 1, $params{scale} // 1),
|
||||
# old transform
|
||||
# rotation => $params{rotation} // 0,
|
||||
# scaling_factor => $params{scale} // 1,
|
||||
);
|
||||
return $model;
|
||||
}
|
||||
|
BIN
resources/fonts/NotoSans-Regular.ttf
Normal file
BIN
resources/fonts/NotoSans-hinted.zip
Normal file
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 159 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 159 KiB |
BIN
resources/icons/bed/sl1_bottom.png
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
resources/icons/bed/sl1_top.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
resources/icons/mode_expert.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
resources/icons/mode_expert_.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/icons/mode_middle.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
resources/icons/mode_middle_.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
resources/icons/mode_simple.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
resources/icons/mode_simple_.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
resources/icons/move_hover.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/icons/move_off.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/icons/move_on.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/icons/overlay/cut_hover.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
resources/icons/overlay/cut_off.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
resources/icons/overlay/cut_on.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
resources/icons/overlay/sla_support_points_hover.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
resources/icons/overlay/sla_support_points_off.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
resources/icons/overlay/sla_support_points_on.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
resources/icons/printers/PrusaResearch_SL1.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
resources/icons/scale_hover.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
resources/icons/scale_off.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
resources/icons/scale_on.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
resources/icons/shape_ungroup_o.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
resources/icons/shape_ungroup_p.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
resources/icons/sla_support_points_reset.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
resources/icons/sla_support_points_tooltip.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
resources/icons/support_blocker_.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/icons/support_enforcer_.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 15 KiB |
BIN
resources/icons/toolbar_background.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
resources/icons/view_toolbar.png
Normal file
After Width: | Height: | Size: 22 KiB |
@ -1,8 +0,0 @@
|
||||
set(L10N_DIR "${PROJECT_SOURCE_DIR}/resources/localization")
|
||||
add_custom_target(pot
|
||||
COMMAND xgettext --keyword=L --from-code=UTF-8 --debug
|
||||
-f "${L10N_DIR}/list.txt"
|
||||
-o "${L10N_DIR}/Slic3rPE.pot"
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Generate pot file from strings in the source tree"
|
||||
)
|
BIN
resources/localization/ko_KR/Slic3rPE.mo
Normal file
4679
resources/localization/ko_KR/Slic3rPE.po
Normal file
@ -1,17 +1,6 @@
|
||||
min_slic3r_version = 1.41.1
|
||||
0.3.2 New MK2.5 and MK3 FW versions
|
||||
0.3.1 New MK2.5 and MK3 FW versions
|
||||
0.3.0 New MK2.5 and MK3 FW version
|
||||
min_slic3r_version = 1.42.0-alpha
|
||||
0.4.0-alpha2 First SLA profiles
|
||||
min_slic3r_version = 1.41.0-alpha
|
||||
0.2.9 New MK2.5 and MK3 FW versions
|
||||
0.2.8 New MK2.5 and MK3 FW version
|
||||
min_slic3r_version = 1.41.1
|
||||
0.2.7 New MK2.5 and MK3 FW version
|
||||
0.2.6 Added MMU2 MK2.5 settings
|
||||
min_slic3r_version = 1.41.0-alpha
|
||||
0.2.5 Prusament is out - added prusament settings
|
||||
0.2.4 Added soluble support profiles for MMU2
|
||||
0.2.3 Added materials for MMU2 single mode, edited MK3 xy stealth feedrate limit
|
||||
0.2.2 Edited MMU2 Single mode purge line
|
||||
0.2.1 Added PET and BVOH settings for MMU2
|
||||
0.2.0-beta5 Fixed MMU1 ramming parameters
|
||||
|
@ -5,7 +5,7 @@
|
||||
name = Prusa Research
|
||||
# Configuration version of this file. Config file will only be installed, if the config_version differs.
|
||||
# This means, the server may force the Slic3r configuration to be downgraded.
|
||||
config_version = 0.3.2
|
||||
config_version = 0.4.0-alpha2
|
||||
# Where to get the updates from?
|
||||
config_update_url = https://raw.githubusercontent.com/prusa3d/Slic3r-settings/master/live/PrusaResearch/
|
||||
|
||||
@ -39,6 +39,10 @@ variants = 0.4; 0.6
|
||||
name = Original Prusa i3 MK2.5 MMU 2.0
|
||||
variants = 0.4
|
||||
|
||||
[printer_model:SL1]
|
||||
name = Original Prusa SL1
|
||||
variants = default; dummy
|
||||
|
||||
# All presets starting with asterisk, for example *common*, are intermediate and they will
|
||||
# not make it into the user interface.
|
||||
|
||||
@ -1136,7 +1140,22 @@ min_fan_speed = 100
|
||||
start_filament_gcode = "M900 K{if printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}200{else}10{endif}; Filament gcode"
|
||||
temperature = 220
|
||||
|
||||
[sla_material:*common*]
|
||||
layer_height = 0.05
|
||||
initial_layer_height = 0.3
|
||||
exposure_time = 10
|
||||
initial_exposure_time = 15
|
||||
material_correction_printing = 1, 1, 1
|
||||
material_correction_curing = 1, 1, 1
|
||||
|
||||
[sla_material:Material 1]
|
||||
inherits = *common*
|
||||
|
||||
[sla_material:Material 2]
|
||||
inherits = *common*
|
||||
|
||||
[printer:*common*]
|
||||
printer_technology = FFF
|
||||
bed_shape = 0x0,250x0,250x210,0x210
|
||||
before_layer_gcode = ;BEFORE_LAYER_CHANGE\nG92 E0.0\n;[layer_z]\n\n
|
||||
between_objects_gcode =
|
||||
@ -1447,7 +1466,25 @@ extruder_colour = #FF8000;#0080FF;#00FFFF;#FF4F4F;#9FFF9F
|
||||
start_gcode = M107\nM115 U3.4.1 ; tell printer latest fw version\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG21 ; set units to millimeters\n\n; Send the filament type to the MMU2.0 unit.\n; E stands for extruder number, F stands for filament type (0: default; 1:flex; 2: PVA)\nM403 E0 F{"" + ((filament_type[0]=="FLEX") ? 1 : ((filament_type[0]=="PVA") ? 2 : 0))}\nM403 E1 F{"" + ((filament_type[1]=="FLEX") ? 1 : ((filament_type[1]=="PVA") ? 2 : 0))}\nM403 E2 F{"" + ((filament_type[2]=="FLEX") ? 1 : ((filament_type[2]=="PVA") ? 2 : 0))}\nM403 E3 F{"" + ((filament_type[3]=="FLEX") ? 1 : ((filament_type[3]=="PVA") ? 2 : 0))}\nM403 E4 F{"" + ((filament_type[4]=="FLEX") ? 1 : ((filament_type[4]=="PVA") ? 2 : 0))}\n\n{if not has_single_extruder_multi_material_priming}\n;go outside print area\nG1 Y-3.0 F1000.0\nG1 Z0.4 F1000.0\n; select extruder\nT[initial_tool]\n; initial load\nG1 X55.0 E32.0 F1073.0\nG1 X5.0 E32.0 F1800.0\nG1 X55.0 E8.0 F2000.0\nG1 Z0.3 F1000.0\nG92 E0.0\nG1 X240.0 E25.0 F2200.0\nG1 Y-2.0 F1000.0\nG1 X55.0 E25 F1400.0\nG1 Z0.20 F1000.0\nG1 X5.0 E4.0 F1000.0\nG92 E0.0\n{endif}\n\nM221 S{if layer_height<0.075}100{else}95{endif}\nG90 ; use absolute coordinates\nM83 ; use relative distances for extrusion\nG92 E0.0\n
|
||||
end_gcode = {if has_wipe_tower}\nG1 E-15.0000 F3000\n{else}\nG1 X0 Y210 F7200\nG1 E2 F5000\nG1 E2 F5500\nG1 E2 F6000\nG1 E-15.0000 F5800\nG1 E-20.0000 F5500\nG1 E10.0000 F3000\nG1 E-10.0000 F3100\nG1 E10.0000 F3150\nG1 E-10.0000 F3250\nG1 E10.0000 F3300\n{endif}\n\n; Unload filament\nM702 C\n\nG4 ; wait\nM104 S0 ; turn off temperature\nM140 S0 ; turn off heatbed\nM107 ; turn off fan\n; Lift print head a bit\n{if layer_z < max_print_height}G1 Z{z_offset+min(layer_z+30, max_print_height)}{endif} ; Move print head up\nG1 X0 Y200; home X axis\nM84 ; disable motors\n
|
||||
|
||||
[printer:Original Prusa SL1]
|
||||
printer_technology = SLA
|
||||
printer_model = SL1
|
||||
printer_variant = default
|
||||
default_sla_material_profile = Material 1
|
||||
bed_shape = 0x0,150x0,150x100,0x100
|
||||
max_print_height = 100
|
||||
display_width = 150
|
||||
display_height = 100
|
||||
display_pixels_x = 2000
|
||||
display_pixels_y = 1000
|
||||
printer_correction = 1,1,1
|
||||
|
||||
[printer:Original Prusa SL1 dummy]
|
||||
inherits = Original Prusa SL1
|
||||
printer_variant = dummy
|
||||
default_sla_material_profile = Material 2
|
||||
|
||||
# The obsolete presets will be removed when upgrading from the legacy configuration structure (up to Slic3r 1.39.2) to 1.40.0 and newer.
|
||||
[obsolete_presets]
|
||||
print="0.05mm DETAIL 0.25 nozzle";"0.05mm DETAIL MK3";"0.05mm DETAIL";"0.20mm NORMAL MK3";"0.35mm FAST MK3";"print:0.15mm OPTIMAL MK3 MMU2";"print:0.20mm FAST MK3 MMU2"
|
||||
filament="ColorFabb Brass Bronze 1.75mm";"ColorFabb HT 1.75mm";"ColorFabb nGen 1.75mm";"ColorFabb Woodfil 1.75mm";"ColorFabb XT 1.75mm";"ColorFabb XT-CF20 1.75mm";"E3D PC-ABS 1.75mm";"Fillamentum ABS 1.75mm";"Fillamentum ASA 1.75mm";"Generic ABS 1.75mm";"Generic PET 1.75mm";"Generic PLA 1.75mm";"Prusa ABS 1.75mm";"Prusa HIPS 1.75mm";"Prusa PET 1.75mm";"Prusa PLA 1.75mm";"Taulman Bridge 1.75mm";"Taulman T-Glase 1.75mm"
|
||||
filament="ColorFabb Brass Bronze 1.75mm";"ColorFabb HT 1.75mm";"ColorFabb nGen 1.75mm";"ColorFabb Woodfil 1.75mm";"ColorFabb XT 1.75mm";"ColorFabb XT-CF20 1.75mm";"E3D PC-ABS 1.75mm";"Fillamentum ABS 1.75mm";"Fillamentum ASA 1.75mm";"Generic ABS 1.75mm";"Generic PET 1.75mm";"Generic PLA 1.75mm";"Prusa ABS 1.75mm";"Prusa HIPS 1.75mm";"Prusa PET 1.75mm";"Prusa PLA 1.75mm";"Taulman Bridge 1.75mm";"Taulman T-Glase 1.75mm"
|
||||
|
@ -8,10 +8,18 @@ varying vec2 intensity;
|
||||
varying vec3 delta_box_min;
|
||||
varying vec3 delta_box_max;
|
||||
|
||||
varying float world_z;
|
||||
|
||||
uniform vec4 uniform_color;
|
||||
|
||||
// x = min z, y = max z;
|
||||
uniform vec2 z_range;
|
||||
|
||||
void main()
|
||||
{
|
||||
if ((world_z < z_range.x) || (z_range.y < world_z))
|
||||
discard;
|
||||
|
||||
// if the fragment is outside the print volume -> use darker color
|
||||
vec3 color = (any(lessThan(delta_box_min, ZERO)) || any(greaterThan(delta_box_max, ZERO))) ? mix(uniform_color.rgb, ZERO, 0.3333) : uniform_color.rgb;
|
||||
gl_FragColor = vec4(vec3(intensity.y, intensity.y, intensity.y) + color * intensity.x, uniform_color.a);
|
||||
|
@ -34,6 +34,8 @@ varying vec2 intensity;
|
||||
varying vec3 delta_box_min;
|
||||
varying vec3 delta_box_max;
|
||||
|
||||
varying float world_z;
|
||||
|
||||
void main()
|
||||
{
|
||||
// First transform the normal into camera space and normalize the result.
|
||||
@ -67,4 +69,5 @@ void main()
|
||||
}
|
||||
|
||||
gl_Position = ftransform();
|
||||
world_z = vec3(print_box.volume_world_matrix * gl_Vertex).z;
|
||||
}
|
||||
|
1
sandboxes/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_subdirectory(slabasebed)
|
2
sandboxes/slabasebed/CMakeLists.txt
Normal file
@ -0,0 +1,2 @@
|
||||
add_executable(slabasebed EXCLUDE_FROM_ALL slabasebed.cpp)
|
||||
target_link_libraries(slabasebed libslic3r)
|
@ -1,10 +1,10 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <libslic3r.h>
|
||||
#include "TriangleMesh.hpp"
|
||||
#include "SLABasePool.hpp"
|
||||
#include "benchmark.h"
|
||||
#include <libslic3r/libslic3r.h>
|
||||
#include <libslic3r/TriangleMesh.hpp>
|
||||
#include <libslic3r/SLA/SLABasePool.hpp>
|
||||
#include <libnest2d/tools/benchmark.h>
|
||||
|
||||
const std::string USAGE_STR = {
|
||||
"Usage: slabasebed stlfilename.stl"
|
||||
@ -28,7 +28,7 @@ int main(const int argc, const char *argv[]) {
|
||||
ExPolygons ground_slice;
|
||||
TriangleMesh basepool;
|
||||
|
||||
sla::ground_layer(model, ground_slice, 0.1f);
|
||||
sla::base_plate(model, ground_slice, 0.1f);
|
||||
|
||||
bench.start();
|
||||
sla::create_base_pool(ground_slice, basepool);
|
642
serial.txt
@ -1,642 +0,0 @@
|
||||
<< start
|
||||
<< echo: 3.1.1-RC5-150z
|
||||
<< echo: Last Updated: Feb 7 2018 15:28:23 | Author: (none, default config)
|
||||
<< Compiled: Feb 7 2018
|
||||
<< echo: Free Memory: 1777 PlannerBufferBytes: 1312
|
||||
<< echo:Hardcoded Default Settings Loaded
|
||||
<< adc_init
|
||||
>> N0 M105*39
|
||||
<< CrashDetect ENABLED!
|
||||
<< tmc2130_init(), mode=NORMAL
|
||||
<< PAT9125_init:1
|
||||
<< FSensor
|
||||
<< ENABLED
|
||||
<< echo:SD card ok
|
||||
<< echo:busy: processing
|
||||
<< Error:Line Number is not Last Line Number+1, Last Line: 0
|
||||
<< Resend: 1
|
||||
<< ok
|
||||
>> N1 M107*36
|
||||
<< ok
|
||||
>> N2 M115 U3.1.1-RC5*107
|
||||
<< ok
|
||||
>> N3 M201 X1000 Y1000 Z200 E5000*10
|
||||
<< ok
|
||||
>> N4 M203 X200 Y200 Z12 E120*8
|
||||
<< ok
|
||||
>> N5 M204 S1250 T1250*39
|
||||
<< ok
|
||||
>> N6 M205 X10 Y10 Z0.4 E2.5*63
|
||||
<< ok
|
||||
>> N7 M205 S0 T0*36
|
||||
<< ok
|
||||
>> N8 M83*16
|
||||
<< ok
|
||||
>> N9 M104 S215*106
|
||||
<< ok
|
||||
>> N10 M140 S60*98
|
||||
<< ok
|
||||
>> N11 M190 S60*110
|
||||
<< T:158.08 E:0 B:57.1
|
||||
<< T:157.04 E:0 B:57.1
|
||||
<< T:156.77 E:0 B:56.9
|
||||
<< T:156.97 E:0 B:57.0
|
||||
<< T:158.14 E:0 B:57.0
|
||||
<< T:159.62 E:0 B:56.9
|
||||
<< T:161.25 E:0 B:56.8
|
||||
<< T:163.64 E:0 B:56.8
|
||||
<< T:165.94 E:0 B:56.7
|
||||
<< T:168.40 E:0 B:56.8
|
||||
<< T:170.79 E:0 B:56.7
|
||||
<< T:173.68 E:0 B:56.7
|
||||
<< T:175.53 E:0 B:56.6
|
||||
<< T:178.40 E:0 B:56.6
|
||||
<< T:180.94 E:0 B:56.5
|
||||
<< T:183.92 E:0 B:56.4
|
||||
<< T:186.73 E:0 B:56.4
|
||||
<< T:189.20 E:0 B:56.4
|
||||
<< T:191.32 E:0 B:56.3
|
||||
<< T:193.91 E:0 B:56.3
|
||||
<< T:196.38 E:0 B:56.2
|
||||
<< T:198.75 E:0 B:56.2
|
||||
<< T:201.65 E:0 B:56.3
|
||||
<< T:203.57 E:0 B:56.4
|
||||
<< T:206.38 E:0 B:56.5
|
||||
<< T:208.71 E:0 B:56.6
|
||||
<< T:211.04 E:0 B:56.6
|
||||
<< T:212.86 E:0 B:56.8
|
||||
<< T:214.84 E:0 B:57.0
|
||||
<< T:215.52 E:0 B:57.2
|
||||
<< T:215.78 E:0 B:57.4
|
||||
<< T:216.30 E:0 B:57.6
|
||||
<< T:216.51 E:0 B:57.7
|
||||
<< T:215.73 E:0 B:58.0
|
||||
<< T:215.47 E:0 B:58.2
|
||||
<< T:214.95 E:0 B:58.5
|
||||
<< T:214.22 E:0 B:58.7
|
||||
<< T:213.65 E:0 B:59.0
|
||||
<< T:212.24 E:0 B:59.2
|
||||
<< T:212.14 E:0 B:59.4
|
||||
<< T:212.03 E:0 B:59.7
|
||||
<< T:211.51 E:0 B:59.8
|
||||
<< ok
|
||||
>> N12 M105*20
|
||||
<< ok T:211.0 /215.0 B:60.0 /60.0 T0:211.0 /215.0 @:60 B@:0 P:46.3 A:36.2
|
||||
>> N13 M105*21
|
||||
<< ok T:211.0 /215.0 B:60.0 /60.0 T0:211.0 /215.0 @:60 B@:0 P:46.3 A:36.2
|
||||
>> N14 M105*18
|
||||
<< ok T:211.0 /215.0 B:60.0 /60.0 T0:211.0 /215.0 @:60 B@:0 P:46.3 A:36.2
|
||||
>> N15 M105*19
|
||||
<< ok T:211.0 /215.0 B:60.0 /60.0 T0:211.0 /215.0 @:60 B@:0 P:46.3 A:36.2
|
||||
>> N16 M105*16
|
||||
<< ok T:211.0 /215.0 B:60.0 /60.0 T0:211.0 /215.0 @:60 B@:0 P:46.3 A:36.2
|
||||
>> N17 M105*17
|
||||
<< ok T:211.0 /215.0 B:60.0 /60.0 T0:211.0 /215.0 @:60 B@:0 P:46.3 A:36.2
|
||||
>> N18 M105*30
|
||||
<< ok T:211.0 /215.0 B:60.0 /60.0 T0:211.0 /215.0 @:60 B@:0 P:46.3 A:36.2
|
||||
>> N19 M105*31
|
||||
<< ok T:211.0 /215.0 B:60.0 /60.0 T0:211.0 /215.0 @:60 B@:0 P:46.3 A:36.2
|
||||
>> N20 M105*21
|
||||
<< ok T:211.0 /215.0 B:60.0 /60.0 T0:211.0 /215.0 @:60 B@:0 P:46.3 A:36.2
|
||||
>> N21 M109 S215*93
|
||||
<< T:211.3 E:0 W:?
|
||||
<< T:211.8 E:0 W:?
|
||||
<< T:211.8 E:0 W:?
|
||||
<< T:212.1 E:0 W:?
|
||||
<< T:212.4 E:0 W:?
|
||||
<< T:213.3 E:0 W:?
|
||||
<< T:213.3 E:0 W:?
|
||||
<< T:213.8 E:0 W:?
|
||||
<< T:214.1 E:0 W:2
|
||||
<< T:214.1 E:0 W:1
|
||||
<< T:214.2 E:0 W:0
|
||||
<< ok
|
||||
>> N22 M105*23
|
||||
<< ok T:214.3 /215.0 B:60.8 /60.0 T0:214.3 /215.0 @:20 B@:7 P:46.4 A:36.0
|
||||
>> N23 M105*22
|
||||
<< ok T:214.3 /215.0 B:60.8 /60.0 T0:214.3 /215.0 @:20 B@:7 P:46.4 A:36.0
|
||||
>> N24 G28 W*82
|
||||
<< 0 step=62 mscnt= 993
|
||||
<< tmc2130_goto_step 0 0 2 1000
|
||||
<< step 61 mscnt = 984
|
||||
<< dir=0 steps=-61
|
||||
<< dir=1 steps=61
|
||||
<< dir=0 steps=3
|
||||
<< cnt 2 step 61 mscnt = 986
|
||||
<< cnt 1 step 62 mscnt = 1005
|
||||
<< cnt 0 step 63 mscnt = 1021
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< 0 step=34 mscnt= 547
|
||||
<< tmc2130_goto_step 1 0 2 1000
|
||||
<< step 34 mscnt = 552
|
||||
<< dir=1 steps=-34
|
||||
<< dir=0 steps=34
|
||||
<< dir=1 steps=30
|
||||
<< cnt 29 step 34 mscnt = 554
|
||||
<< cnt 28 step 35 mscnt = 572
|
||||
<< cnt 27 step 36 mscnt = 588
|
||||
<< cnt 26 step 37 mscnt = 604
|
||||
<< cnt 25 step 38 mscnt = 620
|
||||
<< cnt 24 step 39 mscnt = 637
|
||||
<< cnt 23 step 40 mscnt = 653
|
||||
<< cnt 22 step 41 mscnt = 668
|
||||
<< cnt 21 step 42 mscnt = 684
|
||||
<< cnt 20 step 43 mscnt = 701
|
||||
<< cnt 19 step 44 mscnt = 717
|
||||
<< cnt 18 step 45 mscnt = 733
|
||||
<< cnt 17 step 46 mscnt = 748
|
||||
<< cnt 16 step 47 mscnt = 765
|
||||
<< cnt 15 step 48 mscnt = 780
|
||||
<< cnt 14 step 49 mscnt = 796
|
||||
<< cnt 13 step 50 mscnt = 812
|
||||
<< cnt 12 step 51 mscnt = 828
|
||||
<< cnt 11 step 52 mscnt = 844
|
||||
<< cnt 10 step 53 mscnt = 860
|
||||
<< cnt 9 step 54 mscnt = 876
|
||||
<< cnt 8 step 55 mscnt = 893
|
||||
<< cnt 7 step 56 mscnt = 909
|
||||
<< cnt 6 step 57 mscnt = 925
|
||||
<< cnt 5 step 58 mscnt = 941
|
||||
<< cnt 4 step 59 mscnt = 956
|
||||
<< cnt 3 step 60 mscnt = 972
|
||||
<< cnt 2 step 61 mscnt = 988
|
||||
<< cnt 1 step 62 mscnt = 1005
|
||||
<< cnt 0 step 63 mscnt = 1021
|
||||
<< echo:busy: processing
|
||||
<< ok
|
||||
>> N25 M105*16
|
||||
<< ok T:213.1 /215.0 B:60.8 /60.0 T0:213.1 /215.0 @:44 B@:35 P:46.5 A:35.6
|
||||
>> N26 G80*37
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< ok
|
||||
>> N27 M105*18
|
||||
<< ok T:214.8 /215.0 B:60.9 /60.0 T0:214.8 /215.0 @:31 B@:25 P:46.3 A:35.7
|
||||
>> N28 M105*29
|
||||
<< ok T:214.8 /215.0 B:60.9 /60.0 T0:214.8 /215.0 @:31 B@:25 P:46.3 A:35.7
|
||||
>> N29 M105*28
|
||||
<< ok T:214.8 /215.0 B:60.9 /60.0 T0:214.8 /215.0 @:31 B@:25 P:46.3 A:35.7
|
||||
>> N30 M105*20
|
||||
<< ok T:214.8 /215.0 B:60.9 /60.0 T0:214.8 /215.0 @:31 B@:25 P:46.3 A:35.7
|
||||
>> N31 M105*21
|
||||
<< ok T:214.8 /215.0 B:60.9 /60.0 T0:214.8 /215.0 @:31 B@:25 P:46.3 A:35.7
|
||||
>> N32 M105*22
|
||||
<< ok T:214.8 /215.0 B:60.9 /60.0 T0:214.8 /215.0 @:31 B@:25 P:46.3 A:35.7
|
||||
>> N33 G1 Y-3.0 F1000.0*24
|
||||
<< ok
|
||||
>> N34 G92 E0.0*110
|
||||
<< ok
|
||||
>> N35 G1 X60.0 E9.0 F1000.0*101
|
||||
<< ok
|
||||
>> N36 G1 X100.0 E12.5 F1000.0*110
|
||||
<< ok
|
||||
>> N37 G92 E0.0*109
|
||||
<< ok
|
||||
>> N38 M221 S95*102
|
||||
<< ok
|
||||
>> N39 M900 K30*120
|
||||
<< Invalid M code.
|
||||
<< ok
|
||||
>> N40 G21*46
|
||||
<< ok
|
||||
>> N41 G90*37
|
||||
<< ok
|
||||
>> N42 M83*46
|
||||
<< ok
|
||||
>> N43 G1 E-0.80000 F2100.00000*10
|
||||
<< ok
|
||||
>> N44 G1 Z0.600 F10200.000*1
|
||||
<< ok
|
||||
>> N45 G1 X112.437 Y93.991 F10200.000*106
|
||||
<< ok
|
||||
>> N46 G1 Z0.200 F10200.000*7
|
||||
<< ok
|
||||
>> N47 G1 E0.80000 F2100.00000*35
|
||||
<< ok
|
||||
>> N48 M204 S1000*107
|
||||
<< ok
|
||||
>> N49 G1 F1800*122
|
||||
<< ok
|
||||
>> N50 G1 X112.930 Y93.183 E0.02968*106
|
||||
<< ok
|
||||
>> N51 G1 X113.335 Y92.806 E0.01733*99
|
||||
<< ok
|
||||
>> N52 G1 X113.810 Y92.516 E0.01745*97
|
||||
<< ok
|
||||
>> N53 G1 X114.334 Y92.328 E0.01745*97
|
||||
<< ok
|
||||
>> N54 G1 X114.885 Y92.248 E0.01745*96
|
||||
<< ok
|
||||
>> N55 M105*23
|
||||
<< ok T:214.9 /215.0 B:60.8 /60.0 T0:214.9 /215.0 @:30 B@:28 P:46.2 A:35.7
|
||||
>> N56 G1 X135.004 Y92.246 E0.63084*96
|
||||
<< ok
|
||||
>> N57 G1 X136.005 Y92.436 E0.03195*101
|
||||
<< ok
|
||||
>> N58 G1 X136.866 Y92.974 E0.03183*107
|
||||
<< ok
|
||||
>> N59 G1 X137.473 Y93.788 E0.03183*111
|
||||
<< ok
|
||||
>> N60 G1 X137.745 Y94.770 E0.03195*100
|
||||
<< ok
|
||||
>> N61 G1 X137.753 Y115.086 E0.63700*88
|
||||
<< ok
|
||||
>> N62 G1 X137.563 Y116.009 E0.02955*87
|
||||
<< ok
|
||||
>> N63 G1 X137.070 Y116.817 E0.02968*88
|
||||
<< ok
|
||||
>> N64 G1 X136.646 Y117.208 E0.01809*93
|
||||
<< ok
|
||||
>> N65 G1 X136.149 Y117.503 E0.01809*88
|
||||
<< ok
|
||||
>> N66 G1 X135.603 Y117.687 E0.01809*94
|
||||
<< ok
|
||||
>> N67 G1 X135.029 Y117.754 E0.01809*94
|
||||
<< ok
|
||||
>> N68 G1 X114.914 Y117.753 E0.63071*81
|
||||
<< ok
|
||||
>> N69 G1 X113.991 Y117.563 E0.02955*83
|
||||
<< ok
|
||||
>> N70 G1 X113.183 Y117.070 E0.02968*89
|
||||
<< ok
|
||||
>> N71 G1 X112.792 Y116.646 E0.01809*88
|
||||
<< ok
|
||||
>> N72 M105*18
|
||||
<< ok T:214.0 /215.0 B:60.8 /60.0 T0:214.0 /215.0 @:45 B@:16 P:46.2 A:35.5
|
||||
>> N73 G1 X112.497 Y116.149 E0.01809*84
|
||||
<< ok
|
||||
>> N74 G1 X112.313 Y115.603 E0.01809*82
|
||||
<< ok
|
||||
>> N75 G1 X112.246 Y115.029 E0.01809*92
|
||||
<< ok
|
||||
>> N76 G1 X112.247 Y94.914 E0.63071*98
|
||||
<< ok
|
||||
>> N77 G1 X112.425 Y94.050 E0.02767*111
|
||||
<< ok
|
||||
>> N78 G1 F8160*126
|
||||
<< ok
|
||||
>> N79 G1 X112.930 Y93.183 E-0.24526*78
|
||||
<< ok
|
||||
>> N80 G1 F8160*121
|
||||
<< ok
|
||||
>> N81 G1 X113.335 Y92.806 E-0.13510*67
|
||||
<< ok
|
||||
>> N82 G1 F8160*123
|
||||
<< ok
|
||||
>> N83 G1 X113.810 Y92.516 E-0.13609*74
|
||||
<< ok
|
||||
>> N84 G1 F8160*125
|
||||
<< ok
|
||||
>> N85 G1 X114.334 Y92.328 E-0.13609*77
|
||||
<< ok
|
||||
>> N86 G1 F8160*127
|
||||
<< ok
|
||||
>> N87 G1 X114.769 Y92.265 E-0.10746*66
|
||||
<< ok
|
||||
>> N88 G1 E-0.04000 F2100.00000*1
|
||||
<< ok
|
||||
>> N89 G1 Z0.800 F10200.000*14
|
||||
<< ok
|
||||
>> N90 G1 X113.989 Y92.849 F10200.000*110
|
||||
<< ok
|
||||
>> N91 G1 Z0.200 F10200.000*13
|
||||
<< ok
|
||||
>> N92 G1 E0.80000 F2100.00000*43
|
||||
<< ok
|
||||
>> N93 G1 F1800*125
|
||||
<< ok
|
||||
>> N94 G1 X114.911 Y92.625 E0.02977*99
|
||||
<< ok
|
||||
>> N95 G1 X135.004 Y92.623 E0.62999*108
|
||||
<< ok
|
||||
>> N96 G1 X135.871 Y92.788 E0.02767*108
|
||||
<< ok
|
||||
>> N97 G1 X136.617 Y93.258 E0.02767*105
|
||||
<< ok
|
||||
>> N98 G1 X137.141 Y93.968 E0.02767*107
|
||||
<< ok
|
||||
>> N99 G1 X137.371 Y94.824 E0.02778*107
|
||||
<< ok
|
||||
>> N100 G1 X137.376 Y115.065 E0.63464*97
|
||||
<< ok
|
||||
>> N101 G1 X137.209 Y115.878 E0.02602*104
|
||||
<< ok
|
||||
>> N102 G1 X136.773 Y116.584 E0.02602*111
|
||||
<< ok
|
||||
>> N103 G1 X136.407 Y116.916 E0.01550*110
|
||||
<< ok
|
||||
>> N104 G1 X135.980 Y117.166 E0.01550*102
|
||||
<< ok
|
||||
>> N105 G1 X135.511 Y117.321 E0.01550*98
|
||||
<< ok
|
||||
>> N106 G1 X135.020 Y117.377 E0.01550*101
|
||||
<< ok
|
||||
>> N107 G1 X114.935 Y117.376 E0.62975*101
|
||||
<< ok
|
||||
>> N108 G1 X114.122 Y117.209 E0.02602*100
|
||||
<< ok
|
||||
>> N109 G1 X113.416 Y116.773 E0.02602*105
|
||||
<< ok
|
||||
>> N110 G1 X113.084 Y116.407 E0.01550*105
|
||||
<< ok
|
||||
>> N111 G1 X112.834 Y115.980 E0.01550*107
|
||||
<< ok
|
||||
>> N112 G1 X112.679 Y115.511 E0.01550*107
|
||||
<< ok
|
||||
>> N113 G1 X112.623 Y115.020 E0.01550*98
|
||||
<< ok
|
||||
>> N114 G1 X112.624 Y94.935 E0.62975*89
|
||||
<< ok
|
||||
>> N115 G1 X112.791 Y94.122 E0.02602*80
|
||||
<< ok
|
||||
>> N116 G1 X113.227 Y93.416 E0.02602*95
|
||||
<< ok
|
||||
>> N117 G1 X113.940 Y92.885 E0.02789*81
|
||||
<< ok
|
||||
>> N118 G1 F8160*73
|
||||
<< ok
|
||||
>> N119 G1 X114.911 Y92.625 E-0.24574*113
|
||||
<< ok
|
||||
>> N120 G1 F8160*66
|
||||
<< ok
|
||||
>> N121 G1 X117.015 Y92.624 E-0.51426*113
|
||||
<< ok
|
||||
>> N122 G1 E-0.04000 F2100.00000*48
|
||||
<< ok
|
||||
>> N123 G1 Z0.800 F10200.000*63
|
||||
<< ok
|
||||
>> N124 G1 X115.587 Y95.587 F10200.000*92
|
||||
<< ok
|
||||
>> N125 M105*33
|
||||
<< ok T:214.2 /215.0 B:60.7 /60.0 T0:214.2 /215.0 @:41 B@:24 P:46.2 A:36.0
|
||||
>> N126 G1 Z0.200 F10200.000*48
|
||||
<< ok
|
||||
>> N127 G1 E0.80000 F2100.00000*20
|
||||
<< ok
|
||||
>> N128 G1 F1800*76
|
||||
<< ok
|
||||
>> N129 G1 X134.413 Y95.587 E0.59027*87
|
||||
<< ok
|
||||
>> N130 G1 X134.413 Y114.413 E0.59027*107
|
||||
<< ok
|
||||
>> N131 G1 X115.587 Y114.413 E0.59027*101
|
||||
<< ok
|
||||
>> N132 G1 X115.587 Y95.647 E0.58839*91
|
||||
<< ok
|
||||
>> N133 G1 X115.210 Y95.210 F10200.000*90
|
||||
<< ok
|
||||
>> N134 G1 F1800*65
|
||||
<< ok
|
||||
>> N135 G1 X134.790 Y95.210 E0.61392*93
|
||||
<< ok
|
||||
>> N136 G1 X134.790 Y114.790 E0.61392*107
|
||||
<< ok
|
||||
>> N137 G1 X115.210 Y114.790 E0.61392*100
|
||||
<< ok
|
||||
>> N138 G1 X115.210 Y95.270 E0.61204*86
|
||||
<< ok
|
||||
>> N139 G1 X115.596 Y95.314 F10200.000*92
|
||||
<< ok
|
||||
>> N140 G1 F8160*68
|
||||
<< ok
|
||||
>> N141 G1 X118.319 Y95.260 E-0.76000*113
|
||||
<< ok
|
||||
>> N142 G1 E-0.04000 F2100.00000*54
|
||||
<< ok
|
||||
>> N143 G1 Z0.800 F10200.000*57
|
||||
<< ok
|
||||
>> N144 G1 X115.700 Y113.527 F10200.000*98
|
||||
<< ok
|
||||
>> N145 G1 Z0.200 F10200.000*53
|
||||
<< ok
|
||||
>> N146 G1 E0.80000 F2100.00000*19
|
||||
<< ok
|
||||
>> N147 G1 F1800*69
|
||||
<< ok
|
||||
>> N148 G1 X116.303 Y114.130 E0.02708*98
|
||||
<< ok
|
||||
>> N149 G1 X116.843 Y114.130 E0.01716*96
|
||||
<< ok
|
||||
>> N150 G1 X115.870 Y113.157 E0.04372*110
|
||||
<< ok
|
||||
>> N151 G1 X115.870 Y112.617 E0.01716*110
|
||||
<< ok
|
||||
>> N152 G1 X117.383 Y114.130 E0.06799*108
|
||||
<< ok
|
||||
>> N153 G1 X117.924 Y114.130 E0.01716*106
|
||||
<< ok
|
||||
>> N154 M105*39
|
||||
<< ok T:215.1 /215.0 B:60.7 /60.0 T0:215.1 /215.0 @:29 B@:12 P:46.2 A:35.7
|
||||
>> N155 G1 X115.870 Y112.076 E0.09225*102
|
||||
<< ok
|
||||
>> N156 G1 X115.870 Y111.536 E0.01716*106
|
||||
<< ok
|
||||
>> N157 G1 X118.464 Y114.130 E0.11652*104
|
||||
<< ok
|
||||
>> N158 G1 X119.004 Y114.130 E0.01716*100
|
||||
<< ok
|
||||
>> N159 G1 X115.870 Y110.996 E0.14079*104
|
||||
<< ok
|
||||
>> N160 G1 X115.870 Y110.456 E0.01716*105
|
||||
<< ok
|
||||
>> N161 G1 X119.544 Y114.130 E0.16505*105
|
||||
<< ok
|
||||
>> N162 G1 X120.085 Y114.130 E0.01716*110
|
||||
<< ok
|
||||
>> N163 G1 X115.870 Y109.915 E0.18932*104
|
||||
<< ok
|
||||
>> N164 G1 X115.870 Y109.375 E0.01716*99
|
||||
<< ok
|
||||
>> N165 G1 X120.625 Y114.130 E0.21358*105
|
||||
<< ok
|
||||
>> N166 G1 X121.165 Y114.130 E0.01716*100
|
||||
<< ok
|
||||
>> N167 G1 X115.870 Y108.835 E0.23785*100
|
||||
<< ok
|
||||
>> N168 G1 X115.870 Y108.295 E0.01716*97
|
||||
<< ok
|
||||
>> N169 G1 X121.705 Y114.130 E0.26212*111
|
||||
<< ok
|
||||
>> N170 G1 X122.245 Y114.130 E0.01716*97
|
||||
<< ok
|
||||
>> N171 G1 X115.870 Y107.755 E0.28638*105
|
||||
<< ok
|
||||
>> N172 G1 X115.870 Y107.214 E0.01716*108
|
||||
<< ok
|
||||
>> N173 G1 X122.786 Y114.130 E0.31065*104
|
||||
<< ok
|
||||
>> N174 G1 X123.326 Y114.130 E0.01716*96
|
||||
<< ok
|
||||
>> N175 G1 X115.870 Y106.674 E0.33491*101
|
||||
<< ok
|
||||
>> N176 G1 X115.870 Y106.134 E0.01716*104
|
||||
<< ok
|
||||
>> N177 G1 X123.866 Y114.130 E0.35918*107
|
||||
<< ok
|
||||
>> N178 G1 X124.406 Y114.130 E0.01716*110
|
||||
<< ok
|
||||
>> N179 G1 X115.870 Y105.594 E0.38344*99
|
||||
<< ok
|
||||
>> N180 G1 X115.870 Y105.054 E0.01716*101
|
||||
<< ok
|
||||
>> N181 G1 X124.946 Y114.130 E0.40771*101
|
||||
<< ok
|
||||
>> N182 G1 X125.487 Y114.130 E0.01716*99
|
||||
<< ok
|
||||
>> N183 G1 X115.870 Y104.513 E0.43198*103
|
||||
<< ok
|
||||
>> N184 G1 X115.870 Y103.973 E0.01716*107
|
||||
<< ok
|
||||
>> N185 G1 X126.027 Y114.130 E0.45624*105
|
||||
<< ok
|
||||
>> N186 G1 X126.567 Y114.130 E0.01716*107
|
||||
<< ok
|
||||
>> N187 G1 X115.870 Y103.433 E0.48051*104
|
||||
<< ok
|
||||
>> N188 G1 X115.870 Y102.893 E0.01716*105
|
||||
<< ok
|
||||
>> N189 G1 X127.107 Y114.130 E0.50477*103
|
||||
<< ok
|
||||
>> N190 M105*47
|
||||
<< ok T:215.3 /215.0 B:60.7 /60.0 T0:215.3 /215.0 @:28 B@:18 P:46.3 A:35.5
|
||||
>> N191 G1 X127.648 Y114.130 E0.01716*98
|
||||
<< ok
|
||||
>> N192 G1 X115.870 Y102.352 E0.52904*111
|
||||
<< ok
|
||||
>> N193 G1 X115.870 Y101.812 E0.01716*105
|
||||
<< ok
|
||||
>> N194 G1 X128.188 Y114.130 E0.55330*98
|
||||
<< ok
|
||||
>> N195 G1 X128.728 Y114.130 E0.01716*110
|
||||
<< ok
|
||||
>> N196 G1 X115.870 Y101.272 E0.57757*102
|
||||
<< ok
|
||||
>> N197 G1 X115.870 Y100.732 E0.01716*97
|
||||
<< ok
|
||||
>> N198 G1 X129.268 Y114.130 E0.60184*105
|
||||
<< ok
|
||||
>> N199 G1 X129.808 Y114.130 E0.01716*110
|
||||
<< ok
|
||||
>> N200 G1 X115.870 Y100.192 E0.62610*98
|
||||
<< ok
|
||||
>> N201 G1 X115.870 Y99.651 E0.01716*88
|
||||
<< ok
|
||||
>> N202 G1 X130.349 Y114.130 E0.65037*111
|
||||
<< ok
|
||||
>> N203 G1 X130.889 Y114.130 E0.01716*111
|
||||
<< ok
|
||||
>> N204 G1 X115.870 Y99.111 E0.67463*95
|
||||
<< ok
|
||||
>> N205 G1 X115.870 Y98.571 E0.01716*92
|
||||
<< ok
|
||||
>> N206 G1 X131.429 Y114.130 E0.69890*98
|
||||
<< ok
|
||||
>> N207 G1 X131.969 Y114.130 E0.01716*101
|
||||
<< ok
|
||||
>> N208 M105*45
|
||||
<< ok T:214.7 /215.0 B:60.6 /60.0 T0:214.7 /215.0 @:38 B@:12 P:46.2 A:35.9
|
||||
>> N209 G1 X115.870 Y98.031 E0.72316*81
|
||||
<< ok
|
||||
>> N210 G1 X115.870 Y97.491 E0.01716*88
|
||||
<< ok
|
||||
>> N211 G1 X132.509 Y114.130 E0.74743*105
|
||||
<< ok
|
||||
>> N212 G1 X133.050 Y114.130 E0.01716*96
|
||||
<< ok
|
||||
>> N213 M105*39
|
||||
<< ok T:215.1 /215.0 B:60.4 /60.0 T0:215.1 /215.0 @:32 B@:39 P:46.3 A:35.8
|
||||
>> N214 M105*32
|
||||
<< ok T:214.6 /215.0 B:60.5 /60.0 T0:214.6 /215.0 @:39 B@:14 P:46.3 A:36.3
|
||||
>> N215 G28*21
|
||||
<< echo:busy: processing
|
||||
<< 0 step=61 mscnt= 989
|
||||
<< tmc2130_goto_step 0 0 2 1000
|
||||
<< step 61 mscnt = 984
|
||||
<< dir=0 steps=-61
|
||||
<< dir=1 steps=61
|
||||
<< dir=0 steps=3
|
||||
<< cnt 2 step 61 mscnt = 986
|
||||
<< cnt 1 step 62 mscnt = 1004
|
||||
<< cnt 0 step 63 mscnt = 1021
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< 0 step=34 mscnt= 547
|
||||
<< tmc2130_goto_step 1 0 2 1000
|
||||
<< step 34 mscnt = 552
|
||||
<< dir=1 steps=-34
|
||||
<< dir=0 steps=34
|
||||
<< dir=1 steps=30
|
||||
<< cnt 29 step 34 mscnt = 554
|
||||
<< cnt 28 step 35 mscnt = 573
|
||||
<< cnt 27 step 36 mscnt = 589
|
||||
<< cnt 26 step 37 mscnt = 604
|
||||
<< cnt 25 step 38 mscnt = 621
|
||||
<< cnt 24 step 39 mscnt = 636
|
||||
<< cnt 23 step 40 mscnt = 652
|
||||
<< cnt 22 step 41 mscnt = 668
|
||||
<< cnt 21 step 42 mscnt = 684
|
||||
<< cnt 20 step 43 mscnt = 701
|
||||
<< cnt 19 step 44 mscnt = 717
|
||||
<< cnt 18 step 45 mscnt = 733
|
||||
<< cnt 17 step 46 mscnt = 749
|
||||
<< cnt 16 step 47 mscnt = 765
|
||||
<< cnt 15 step 48 mscnt = 781
|
||||
<< cnt 14 step 49 mscnt = 796
|
||||
<< cnt 13 step 50 mscnt = 812
|
||||
<< cnt 12 step 51 mscnt = 829
|
||||
<< cnt 11 step 52 mscnt = 844
|
||||
<< cnt 10 step 53 mscnt = 860
|
||||
<< cnt 9 step 54 mscnt = 876
|
||||
<< cnt 8 step 55 mscnt = 893
|
||||
<< cnt 7 step 56 mscnt = 909
|
||||
<< cnt 6 step 57 mscnt = 925
|
||||
<< cnt 5 step 58 mscnt = 941
|
||||
<< cnt 4 step 59 mscnt = 957
|
||||
<< cnt 3 step 60 mscnt = 973
|
||||
<< cnt 2 step 61 mscnt = 989
|
||||
<< cnt 1 step 62 mscnt = 1005
|
||||
<< cnt 0 step 63 mscnt = 1021
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< echo:busy: processing
|
||||
<< ok
|
||||
>> N216 M105*34
|
||||
<< ok T:214.8 /215.0 B:60.2 /60.0 T0:214.8 /215.0 @:33 B@:27 P:46.0 A:36.1
|
||||
>> N217 M105*35
|
||||
<< ok T:214.8 /215.0 B:60.2 /60.0 T0:214.8 /215.0 @:33 B@:27 P:46.0 A:36.1
|
||||
>> N218 M105*44
|
||||
<< ok T:214.9 /215.0 B:60.1 /60.0 T0:214.9 /215.0 @:31 B@:33 P:45.9 A:36.1
|
||||
>> N219 M105*45
|
||||
<< ok T:214.9 /215.0 B:60.1 /60.0 T0:214.9 /215.0 @:31 B@:33 P:45.9 A:36.1
|
||||
>> N220 M105*39
|
||||
<< ok T:214.9 /215.0 B:60.1 /60.0 T0:214.9 /215.0 @:31 B@:33 P:45.9 A:36.1
|
||||
>> N221 M105*38
|
||||
<< ok T:214.9 /215.0 B:60.1 /60.0 T0:214.9 /215.0 @:31 B@:33 P:45.9 A:36.1
|
||||
>> N222 M105*37
|
||||
<< ok T:214.9 /215.0 B:60.1 /60.0 T0:214.9 /215.0 @:31 B@:33 P:45.9 A:36.1
|
||||
>> N223 M105*36
|
||||
<< ok T:214.5 /215.0 B:60.1 /60.0 T0:214.5 /215.0 @:38 B@:31 P:46.0 A:36.3
|
||||
DISCONNECTED
|
553
slic3r.pl
@ -1,553 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
BEGIN {
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin/lib";
|
||||
use local::lib '--no-create', "$FindBin::Bin/local-lib";
|
||||
}
|
||||
|
||||
use File::Basename qw(basename);
|
||||
use Getopt::Long qw(:config no_auto_abbrev);
|
||||
use List::Util qw(first);
|
||||
#use POSIX qw(setlocale LC_NUMERIC);
|
||||
use Slic3r;
|
||||
use Slic3r::Geometry qw(deg2rad);
|
||||
use Time::HiRes qw(gettimeofday tv_interval);
|
||||
$|++;
|
||||
binmode STDOUT, ':utf8';
|
||||
|
||||
# Convert all parameters from the local code page to utf8 on Windows.
|
||||
@ARGV = map Slic3r::decode_path($_), @ARGV if $^O eq 'MSWin32';
|
||||
|
||||
our %opt = ();
|
||||
my %cli_options = ();
|
||||
{
|
||||
my %options = (
|
||||
'help' => sub { usage() },
|
||||
'version' => sub { print "$Slic3r::VERSION\n"; exit 0 },
|
||||
|
||||
'debug' => \$Slic3r::debug,
|
||||
'gui' => \$opt{gui},
|
||||
'no-gui' => \$opt{no_gui},
|
||||
'o|output=s' => \$opt{output},
|
||||
|
||||
'save=s' => \$opt{save},
|
||||
'load=s@' => \$opt{load},
|
||||
'autosave=s' => \$opt{autosave},
|
||||
'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config},
|
||||
'no-plater' => \$opt{no_plater},
|
||||
'gui-mode=s' => \$opt{obsolete_ignore_this_option_gui_mode},
|
||||
'datadir=s' => \$opt{datadir},
|
||||
'export-png' => \$opt{export_png},
|
||||
'merge|m' => \$opt{merge},
|
||||
'repair' => \$opt{repair},
|
||||
'cut=f' => \$opt{cut},
|
||||
'split' => \$opt{split},
|
||||
'info' => \$opt{info},
|
||||
|
||||
'scale=f' => \$opt{scale},
|
||||
'rotate=f' => \$opt{rotate},
|
||||
'duplicate=i' => \$opt{duplicate},
|
||||
'duplicate-grid=s' => \$opt{duplicate_grid},
|
||||
'print-center=s' => \$opt{print_center},
|
||||
'dont-arrange' => \$opt{dont_arrange},
|
||||
);
|
||||
foreach my $opt_key (keys %{$Slic3r::Config::Options}) {
|
||||
my $cli = $Slic3r::Config::Options->{$opt_key}->{cli} or next;
|
||||
# allow both the dash-separated option name and the full opt_key
|
||||
$options{ "$opt_key|$cli" } = \$cli_options{$opt_key};
|
||||
}
|
||||
|
||||
@ARGV = grep !/^-psn_\d/, @ARGV if $^O eq 'darwin';
|
||||
GetOptions(%options) or usage(1);
|
||||
}
|
||||
|
||||
# load configuration files
|
||||
my @external_configs = ();
|
||||
if ($opt{load}) {
|
||||
foreach my $configfile (@{$opt{load}}) {
|
||||
if (-e $configfile) {
|
||||
push @external_configs, Slic3r::Config::load($configfile);
|
||||
} elsif (-e "$FindBin::Bin/$configfile") {
|
||||
printf STDERR "Loading $FindBin::Bin/$configfile\n";
|
||||
push @external_configs, Slic3r::Config::load("$FindBin::Bin/$configfile");
|
||||
} else {
|
||||
$opt{ignore_nonexistent_config} or die "Cannot find specified configuration file ($configfile).\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# process command line options
|
||||
my $cli_config = Slic3r::Config->new;
|
||||
foreach my $c (@external_configs, Slic3r::Config->new_from_cli(%cli_options)) {
|
||||
$c->normalize; # expand shortcuts before applying, otherwise destination values would be already filled with defaults
|
||||
$cli_config->apply($c);
|
||||
}
|
||||
|
||||
# save configuration
|
||||
if ($opt{save}) {
|
||||
if (@{$cli_config->get_keys} > 0) {
|
||||
$cli_config->save($opt{save});
|
||||
} else {
|
||||
Slic3r::Config::new_from_defaults->save($opt{save});
|
||||
}
|
||||
}
|
||||
|
||||
# apply command line config on top of default config
|
||||
my $config = Slic3r::Config::new_from_defaults;
|
||||
$config->apply($cli_config);
|
||||
|
||||
# launch GUI
|
||||
my $gui;
|
||||
if ((!@ARGV || $opt{gui}) && !$opt{no_gui} && !$opt{save} && eval "require Slic3r::GUI; 1") {
|
||||
{
|
||||
no warnings 'once';
|
||||
$Slic3r::GUI::datadir = Slic3r::decode_path($opt{datadir} // '');
|
||||
$Slic3r::GUI::no_plater = $opt{no_plater};
|
||||
$Slic3r::GUI::autosave = $opt{autosave};
|
||||
}
|
||||
$gui = Slic3r::GUI->new;
|
||||
#setlocale(LC_NUMERIC, 'C');
|
||||
$gui->{mainframe}->load_config_file($_) for @{$opt{load}};
|
||||
$gui->{mainframe}->load_config($cli_config);
|
||||
my @input_files = @ARGV;
|
||||
$gui->{mainframe}{plater}->load_files(\@input_files) unless $opt{no_plater};
|
||||
$gui->MainLoop;
|
||||
exit;
|
||||
}
|
||||
die $@ if $@ && $opt{gui};
|
||||
|
||||
if (@ARGV) { # slicing from command line
|
||||
$config->validate;
|
||||
|
||||
if ($opt{repair}) {
|
||||
foreach my $file (@ARGV) {
|
||||
die "Repair is currently supported only on STL files\n"
|
||||
if $file !~ /\.[sS][tT][lL]$/;
|
||||
|
||||
my $output_file = $file;
|
||||
$output_file =~ s/\.([sS][tT][lL])$/_fixed.obj/;
|
||||
my $tmesh = Slic3r::TriangleMesh->new;
|
||||
$tmesh->ReadSTLFile($file);
|
||||
$tmesh->repair;
|
||||
$tmesh->WriteOBJFile($output_file);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($opt{cut}) {
|
||||
foreach my $file (@ARGV) {
|
||||
my $model = Slic3r::Model->read_from_file($file);
|
||||
my $mesh = $model->mesh;
|
||||
$mesh->translate(0, 0, -$mesh->bounding_box->z_min);
|
||||
my $upper = Slic3r::TriangleMesh->new;
|
||||
my $lower = Slic3r::TriangleMesh->new;
|
||||
$mesh->cut($opt{cut}, $upper, $lower);
|
||||
$upper->repair;
|
||||
$lower->repair;
|
||||
$upper->write_ascii("${file}_upper.stl")
|
||||
if $upper->facets_count > 0;
|
||||
$lower->write_ascii("${file}_lower.stl")
|
||||
if $lower->facets_count > 0;
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($opt{split}) {
|
||||
foreach my $file (@ARGV) {
|
||||
my $model = Slic3r::Model->read_from_file($file);
|
||||
my $mesh = $model->mesh;
|
||||
$mesh->repair;
|
||||
|
||||
my $part_count = 0;
|
||||
foreach my $new_mesh (@{$mesh->split}) {
|
||||
my $output_file = sprintf '%s_%02d.stl', $file, ++$part_count;
|
||||
printf "Writing to %s\n", basename($output_file);
|
||||
$new_mesh->write_binary($output_file);
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
while (my $input_file = shift @ARGV) {
|
||||
my $model;
|
||||
if ($opt{merge}) {
|
||||
my @models = map Slic3r::Model->read_from_file($_), $input_file, (splice @ARGV, 0);
|
||||
$model = Slic3r::Model->merge(@models);
|
||||
} else {
|
||||
$model = Slic3r::Model->read_from_file($input_file);
|
||||
}
|
||||
|
||||
if ($opt{info}) {
|
||||
$model->print_info;
|
||||
next;
|
||||
}
|
||||
|
||||
if (defined $opt{duplicate_grid}) {
|
||||
$opt{duplicate_grid} = [ split /[,x]/, $opt{duplicate_grid}, 2 ];
|
||||
}
|
||||
if (defined $opt{print_center}) {
|
||||
$opt{print_center} = Slic3r::Pointf->new(split /[,x]/, $opt{print_center}, 2);
|
||||
}
|
||||
|
||||
my $sprint = Slic3r::Print::Simple->new(
|
||||
scale => $opt{scale} // 1,
|
||||
rotate => deg2rad($opt{rotate} // 0),
|
||||
duplicate => $opt{duplicate} // 1,
|
||||
duplicate_grid => $opt{duplicate_grid} // [1,1],
|
||||
print_center => $opt{print_center} // Slic3r::Pointf->new(100,100),
|
||||
dont_arrange => $opt{dont_arrange} // 0,
|
||||
output_file => $opt{output},
|
||||
);
|
||||
|
||||
# This is delegated to C++ PrintObject::apply_config().
|
||||
$sprint->apply_config($config);
|
||||
$sprint->set_model($model);
|
||||
# Do the apply_config once again to validate the layer height profiles at all the newly added PrintObjects.
|
||||
$sprint->apply_config($config);
|
||||
|
||||
if ($opt{export_png}) {
|
||||
$sprint->export_png;
|
||||
} else {
|
||||
my $t0 = [gettimeofday];
|
||||
# The following call may die if the output_filename_format template substitution fails,
|
||||
# if the file cannot be written into, or if the post processing scripts cannot be executed.
|
||||
$sprint->export_gcode;
|
||||
|
||||
# output some statistics
|
||||
{
|
||||
my $duration = tv_interval($t0);
|
||||
printf "Done. Process took %d minutes and %.3f seconds\n",
|
||||
int($duration/60), ($duration - int($duration/60)*60); # % truncates to integer
|
||||
}
|
||||
printf "Filament required: %.1fmm (%.1fcm3)\n",
|
||||
$sprint->total_used_filament, $sprint->total_extruded_volume/1000;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
usage(1) unless $opt{save};
|
||||
}
|
||||
|
||||
sub usage {
|
||||
my ($exit_code) = @_;
|
||||
my $config = Slic3r::Config::new_from_defaults->as_hash;
|
||||
print <<"EOF";
|
||||
Slic3r $Slic3r::VERSION is a STL-to-GCODE translator for RepRap 3D printers
|
||||
written by Alessandro Ranellucci <aar\@cpan.org> - http://slic3r.org/
|
||||
|
||||
Usage: slic3r.pl [ OPTIONS ] [ file.stl ] [ file2.stl ] ...
|
||||
|
||||
--help Output this usage screen and exit
|
||||
--version Output the version of Slic3r and exit
|
||||
--save <file> Save configuration to the specified file
|
||||
--load <file> Load configuration from the specified file. It can be used
|
||||
more than once to load options from multiple files.
|
||||
-o, --output <file> File to output gcode to (by default, the file will be saved
|
||||
into the same directory as the input file using the
|
||||
--output-filename-format to generate the filename.) If a
|
||||
directory is specified for this option, the output will
|
||||
be saved under that directory, and the filename will be
|
||||
generated by --output-filename-format.
|
||||
|
||||
Non-slicing actions (no G-code will be generated):
|
||||
--repair Repair given STL files and save them as <name>_fixed.obj
|
||||
--cut <z> Cut given input files at given Z (relative) and export
|
||||
them as <name>_upper.stl and <name>_lower.stl
|
||||
--split Split the shells contained in given STL file into several STL files
|
||||
--info Output information about the supplied file(s) and exit
|
||||
-j, --threads <num> Number of threads to use (1+, default: $config->{threads})
|
||||
|
||||
GUI options:
|
||||
--gui Forces the GUI launch instead of command line slicing (if you
|
||||
supply a model file, it will be loaded into the plater)
|
||||
--no-plater Disable the plater tab
|
||||
--no-gui Forces the command line slicing instead of gui.
|
||||
This takes precedence over --gui if both are present.
|
||||
--autosave <file> Automatically export current configuration to the specified file
|
||||
|
||||
Output options:
|
||||
--output-filename-format
|
||||
Output file name format; all config options enclosed in brackets
|
||||
will be replaced by their values, as well as [input_filename_base]
|
||||
and [input_filename] (default: $config->{output_filename_format})
|
||||
--post-process Generated G-code will be processed with the supplied script;
|
||||
call this more than once to process through multiple scripts.
|
||||
--export-png Export zipped PNG files containing slices instead of G-code.
|
||||
-m, --merge If multiple files are supplied, they will be composed into a single
|
||||
print rather than processed individually.
|
||||
|
||||
Printer options:
|
||||
--nozzle-diameter Diameter of nozzle in mm (default: $config->{nozzle_diameter}->[0])
|
||||
--print-center Coordinates in mm of the point to center the print around
|
||||
(default: 100,100)
|
||||
--z-offset Additional height in mm to add to vertical coordinates
|
||||
(+/-, default: $config->{z_offset})
|
||||
--gcode-flavor The type of G-code to generate (reprap/teacup/repetier/makerware/sailfish/mach3/machinekit/smoothie/no-extrusion,
|
||||
default: $config->{gcode_flavor})
|
||||
--use-relative-e-distances Enable this to get relative E values (default: no)
|
||||
--use-firmware-retraction Enable firmware-controlled retraction using G10/G11 (default: no)
|
||||
--use-volumetric-e Express E in cubic millimeters and prepend M200 (default: no)
|
||||
--set-and-wait-temperatures Use M190 instead of M140 for temperature changes past the first (default: no)
|
||||
--gcode-comments Make G-code verbose by adding comments (default: no)
|
||||
|
||||
Filament options:
|
||||
--filament-diameter Diameter in mm of your raw filament (default: $config->{filament_diameter}->[0])
|
||||
--extrusion-multiplier
|
||||
Change this to alter the amount of plastic extruded. There should be
|
||||
very little need to change this value, which is only useful to
|
||||
compensate for filament packing (default: $config->{extrusion_multiplier}->[0])
|
||||
--temperature Extrusion temperature in degree Celsius, set 0 to disable (default: $config->{temperature}->[0])
|
||||
--first-layer-temperature Extrusion temperature for the first layer, in degree Celsius,
|
||||
set 0 to disable (default: same as --temperature)
|
||||
--bed-temperature Heated bed temperature in degree Celsius, set 0 to disable (default: $config->{bed_temperature}[0])
|
||||
--first-layer-bed-temperature Heated bed temperature for the first layer, in degree Celsius,
|
||||
set 0 to disable (default: same as --bed-temperature)
|
||||
|
||||
Speed options:
|
||||
--travel-speed Speed of non-print moves in mm/s (default: $config->{travel_speed})
|
||||
--perimeter-speed Speed of print moves for perimeters in mm/s (default: $config->{perimeter_speed})
|
||||
--small-perimeter-speed
|
||||
Speed of print moves for small perimeters in mm/s or % over perimeter speed
|
||||
(default: $config->{small_perimeter_speed})
|
||||
--external-perimeter-speed
|
||||
Speed of print moves for the external perimeter in mm/s or % over perimeter speed
|
||||
(default: $config->{external_perimeter_speed})
|
||||
--infill-speed Speed of print moves in mm/s (default: $config->{infill_speed})
|
||||
--solid-infill-speed Speed of print moves for solid surfaces in mm/s or % over infill speed
|
||||
(default: $config->{solid_infill_speed})
|
||||
--top-solid-infill-speed Speed of print moves for top surfaces in mm/s or % over solid infill speed
|
||||
(default: $config->{top_solid_infill_speed})
|
||||
--support-material-speed
|
||||
Speed of support material print moves in mm/s (default: $config->{support_material_speed})
|
||||
--support-material-interface-speed
|
||||
Speed of support material interface print moves in mm/s or % over support material
|
||||
speed (default: $config->{support_material_interface_speed})
|
||||
--bridge-speed Speed of bridge print moves in mm/s (default: $config->{bridge_speed})
|
||||
--gap-fill-speed Speed of gap fill print moves in mm/s (default: $config->{gap_fill_speed})
|
||||
--first-layer-speed Speed of print moves for bottom layer, expressed either as an absolute
|
||||
value or as a percentage over normal speeds (default: $config->{first_layer_speed})
|
||||
|
||||
Acceleration options:
|
||||
--perimeter-acceleration
|
||||
Overrides firmware's default acceleration for perimeters. (mm/s^2, set zero
|
||||
to disable; default: $config->{perimeter_acceleration})
|
||||
--infill-acceleration
|
||||
Overrides firmware's default acceleration for infill. (mm/s^2, set zero
|
||||
to disable; default: $config->{infill_acceleration})
|
||||
--bridge-acceleration
|
||||
Overrides firmware's default acceleration for bridges. (mm/s^2, set zero
|
||||
to disable; default: $config->{bridge_acceleration})
|
||||
--first-layer-acceleration
|
||||
Overrides firmware's default acceleration for first layer. (mm/s^2, set zero
|
||||
to disable; default: $config->{first_layer_acceleration})
|
||||
--default-acceleration
|
||||
Acceleration will be reset to this value after the specific settings above
|
||||
have been applied. (mm/s^2, set zero to disable; default: $config->{default_acceleration})
|
||||
|
||||
Accuracy options:
|
||||
--layer-height Layer height in mm (default: $config->{layer_height})
|
||||
--first-layer-height Layer height for first layer (mm or %, default: $config->{first_layer_height})
|
||||
--infill-every-layers
|
||||
Infill every N layers (default: $config->{infill_every_layers})
|
||||
--solid-infill-every-layers
|
||||
Force a solid layer every N layers (default: $config->{solid_infill_every_layers})
|
||||
|
||||
Print options:
|
||||
--perimeters Number of perimeters/horizontal skins (range: 0+, default: $config->{perimeters})
|
||||
--top-solid-layers Number of solid layers to do for top surfaces (range: 0+, default: $config->{top_solid_layers})
|
||||
--bottom-solid-layers Number of solid layers to do for bottom surfaces (range: 0+, default: $config->{bottom_solid_layers})
|
||||
--solid-layers Shortcut for setting the two options above at once
|
||||
--fill-density Infill density (range: 0%-100%, default: $config->{fill_density}%)
|
||||
--fill-angle Infill angle in degrees (range: 0-90, default: $config->{fill_angle})
|
||||
--fill-pattern Pattern to use to fill non-solid layers (default: $config->{fill_pattern})
|
||||
--top-fill-pattern Pattern to use to fill solid layers (default: $config->{top_fill_pattern})
|
||||
--bottom-fill-pattern Pattern to use to fill solid layers (default: $config->{bottom_fill_pattern})
|
||||
--start-gcode Load initial G-code from the supplied file. This will overwrite
|
||||
the default command (home all axes [G28]).
|
||||
--end-gcode Load final G-code from the supplied file. This will overwrite
|
||||
the default commands (turn off temperature [M104 S0],
|
||||
home X axis [G28 X], disable motors [M84]).
|
||||
--before-layer-gcode Load before-layer-change G-code from the supplied file (default: nothing).
|
||||
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
|
||||
--toolchange-gcode Load tool-change G-code from the supplied file (default: nothing).
|
||||
--seam-position Position of loop starting points (random/nearest/aligned, default: $config->{seam_position}).
|
||||
--external-perimeters-first Reverse perimeter order. (default: no)
|
||||
--spiral-vase Experimental option to raise Z gradually when printing single-walled vases
|
||||
(default: no)
|
||||
--only-retract-when-crossing-perimeters
|
||||
Disable retraction when travelling between infill paths inside the same island.
|
||||
(default: no)
|
||||
--solid-infill-below-area
|
||||
Force solid infill when a region has a smaller area than this threshold
|
||||
(mm^2, default: $config->{solid_infill_below_area})
|
||||
--infill-only-where-needed
|
||||
Only infill under ceilings (default: no)
|
||||
--infill-first Make infill before perimeters (default: no)
|
||||
|
||||
Quality options (slower slicing):
|
||||
--extra-perimeters Add more perimeters when needed (default: yes)
|
||||
--one-top-perimeter Only draw 1 perimeter for the top layers (default: yes)
|
||||
--ensure-vertical-shell-thickness Add solid infill near sloping surfaces to guarantee the vertical shell thickness (top+bottom solid layers). (default: no)
|
||||
--avoid-crossing-perimeters Optimize travel moves so that no perimeters are crossed (default: no)
|
||||
--thin-walls Detect single-width walls (default: yes)
|
||||
--overhangs Experimental option to use bridge flow, speed and fan for overhangs
|
||||
(default: yes)
|
||||
|
||||
Support material options:
|
||||
--support-material Generate support material for overhangs
|
||||
--support-material-threshold
|
||||
Overhang threshold angle (range: 0-90, set 0 for automatic detection,
|
||||
default: $config->{support_material_threshold})
|
||||
--support-material-pattern
|
||||
Pattern to use for support material (default: $config->{support_material_pattern})
|
||||
--support-material-with-sheath
|
||||
Add a sheath (a single perimeter line) around the base support.
|
||||
This makes the support more reliable, but also more difficult to remove. (default: yes)
|
||||
--support-material-spacing
|
||||
Spacing between pattern lines (mm, default: $config->{support_material_spacing})
|
||||
--support-material-angle
|
||||
Support material angle in degrees (range: 0-90, default: $config->{support_material_angle})
|
||||
--support-material-contact-distance
|
||||
Vertical distance between object and support material (0+, default: $config->{support_material_contact_distance})
|
||||
--support-material-xy-spacing
|
||||
"XY separation between an object and its support. If expressed as percentage (for example 50%),
|
||||
it will be calculated over external perimeter width (default: half of exteral perimeter width)
|
||||
--support-material-interface-layers
|
||||
Number of perpendicular layers between support material and object (0+, default: $config->{support_material_interface_layers})
|
||||
--support-material-interface-spacing
|
||||
Spacing between interface pattern lines (mm, set 0 to get a solid layer, default: $config->{support_material_interface_spacing})
|
||||
--raft-layers Number of layers to raise the printed objects by (range: 0+, default: $config->{raft_layers})
|
||||
--support-material-enforce-layers
|
||||
Enforce support material on the specified number of layers from bottom,
|
||||
regardless of --support-material and threshold (0+, default: $config->{support_material_enforce_layers})
|
||||
--support-material-buildplate-only
|
||||
Only create support if it lies on a build plate. Don't create support on a print. (default: no)
|
||||
--dont-support-bridges
|
||||
Experimental option for preventing support material from being generated under bridged areas (default: yes)
|
||||
|
||||
Retraction options:
|
||||
--retract-length Length of retraction in mm when pausing extrusion (default: $config->{retract_length}[0])
|
||||
--retract-speed Speed for retraction in mm/s (default: $config->{retract_speed}[0])
|
||||
--deretract-speed Speed for deretraction (loading of filament after a retract) in mm/s (default: $config->{retract_speed}[0])
|
||||
--retract-restart-extra
|
||||
Additional amount of filament in mm to push after
|
||||
compensating retraction (default: $config->{retract_restart_extra}[0])
|
||||
--retract-before-travel
|
||||
Only retract before travel moves of this length in mm (default: $config->{retract_before_travel}[0])
|
||||
--retract-lift Lift Z by the given distance in mm when retracting (default: $config->{retract_lift}[0])
|
||||
--retract-lift-above Only lift Z when above the specified height (default: $config->{retract_lift_above}[0])
|
||||
--retract-lift-below Only lift Z when below the specified height (default: $config->{retract_lift_below}[0])
|
||||
--retract-layer-change
|
||||
Enforce a retraction before each Z move (default: no)
|
||||
--wipe Wipe the nozzle while doing a retraction (default: no)
|
||||
|
||||
Retraction options for multi-extruder setups:
|
||||
--retract-length-toolchange
|
||||
Length of retraction in mm when disabling tool (default: $config->{retract_length_toolchange}[0])
|
||||
--retract-restart-extra-toolchange
|
||||
Additional amount of filament in mm to push after
|
||||
switching tool (default: $config->{retract_restart_extra_toolchange}[0])
|
||||
|
||||
Cooling options:
|
||||
--cooling Enable fan and cooling control
|
||||
--min-fan-speed Minimum fan speed (default: $config->{min_fan_speed}[0]%)
|
||||
--max-fan-speed Maximum fan speed (default: $config->{max_fan_speed}[0]%)
|
||||
--bridge-fan-speed Fan speed to use when bridging (default: $config->{bridge_fan_speed}[0]%)
|
||||
--fan-below-layer-time Enable fan if layer print time is below this approximate number
|
||||
of seconds (default: $config->{fan_below_layer_time}[0])
|
||||
--slowdown-below-layer-time Slow down if layer print time is below this approximate number
|
||||
of seconds (default: $config->{slowdown_below_layer_time}[0])
|
||||
--min-print-speed Minimum print speed (mm/s, default: $config->{min_print_speed}[0])
|
||||
--disable-fan-first-layers Disable fan for the first N layers (default: $config->{disable_fan_first_layers}[0])
|
||||
--fan-always-on Keep fan always on at min fan speed, even for layers that don't need
|
||||
cooling
|
||||
|
||||
Skirt options:
|
||||
--skirts Number of skirts to draw (0+, default: $config->{skirts})
|
||||
--skirt-distance Distance in mm between innermost skirt and object
|
||||
(default: $config->{skirt_distance})
|
||||
--skirt-height Height of skirts to draw (expressed in layers, 0+, default: $config->{skirt_height})
|
||||
--min-skirt-length Generate no less than the number of loops required to consume this length
|
||||
of filament on the first layer, for each extruder (mm, 0+, default: $config->{min_skirt_length})
|
||||
--brim-width Width of the brim that will get added to each object to help adhesion
|
||||
(mm, default: $config->{brim_width})
|
||||
|
||||
Transform options:
|
||||
--scale Factor for scaling input object (default: 1)
|
||||
--rotate Rotation angle in degrees (0-360, default: 0)
|
||||
--duplicate Number of items with auto-arrange (1+, default: 1)
|
||||
--duplicate-grid Number of items with grid arrangement (default: 1,1)
|
||||
--duplicate-distance Distance in mm between copies (default: $config->{duplicate_distance})
|
||||
--dont-arrange Don't arrange the objects on the build plate. The model coordinates
|
||||
define the absolute positions on the build plate.
|
||||
The option --print-center will be ignored.
|
||||
--clip_multipart_objects
|
||||
When printing multi-material objects, this settings will make slic3r to clip the overlapping
|
||||
object parts one by the other (2nd part will be clipped by the 1st, 3rd part will be clipped
|
||||
by the 1st and 2nd etc). (default: $config->{clip_multipart_objects})";
|
||||
--elefant-foot-compensation
|
||||
Shrink the first layer by the configured value to compensate for the 1st layer squish
|
||||
aka an Elefant Foot effect (mm, default: $config->{elefant_foot_compensation})
|
||||
--xy-size-compensation
|
||||
Grow/shrink objects by the configured absolute distance (mm, default: $config->{xy_size_compensation})
|
||||
|
||||
Sequential printing options:
|
||||
--complete-objects When printing multiple objects and/or copies, complete each one before
|
||||
starting the next one; watch out for extruder collisions (default: no)
|
||||
--extruder-clearance-radius Radius in mm above which extruder won't collide with anything
|
||||
(default: $config->{extruder_clearance_radius})
|
||||
--extruder-clearance-height Maximum vertical extruder depth; i.e. vertical distance from
|
||||
extruder tip and carriage bottom (default: $config->{extruder_clearance_height})
|
||||
|
||||
Miscellaneous options:
|
||||
--notes Notes to be added as comments to the output file
|
||||
--resolution Minimum detail resolution (mm, set zero for full resolution, default: $config->{resolution})
|
||||
|
||||
Flow options (advanced):
|
||||
--extrusion-width Set extrusion width manually; it accepts either an absolute value in mm
|
||||
(like 0.65) or a percentage over layer height (like 200%)
|
||||
--first-layer-extrusion-width
|
||||
Set a different extrusion width for first layer
|
||||
--perimeter-extrusion-width
|
||||
Set a different extrusion width for perimeters
|
||||
--external-perimeter-extrusion-width
|
||||
Set a different extrusion width for external perimeters
|
||||
--infill-extrusion-width
|
||||
Set a different extrusion width for infill
|
||||
--solid-infill-extrusion-width
|
||||
Set a different extrusion width for solid infill
|
||||
--top-infill-extrusion-width
|
||||
Set a different extrusion width for top infill
|
||||
--support-material-extrusion-width
|
||||
Set a different extrusion width for support material
|
||||
--infill-overlap Overlap between infill and perimeters (default: $config->{infill_overlap})
|
||||
--bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: $config->{bridge_flow_ratio})
|
||||
--over-bridge-flow-ratio Multiplier for extrusion when solid-filling over a bridge (> 0, default: $config->{over_bridge_flow_ratio})
|
||||
|
||||
Multiple extruder options:
|
||||
--extruder-offset Offset of each extruder, if firmware doesn't handle the displacement
|
||||
(can be specified multiple times, default: 0x0)
|
||||
--perimeter-extruder
|
||||
Extruder to use for perimeters and brim (1+, default: $config->{perimeter_extruder})
|
||||
--infill-extruder Extruder to use for infill (1+, default: $config->{infill_extruder})
|
||||
--solid-infill-extruder Extruder to use for solid infill (1+, default: $config->{solid_infill_extruder})
|
||||
--support-material-extruder
|
||||
Extruder to use for support material, raft and skirt
|
||||
(1+, 0 to use the current extruder to minimize tool changes, default: $config->{support_material_extruder})
|
||||
--support-material-interface-extruder
|
||||
Extruder to use for support material interface
|
||||
(1+, 0 to use the current extruder to minimize tool changes, default: $config->{support_material_interface_extruder})
|
||||
--ooze-prevention Drop temperature and park extruders outside a full skirt for automatic wiping
|
||||
(default: no)
|
||||
--standby-temperature-delta
|
||||
Temperature difference to be applied when an extruder is not active and
|
||||
--ooze-prevention is enabled (default: $config->{standby_temperature_delta})
|
||||
|
||||
EOF
|
||||
exit ($exit_code || 0);
|
||||
}
|
||||
|
||||
__END__
|
@ -76,7 +76,7 @@
|
||||
{
|
||||
"path": ".",
|
||||
// "folder_exclude_patterns": [".svn", "._d", ".metadata", ".settings"],
|
||||
"file_exclude_patterns": ["XS.c"]
|
||||
"file_exclude_patterns": ["XS.c", "*.pch", "*.ilk", "*.js" ]
|
||||
}
|
||||
],
|
||||
|
||||
|
@ -11,6 +11,7 @@ add_subdirectory(poly2tri)
|
||||
add_subdirectory(qhull)
|
||||
add_subdirectory(Shiny)
|
||||
add_subdirectory(semver)
|
||||
add_subdirectory(imgui)
|
||||
|
||||
# Adding libnest2d project for bin packing...
|
||||
set(LIBNEST2D_UNITTESTS ON CACHE BOOL "Force generating unittests for libnest2d")
|
||||
@ -19,7 +20,6 @@ add_subdirectory(libnest2d)
|
||||
include_directories(${LIBDIR}/qhull/src)
|
||||
#message(STATUS ${LIBDIR}/qhull/src)
|
||||
|
||||
|
||||
# ##############################################################################
|
||||
# Configure rasterizer target
|
||||
# ##############################################################################
|
||||
@ -36,23 +36,90 @@ else()
|
||||
add_subdirectory(png/zlib)
|
||||
set(ZLIB_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/png/zlib ${CMAKE_CURRENT_BINARY_DIR}/png/zlib)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
message(STATUS "ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIR}")
|
||||
add_subdirectory(png/libpng)
|
||||
set_target_properties(zlibstatic PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
set_target_properties(png_static PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
# target_include_directories(png_static PRIVATE ${ZLIB_INCLUDE_DIR})
|
||||
set(PNG_LIBRARIES png_static zlibstatic)
|
||||
set(PNG_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/png/libpng ${CMAKE_CURRENT_BINARY_DIR}/png/libpng)
|
||||
endif()
|
||||
|
||||
add_subdirectory(libslic3r)
|
||||
|
||||
if (SLIC3R_GUI)
|
||||
if(WIN32)
|
||||
message(STATUS "WXWIN environment set to: $ENV{WXWIN}")
|
||||
elseif(UNIX)
|
||||
message(STATUS "wx-config path: ${wxWidgets_CONFIG_EXECUTABLE}")
|
||||
set(wxWidgets_USE_UNICODE ON)
|
||||
if(SLIC3R_STATIC)
|
||||
set(wxWidgets_USE_STATIC ON)
|
||||
else()
|
||||
set(wxWidgets_USE_STATIC OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(wxWidgets REQUIRED COMPONENTS base core adv html gl)
|
||||
include(${wxWidgets_USE_FILE})
|
||||
endif()
|
||||
|
||||
add_subdirectory(slic3r)
|
||||
|
||||
# Create a slic3r executable
|
||||
add_executable(slic3r slic3r.cpp)
|
||||
target_link_libraries(slic3r libslic3r libslic3r_gui ${wxWidgets_LIBRARIES} ${CURL_LIBRARIES})
|
||||
# Add the OpenGL and GLU libraries.
|
||||
# Process mainfests for various platforms.
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/slic3r.rc.in ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/msw/slic3r.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/slic3r.manifest @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY)
|
||||
if (MSVC)
|
||||
add_library(slic3r SHARED slic3r.cpp)
|
||||
else ()
|
||||
add_executable(slic3r slic3r.cpp)
|
||||
endif ()
|
||||
if (NOT MSVC)
|
||||
if(SLIC3R_GUI)
|
||||
set_target_properties(slic3r PROPERTIES OUTPUT_NAME "slic3r-gui")
|
||||
else()
|
||||
set_target_properties(slic3r PROPERTIES OUTPUT_NAME "slic3r-console")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
target_link_libraries(slic3r libslic3r)
|
||||
if (APPLE)
|
||||
# add_compile_options(-stdlib=libc++)
|
||||
# add_definitions(-DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE)
|
||||
# -liconv: boost links to libiconv by default
|
||||
target_link_libraries(slic3r "-liconv -framework IOKit" "-framework CoreFoundation" -lc++)
|
||||
elseif (MSVC)
|
||||
# Manifest is provided through slic3r.rc, don't generate your own.
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MANIFEST:NO")
|
||||
else ()
|
||||
target_link_libraries(slic3r ${CMAKE_DL_LIBS} -lstdc++)
|
||||
endif ()
|
||||
|
||||
# Add the Slic3r GUI library, libcurl, OpenGL and GLU libraries.
|
||||
if (SLIC3R_GUI)
|
||||
target_link_libraries(slic3r libslic3r_gui ${wxWidgets_LIBRARIES})
|
||||
|
||||
# Configure libcurl & OpenSSL
|
||||
find_package(CURL REQUIRED)
|
||||
target_include_directories(slic3r PRIVATE ${CURL_INCLUDE_DIRS})
|
||||
target_link_libraries(slic3r CURL::libcurl)
|
||||
if (SLIC3R_STATIC)
|
||||
if (NOT APPLE)
|
||||
# libcurl is always linked dynamically to the system libcurl on OSX.
|
||||
# On other systems, libcurl is linked statically if SLIC3R_STATIC is set.
|
||||
target_compile_definitions(slic3r PRIVATE CURL_STATICLIB)
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# As of now, our build system produces a statically linked libcurl,
|
||||
# which links the OpenSSL library dynamically.
|
||||
find_package(OpenSSL REQUIRED)
|
||||
message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
|
||||
message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")
|
||||
target_include_directories(slic3r PRIVATE ${OPENSSL_INCLUDE_DIR})
|
||||
target_link_libraries(slic3r ${OPENSSL_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
target_link_libraries(slic3r user32.lib Setupapi.lib OpenGL32.Lib GlU32.Lib)
|
||||
elseif (MINGW)
|
||||
@ -60,6 +127,64 @@ if (SLIC3R_GUI)
|
||||
elseif (APPLE)
|
||||
target_link_libraries(slic3r "-framework OpenGL")
|
||||
else ()
|
||||
target_link_libraries(slic3r -lGL -lGLU)
|
||||
target_link_libraries(slic3r -ldl -lGL -lGLU)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# On Windows, a shim application is required to produce a console / non console version of the Slic3r application.
|
||||
# Also the shim may load the Mesa software OpenGL renderer if the default renderer does not support OpenGL 2.0 and higher.
|
||||
if (MSVC)
|
||||
add_executable(slic3r_app_gui WIN32 slic3r_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc)
|
||||
target_compile_definitions(slic3r_app_gui PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE -DSLIC3R_WRAPPER_GUI)
|
||||
add_dependencies(slic3r_app_gui slic3r)
|
||||
set_target_properties(slic3r_app_gui PROPERTIES OUTPUT_NAME "slic3r")
|
||||
|
||||
add_executable(slic3r_app_console slic3r_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc)
|
||||
target_compile_definitions(slic3r_app_console PRIVATE -DSLIC3R_WRAPPER_CONSOLE -DSLIC3R_WRAPPER_NOGUI)
|
||||
add_dependencies(slic3r_app_console slic3r)
|
||||
set_target_properties(slic3r_app_console PROPERTIES OUTPUT_NAME "slic3r-console")
|
||||
|
||||
add_executable(slic3r_app_noconsole WIN32 slic3r_app_msvc.cpp ${CMAKE_CURRENT_BINARY_DIR}/slic3r.rc)
|
||||
target_compile_definitions(slic3r_app_noconsole PRIVATE -DSLIC3R_WRAPPER_NOCONSOLE -DSLIC3R_WRAPPER_NOGUI)
|
||||
add_dependencies(slic3r_app_noconsole slic3r)
|
||||
set_target_properties(slic3r_app_noconsole PROPERTIES OUTPUT_NAME "slic3r-noconsole")
|
||||
endif ()
|
||||
|
||||
# Link the resources dir to where Slic3r GUI expects it
|
||||
if (MSVC)
|
||||
if (CMAKE_CONFIGURATION_TYPES)
|
||||
foreach (CONF ${CMAKE_CONFIGURATION_TYPES})
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${CONF}" WIN_CONF_OUTPUT_DIR)
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${CONF}/resources" WIN_RESOURCES_SYMLINK)
|
||||
add_custom_command(TARGET slic3r POST_BUILD
|
||||
COMMAND if exist "${WIN_CONF_OUTPUT_DIR}" "("
|
||||
if not exist "${WIN_RESOURCES_SYMLINK}" "("
|
||||
mklink /J "${WIN_RESOURCES_SYMLINK}" "${SLIC3R_RESOURCES_DIR_WIN}"
|
||||
")"
|
||||
")"
|
||||
COMMENT "Symlinking the resources directory into the build tree"
|
||||
VERBATIM
|
||||
)
|
||||
endforeach ()
|
||||
else ()
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/resources" WIN_RESOURCES_SYMLINK)
|
||||
add_custom_command(TARGET slic3r POST_BUILD
|
||||
COMMAND if not exist "${WIN_RESOURCES_SYMLINK}" "(" mklink /J "${WIN_RESOURCES_SYMLINK}" "${SLIC3R_RESOURCES_DIR_WIN}" ")"
|
||||
COMMENT "Symlinking the resources directory into the build tree"
|
||||
VERBATIM
|
||||
)
|
||||
endif ()
|
||||
elseif (XCODE)
|
||||
# Because of Debug/Release/etc. configurations (similar to MSVC) the slic3r binary is located in an extra level
|
||||
add_custom_command(TARGET slic3r POST_BUILD
|
||||
COMMAND ln -sf "${SLIC3R_RESOURCES_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/resources"
|
||||
COMMENT "Symlinking the resources directory into the build tree"
|
||||
VERBATIM
|
||||
)
|
||||
else ()
|
||||
add_custom_command(TARGET slic3r POST_BUILD
|
||||
COMMAND ln -sf "${SLIC3R_RESOURCES_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/../resources"
|
||||
COMMENT "Symlinking the resources directory into the build tree"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
|
@ -25,6 +25,9 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/detail/endian.hpp>
|
||||
|
||||
#include "stl.h"
|
||||
@ -125,11 +128,11 @@ stl_load_edge_exact(stl_file *stl, stl_hash_edge *edge,
|
||||
std::swap(a, b);
|
||||
edge->which_edge += 3; /* this edge is loaded backwards */
|
||||
}
|
||||
memcpy(&edge->key[0], a->data(), sizeof(stl_vertex));
|
||||
memcpy(&edge->key[sizeof(stl_vertex)], b->data(), sizeof(stl_vertex));
|
||||
memcpy(&edge->key[0], a->data(), sizeof(stl_vertex));
|
||||
memcpy(&edge->key[3], b->data(), sizeof(stl_vertex));
|
||||
// Switch negative zeros to positive zeros, so memcmp will consider them to be equal.
|
||||
for (size_t i = 0; i < 6; ++ i) {
|
||||
unsigned char *p = edge->key + i * 4;
|
||||
unsigned char *p = (unsigned char*)(edge->key + i);
|
||||
#ifdef BOOST_LITTLE_ENDIAN
|
||||
if (p[0] == 0 && p[1] == 0 && p[2] == 0 && p[3] == 0x80)
|
||||
// Negative zero, switch to positive zero.
|
||||
@ -142,6 +145,16 @@ stl_load_edge_exact(stl_file *stl, stl_hash_edge *edge,
|
||||
}
|
||||
}
|
||||
|
||||
static inline size_t hash_size_from_nr_faces(const size_t nr_faces)
|
||||
{
|
||||
// Good primes for addressing a cca. 30 bit space.
|
||||
// https://planetmath.org/goodhashtableprimes
|
||||
static std::vector<uint32_t> primes{ 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, 1610612741 };
|
||||
// Find a prime number for 50% filling of the shared triangle edges in the mesh.
|
||||
auto it = std::upper_bound(primes.begin(), primes.end(), nr_faces * 3 * 2 - 1);
|
||||
return (it == primes.end()) ? primes.back() : *it;
|
||||
}
|
||||
|
||||
static void
|
||||
stl_initialize_facet_check_exact(stl_file *stl) {
|
||||
int i;
|
||||
@ -152,10 +165,9 @@ stl_initialize_facet_check_exact(stl_file *stl) {
|
||||
stl->stats.freed = 0;
|
||||
stl->stats.collisions = 0;
|
||||
|
||||
stl->M = hash_size_from_nr_faces(stl->stats.number_of_facets);
|
||||
|
||||
stl->M = 81397;
|
||||
|
||||
for(i = 0; i < stl->stats.number_of_facets ; i++) {
|
||||
for (i = 0; i < stl->stats.number_of_facets ; i++) {
|
||||
/* initialize neighbors list to -1 to mark unconnected edges */
|
||||
stl->neighbors_start[i].neighbor[0] = -1;
|
||||
stl->neighbors_start[i].neighbor[1] = -1;
|
||||
@ -296,11 +308,11 @@ static int stl_load_edge_nearby(stl_file *stl, stl_hash_edge *edge, stl_vertex *
|
||||
((vertex1[1] != vertex2[1]) ?
|
||||
(vertex1[1] < vertex2[1]) :
|
||||
(vertex1[2] < vertex2[2]))) {
|
||||
memcpy(&edge->key[0], vertex1.data(), sizeof(stl_vertex));
|
||||
memcpy(&edge->key[sizeof(stl_vertex)], vertex2.data(), sizeof(stl_vertex));
|
||||
memcpy(&edge->key[0], vertex1.data(), sizeof(stl_vertex));
|
||||
memcpy(&edge->key[3], vertex2.data(), sizeof(stl_vertex));
|
||||
} else {
|
||||
memcpy(&edge->key[0], vertex2.data(), sizeof(stl_vertex));
|
||||
memcpy(&edge->key[sizeof(stl_vertex)], vertex1.data(), sizeof(stl_vertex));
|
||||
memcpy(&edge->key[0], vertex2.data(), sizeof(stl_vertex));
|
||||
memcpy(&edge->key[3], vertex1.data(), sizeof(stl_vertex));
|
||||
edge->which_edge += 3; /* this edge is loaded backwards */
|
||||
}
|
||||
return 1;
|
||||
@ -338,7 +350,7 @@ static void stl_initialize_facet_check_nearby(stl_file *stl)
|
||||
/* tolerance = STL_MAX((stl->stats.bounding_diameter / 500000.0), tolerance);*/
|
||||
/* tolerance *= 0.5;*/
|
||||
|
||||
stl->M = 81397;
|
||||
stl->M = hash_size_from_nr_faces(stl->stats.number_of_facets);
|
||||
|
||||
stl->heads = (stl_hash_edge**)calloc(stl->M, sizeof(*stl->heads));
|
||||
if(stl->heads == NULL) perror("stl_initialize_facet_check_nearby");
|
||||
|
@ -65,11 +65,11 @@ typedef struct {
|
||||
|
||||
typedef struct stl_hash_edge {
|
||||
// Key of a hash edge: sorted vertices of the edge.
|
||||
unsigned char key[2 * sizeof(stl_vertex)];
|
||||
uint32_t key[6];
|
||||
// Compare two keys.
|
||||
bool operator==(const stl_hash_edge &rhs) { return memcmp(key, rhs.key, sizeof(key)) == 0; }
|
||||
bool operator!=(const stl_hash_edge &rhs) { return ! (*this == rhs); }
|
||||
int hash(int M) const { return ((key[0] / 23 + key[1] / 19 + key[2] / 17 + key[3] /13 + key[4] / 11 + key[5] / 7 ) % M); }
|
||||
int hash(int M) const { return ((key[0] / 11 + key[1] / 7 + key[2] / 3) ^ (key[3] / 11 + key[4] / 7 + key[5] / 3)) % M; }
|
||||
// Index of a facet owning this edge.
|
||||
int facet_number;
|
||||
// Index of this edge inside the facet with an index of facet_number.
|
||||
@ -173,7 +173,7 @@ extern void stl_mirror_xy(stl_file *stl);
|
||||
extern void stl_mirror_yz(stl_file *stl);
|
||||
extern void stl_mirror_xz(stl_file *stl);
|
||||
extern void stl_transform(stl_file *stl, float *trafo3x4);
|
||||
extern void stl_transform(stl_file *stl, const Eigen::Transform<float, 3, Eigen::Affine, Eigen::DontAlign>& t);
|
||||
extern void stl_transform(stl_file *stl, const Eigen::Transform<double, 3, Eigen::Affine, Eigen::DontAlign>& t);
|
||||
extern void stl_open_merge(stl_file *stl, char *file);
|
||||
extern void stl_invalidate_shared_vertices(stl_file *stl);
|
||||
extern void stl_generate_shared_vertices(stl_file *stl);
|
||||
@ -189,7 +189,7 @@ inline void stl_normalize_vector(stl_normal &normal) {
|
||||
if (length < 0.000000000001)
|
||||
normal = stl_normal::Zero();
|
||||
else
|
||||
normal *= (1.0 / length);
|
||||
normal *= float(1.0 / length);
|
||||
}
|
||||
inline bool stl_vertex_lower(const stl_vertex &a, const stl_vertex &b) {
|
||||
return (a(0) != b(0)) ? (a(0) < b(0)) :
|
||||
|
@ -155,7 +155,7 @@ void stl_transform(stl_file *stl, float *trafo3x4) {
|
||||
calculate_normals(stl);
|
||||
}
|
||||
|
||||
void stl_transform(stl_file *stl, const Eigen::Transform<float, 3, Eigen::Affine, Eigen::DontAlign>& t)
|
||||
void stl_transform(stl_file *stl, const Eigen::Transform<double, 3, Eigen::Affine, Eigen::DontAlign>& t)
|
||||
{
|
||||
if (stl->error)
|
||||
return;
|
||||
@ -178,7 +178,7 @@ void stl_transform(stl_file *stl, const Eigen::Transform<float, 3, Eigen::Affine
|
||||
}
|
||||
|
||||
Eigen::MatrixXf dst_vertices(3, vertices_count);
|
||||
dst_vertices = t * src_vertices.colwise().homogeneous();
|
||||
dst_vertices = t.cast<float>() * src_vertices.colwise().homogeneous();
|
||||
|
||||
facet_ptr = stl->facet_start;
|
||||
v_id = 0;
|
||||
|
@ -66,7 +66,7 @@ set(AVRDUDE_SOURCES
|
||||
avrdude-slic3r.hpp
|
||||
avrdude-slic3r.cpp
|
||||
)
|
||||
if (WIN32)
|
||||
if (MSVC)
|
||||
set(AVRDUDE_SOURCES ${AVRDUDE_SOURCES}
|
||||
windows/unistd.cpp
|
||||
windows/getopt.c
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if !defined(WIN32NATIVE)
|
||||
#if !defined(WIN32NATIVE) || defined(__GNUC__)
|
||||
# include <sys/time.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
|
@ -146,7 +146,7 @@ void SparseLUImpl<Scalar,StorageIndex>::panel_bmod(const Index m, const Index w,
|
||||
|
||||
Index ldl = internal::first_multiple<Index>(nrow, PacketSize);
|
||||
Index offset = (PacketSize-internal::first_default_aligned(B.data(), PacketSize)) % PacketSize;
|
||||
MappedMatrixBlock L(tempv.data()+w*ldu+offset, nrow, u_cols, OuterStride<>(ldl));
|
||||
auto L = MappedMatrixBlock(tempv.data()+w*ldu+offset, nrow, u_cols, OuterStride<>(ldl));
|
||||
|
||||
L.setZero();
|
||||
internal::sparselu_gemm<Scalar>(L.rows(), L.cols(), B.cols(), B.data(), B.outerStride(), U.data(), U.outerStride(), L.data(), L.outerStride());
|
||||
|
1076
src/igl/AABB.cpp
Normal file
416
src/igl/AABB.h
Normal file
@ -0,0 +1,416 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_AABB_H
|
||||
#define IGL_AABB_H
|
||||
|
||||
#include "Hit.h"
|
||||
#include "igl_inline.h"
|
||||
#include <Eigen/Core>
|
||||
#include <Eigen/Geometry>
|
||||
#include <vector>
|
||||
namespace igl
|
||||
{
|
||||
// Implementation of semi-general purpose axis-aligned bounding box hierarchy.
|
||||
// The mesh (V,Ele) is stored and managed by the caller and each routine here
|
||||
// simply takes it as references (it better not change between calls).
|
||||
//
|
||||
// It's a little annoying that the Dimension is a template parameter and not
|
||||
// picked up at run time from V. This leads to duplicated code for 2d/3d (up to
|
||||
// dim).
|
||||
template <typename DerivedV, int DIM>
|
||||
class AABB
|
||||
{
|
||||
public:
|
||||
typedef typename DerivedV::Scalar Scalar;
|
||||
typedef Eigen::Matrix<Scalar,1,DIM> RowVectorDIMS;
|
||||
typedef Eigen::Matrix<Scalar,DIM,1> VectorDIMS;
|
||||
typedef Eigen::Matrix<Scalar,Eigen::Dynamic,DIM> MatrixXDIMS;
|
||||
// Shared pointers are slower...
|
||||
AABB * m_left;
|
||||
AABB * m_right;
|
||||
Eigen::AlignedBox<Scalar,DIM> m_box;
|
||||
// -1 non-leaf
|
||||
int m_primitive;
|
||||
//Scalar m_low_sqr_d;
|
||||
//int m_depth;
|
||||
AABB():
|
||||
m_left(NULL), m_right(NULL),
|
||||
m_box(), m_primitive(-1)
|
||||
//m_low_sqr_d(std::numeric_limits<double>::infinity()),
|
||||
//m_depth(0)
|
||||
{}
|
||||
// http://stackoverflow.com/a/3279550/148668
|
||||
AABB(const AABB& other):
|
||||
m_left(other.m_left ? new AABB(*other.m_left) : NULL),
|
||||
m_right(other.m_right ? new AABB(*other.m_right) : NULL),
|
||||
m_box(other.m_box),
|
||||
m_primitive(other.m_primitive)
|
||||
//m_low_sqr_d(other.m_low_sqr_d),
|
||||
//m_depth(std::max(
|
||||
// m_left ? m_left->m_depth + 1 : 0,
|
||||
// m_right ? m_right->m_depth + 1 : 0))
|
||||
{
|
||||
}
|
||||
// copy-swap idiom
|
||||
friend void swap(AABB& first, AABB& second)
|
||||
{
|
||||
// Enable ADL
|
||||
using std::swap;
|
||||
swap(first.m_left,second.m_left);
|
||||
swap(first.m_right,second.m_right);
|
||||
swap(first.m_box,second.m_box);
|
||||
swap(first.m_primitive,second.m_primitive);
|
||||
//swap(first.m_low_sqr_d,second.m_low_sqr_d);
|
||||
//swap(first.m_depth,second.m_depth);
|
||||
}
|
||||
AABB& operator=(const AABB &other)
|
||||
{
|
||||
this->deinit();
|
||||
m_left = other.m_left ? new AABB(*other.m_left) : NULL;
|
||||
m_right = other.m_right ? new AABB(*other.m_right) : NULL;
|
||||
m_box = other.m_box;
|
||||
m_primitive = other.m_primitive;
|
||||
return *this;
|
||||
}
|
||||
AABB(AABB&& other):
|
||||
// initialize via default constructor
|
||||
AABB()
|
||||
{
|
||||
swap(*this,other);
|
||||
}
|
||||
// Seems like there should have been an elegant solution to this using
|
||||
// the copy-swap idiom above:
|
||||
IGL_INLINE void deinit()
|
||||
{
|
||||
m_primitive = -1;
|
||||
m_box = Eigen::AlignedBox<Scalar,DIM>();
|
||||
delete m_left;
|
||||
m_left = NULL;
|
||||
delete m_right;
|
||||
m_right = NULL;
|
||||
}
|
||||
~AABB()
|
||||
{
|
||||
deinit();
|
||||
}
|
||||
// Build an Axis-Aligned Bounding Box tree for a given mesh and given
|
||||
// serialization of a previous AABB tree.
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by dim list of mesh vertex positions.
|
||||
// Ele #Ele by dim+1 list of mesh indices into #V.
|
||||
// bb_mins max_tree by dim list of bounding box min corner positions
|
||||
// bb_maxs max_tree by dim list of bounding box max corner positions
|
||||
// elements max_tree list of element or (not leaf id) indices into Ele
|
||||
// i recursive call index {0}
|
||||
template <
|
||||
typename DerivedEle,
|
||||
typename Derivedbb_mins,
|
||||
typename Derivedbb_maxs,
|
||||
typename Derivedelements>
|
||||
IGL_INLINE void init(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<Derivedbb_mins> & bb_mins,
|
||||
const Eigen::MatrixBase<Derivedbb_maxs> & bb_maxs,
|
||||
const Eigen::MatrixBase<Derivedelements> & elements,
|
||||
const int i = 0);
|
||||
// Wrapper for root with empty serialization
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE void init(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele);
|
||||
// Build an Axis-Aligned Bounding Box tree for a given mesh.
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by dim list of mesh vertex positions.
|
||||
// Ele #Ele by dim+1 list of mesh indices into #V.
|
||||
// SI #Ele by dim list revealing for each coordinate where Ele's
|
||||
// barycenters would be sorted: SI(e,d) = i --> the dth coordinate of
|
||||
// the barycenter of the eth element would be placed at position i in a
|
||||
// sorted list.
|
||||
// I #I list of indices into Ele of elements to include (for recursive
|
||||
// calls)
|
||||
//
|
||||
template <typename DerivedEle, typename DerivedSI, typename DerivedI>
|
||||
IGL_INLINE void init(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedSI> & SI,
|
||||
const Eigen::MatrixBase<DerivedI>& I);
|
||||
// Return whether at leaf node
|
||||
IGL_INLINE bool is_leaf() const;
|
||||
// Find the indices of elements containing given point: this makes sense
|
||||
// when Ele is a co-dimension 0 simplex (tets in 3D, triangles in 2D).
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by dim list of mesh vertex positions. **Should be same as used to
|
||||
// construct mesh.**
|
||||
// Ele #Ele by dim+1 list of mesh indices into #V. **Should be same as used to
|
||||
// construct mesh.**
|
||||
// q dim row-vector query position
|
||||
// first whether to only return first element containing q
|
||||
// Returns:
|
||||
// list of indices of elements containing q
|
||||
template <typename DerivedEle, typename Derivedq>
|
||||
IGL_INLINE std::vector<int> find(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<Derivedq> & q,
|
||||
const bool first=false) const;
|
||||
|
||||
// If number of elements m then total tree size should be 2*h where h is
|
||||
// the deepest depth 2^ceil(log(#Ele*2-1))
|
||||
IGL_INLINE int subtree_size() const;
|
||||
|
||||
// Serialize this class into 3 arrays (so we can pass it pack to matlab)
|
||||
//
|
||||
// Outputs:
|
||||
// bb_mins max_tree by dim list of bounding box min corner positions
|
||||
// bb_maxs max_tree by dim list of bounding box max corner positions
|
||||
// elements max_tree list of element or (not leaf id) indices into Ele
|
||||
// i recursive call index into these arrays {0}
|
||||
template <
|
||||
typename Derivedbb_mins,
|
||||
typename Derivedbb_maxs,
|
||||
typename Derivedelements>
|
||||
IGL_INLINE void serialize(
|
||||
Eigen::PlainObjectBase<Derivedbb_mins> & bb_mins,
|
||||
Eigen::PlainObjectBase<Derivedbb_maxs> & bb_maxs,
|
||||
Eigen::PlainObjectBase<Derivedelements> & elements,
|
||||
const int i = 0) const;
|
||||
// Compute squared distance to a query point
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by dim list of vertex positions
|
||||
// Ele #Ele by dim list of simplex indices
|
||||
// p dim-long query point
|
||||
// Outputs:
|
||||
// i facet index corresponding to smallest distances
|
||||
// c closest point
|
||||
// Returns squared distance
|
||||
//
|
||||
// Known bugs: currently assumes Elements are triangles regardless of
|
||||
// dimension.
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE Scalar squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
int & i,
|
||||
Eigen::PlainObjectBase<RowVectorDIMS> & c) const;
|
||||
//private:
|
||||
// Compute squared distance to a query point
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by dim list of vertex positions
|
||||
// Ele #Ele by dim list of simplex indices
|
||||
// p dim-long query point
|
||||
// low_sqr_d lower bound on squared distance, specified maximum squared
|
||||
// distance
|
||||
// up_sqr_d current upper bounded on squared distance, current minimum
|
||||
// squared distance (only consider distances less than this), see
|
||||
// output.
|
||||
// Outputs:
|
||||
// up_sqr_d updated current minimum squared distance
|
||||
// i facet index corresponding to smallest distances
|
||||
// c closest point
|
||||
// Returns squared distance
|
||||
//
|
||||
// Known bugs: currently assumes Elements are triangles regardless of
|
||||
// dimension.
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE Scalar squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
const Scalar low_sqr_d,
|
||||
const Scalar up_sqr_d,
|
||||
int & i,
|
||||
Eigen::PlainObjectBase<RowVectorDIMS> & c) const;
|
||||
// Default low_sqr_d
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE Scalar squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
const Scalar up_sqr_d,
|
||||
int & i,
|
||||
Eigen::PlainObjectBase<RowVectorDIMS> & c) const;
|
||||
// All hits
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE bool intersect_ray(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & origin,
|
||||
const RowVectorDIMS & dir,
|
||||
std::vector<igl::Hit> & hits) const;
|
||||
// First hit
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE bool intersect_ray(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & origin,
|
||||
const RowVectorDIMS & dir,
|
||||
igl::Hit & hit) const;
|
||||
//private:
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE bool intersect_ray(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & origin,
|
||||
const RowVectorDIMS & dir,
|
||||
const Scalar min_t,
|
||||
igl::Hit & hit) const;
|
||||
|
||||
|
||||
public:
|
||||
// Compute the squared distance from all query points in P to the
|
||||
// _closest_ points on the primitives stored in the AABB hierarchy for
|
||||
// the mesh (V,Ele).
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by dim list of vertex positions
|
||||
// Ele #Ele by dim list of simplex indices
|
||||
// P #P by dim list of query points
|
||||
// Outputs:
|
||||
// sqrD #P list of squared distances
|
||||
// I #P list of indices into Ele of closest primitives
|
||||
// C #P by dim list of closest points
|
||||
template <
|
||||
typename DerivedEle,
|
||||
typename DerivedP,
|
||||
typename DerivedsqrD,
|
||||
typename DerivedI,
|
||||
typename DerivedC>
|
||||
IGL_INLINE void squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const Eigen::MatrixBase<DerivedP> & P,
|
||||
Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
|
||||
Eigen::PlainObjectBase<DerivedI> & I,
|
||||
Eigen::PlainObjectBase<DerivedC> & C) const;
|
||||
|
||||
// Compute the squared distance from all query points in P already stored
|
||||
// in its own AABB hierarchy to the _closest_ points on the primitives
|
||||
// stored in the AABB hierarchy for the mesh (V,Ele).
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by dim list of vertex positions
|
||||
// Ele #Ele by dim list of simplex indices
|
||||
// other AABB hierarchy of another set of primitives (must be points)
|
||||
// other_V #other_V by dim list of query points
|
||||
// other_Ele #other_Ele by ss list of simplex indices into other_V
|
||||
// (must be simple list of points: ss == 1)
|
||||
// Outputs:
|
||||
// sqrD #P list of squared distances
|
||||
// I #P list of indices into Ele of closest primitives
|
||||
// C #P by dim list of closest points
|
||||
template <
|
||||
typename DerivedEle,
|
||||
typename Derivedother_V,
|
||||
typename Derivedother_Ele,
|
||||
typename DerivedsqrD,
|
||||
typename DerivedI,
|
||||
typename DerivedC>
|
||||
IGL_INLINE void squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const AABB<Derivedother_V,DIM> & other,
|
||||
const Eigen::MatrixBase<Derivedother_V> & other_V,
|
||||
const Eigen::MatrixBase<Derivedother_Ele> & other_Ele,
|
||||
Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
|
||||
Eigen::PlainObjectBase<DerivedI> & I,
|
||||
Eigen::PlainObjectBase<DerivedC> & C) const;
|
||||
private:
|
||||
template <
|
||||
typename DerivedEle,
|
||||
typename Derivedother_V,
|
||||
typename Derivedother_Ele,
|
||||
typename DerivedsqrD,
|
||||
typename DerivedI,
|
||||
typename DerivedC>
|
||||
IGL_INLINE Scalar squared_distance_helper(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const AABB<Derivedother_V,DIM> * other,
|
||||
const Eigen::MatrixBase<Derivedother_V> & other_V,
|
||||
const Eigen::MatrixBase<Derivedother_Ele>& other_Ele,
|
||||
const Scalar up_sqr_d,
|
||||
Eigen::PlainObjectBase<DerivedsqrD> & sqrD,
|
||||
Eigen::PlainObjectBase<DerivedI> & I,
|
||||
Eigen::PlainObjectBase<DerivedC> & C) const;
|
||||
// Compute the squared distance to the primitive in this node: assumes
|
||||
// that this is indeed a leaf node.
|
||||
//
|
||||
// Inputs:
|
||||
// V #V by dim list of vertex positions
|
||||
// Ele #Ele by dim list of simplex indices
|
||||
// p dim-long query point
|
||||
// sqr_d current minimum distance for this query, see output
|
||||
// i current index into Ele of closest point, see output
|
||||
// c dim-long current closest point, see output
|
||||
// Outputs:
|
||||
// sqr_d minimum of initial value and squared distance to this
|
||||
// primitive
|
||||
// i possibly updated index into Ele of closest point
|
||||
// c dim-long possibly updated closest point
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE void leaf_squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
const Scalar low_sqr_d,
|
||||
Scalar & sqr_d,
|
||||
int & i,
|
||||
Eigen::PlainObjectBase<RowVectorDIMS> & c) const;
|
||||
// Default low_sqr_d
|
||||
template <typename DerivedEle>
|
||||
IGL_INLINE void leaf_squared_distance(
|
||||
const Eigen::MatrixBase<DerivedV> & V,
|
||||
const Eigen::MatrixBase<DerivedEle> & Ele,
|
||||
const RowVectorDIMS & p,
|
||||
Scalar & sqr_d,
|
||||
int & i,
|
||||
Eigen::PlainObjectBase<RowVectorDIMS> & c) const;
|
||||
// If new distance (sqr_d_candidate) is less than current distance
|
||||
// (sqr_d), then update this distance and its associated values
|
||||
// _in-place_:
|
||||
//
|
||||
// Inputs:
|
||||
// p dim-long query point (only used in DEBUG mode)
|
||||
// sqr_d candidate minimum distance for this query, see output
|
||||
// i candidate index into Ele of closest point, see output
|
||||
// c dim-long candidate closest point, see output
|
||||
// sqr_d current minimum distance for this query, see output
|
||||
// i current index into Ele of closest point, see output
|
||||
// c dim-long current closest point, see output
|
||||
// Outputs:
|
||||
// sqr_d minimum of initial value and squared distance to this
|
||||
// primitive
|
||||
// i possibly updated index into Ele of closest point
|
||||
// c dim-long possibly updated closest point
|
||||
IGL_INLINE void set_min(
|
||||
const RowVectorDIMS & p,
|
||||
const Scalar sqr_d_candidate,
|
||||
const int i_candidate,
|
||||
const RowVectorDIMS & c_candidate,
|
||||
Scalar & sqr_d,
|
||||
int & i,
|
||||
Eigen::PlainObjectBase<RowVectorDIMS> & c) const;
|
||||
public:
|
||||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#ifndef IGL_STATIC_LIBRARY
|
||||
# include "AABB.cpp"
|
||||
#endif
|
||||
|
||||
#endif
|
36
src/igl/ARAPEnergyType.h
Normal file
@ -0,0 +1,36 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_ARAPENERGYTYPE_H
|
||||
#define IGL_ARAPENERGYTYPE_H
|
||||
namespace igl
|
||||
{
|
||||
// ARAP_ENERGY_TYPE_SPOKES "As-rigid-as-possible Surface Modeling" by [Sorkine and
|
||||
// Alexa 2007], rotations defined at vertices affecting incident edges,
|
||||
// default
|
||||
// ARAP_ENERGY_TYPE_SPOKES-AND-RIMS Adapted version of "As-rigid-as-possible Surface
|
||||
// Modeling" by [Sorkine and Alexa 2007] presented in section 4.2 of or
|
||||
// "A simple geometric model for elastic deformation" by [Chao et al.
|
||||
// 2010], rotations defined at vertices affecting incident edges and
|
||||
// opposite edges
|
||||
// ARAP_ENERGY_TYPE_ELEMENTS "A local-global approach to mesh parameterization" by
|
||||
// [Liu et al. 2010] or "A simple geometric model for elastic
|
||||
// deformation" by [Chao et al. 2010], rotations defined at elements
|
||||
// (triangles or tets)
|
||||
// ARAP_ENERGY_TYPE_DEFAULT Choose one automatically: spokes and rims
|
||||
// for surfaces, elements for planar meshes and tets (not fully
|
||||
// supported)
|
||||
enum ARAPEnergyType
|
||||
{
|
||||
ARAP_ENERGY_TYPE_SPOKES = 0,
|
||||
ARAP_ENERGY_TYPE_SPOKES_AND_RIMS = 1,
|
||||
ARAP_ENERGY_TYPE_ELEMENTS = 2,
|
||||
ARAP_ENERGY_TYPE_DEFAULT = 3,
|
||||
NUM_ARAP_ENERGY_TYPES = 4
|
||||
};
|
||||
}
|
||||
#endif
|
130
src/igl/AtA_cached.cpp
Normal file
@ -0,0 +1,130 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2017 Daniele Panozzo <daniele.panozzo@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#include "AtA_cached.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
template <typename Scalar>
|
||||
IGL_INLINE void igl::AtA_cached_precompute(
|
||||
const Eigen::SparseMatrix<Scalar>& A,
|
||||
igl::AtA_cached_data& data,
|
||||
Eigen::SparseMatrix<Scalar>& AtA)
|
||||
{
|
||||
// 1 Compute At (this could be avoided, but performance-wise it will not make a difference)
|
||||
std::vector<std::vector<int> > Col_RowPtr;
|
||||
std::vector<std::vector<int> > Col_IndexPtr;
|
||||
|
||||
Col_RowPtr.resize(A.cols());
|
||||
Col_IndexPtr.resize(A.cols());
|
||||
|
||||
for (unsigned k=0; k<A.outerSize(); ++k)
|
||||
{
|
||||
unsigned outer_index = *(A.outerIndexPtr()+k);
|
||||
unsigned next_outer_index = (k+1 == A.outerSize()) ? A.nonZeros() : *(A.outerIndexPtr()+k+1);
|
||||
|
||||
for (unsigned l=outer_index; l<next_outer_index; ++l)
|
||||
{
|
||||
int col = k;
|
||||
int row = *(A.innerIndexPtr()+l);
|
||||
int value_index = l;
|
||||
assert(col < A.cols());
|
||||
assert(col >= 0);
|
||||
assert(row < A.rows());
|
||||
assert(row >= 0);
|
||||
assert(value_index >= 0);
|
||||
assert(value_index < A.nonZeros());
|
||||
|
||||
Col_RowPtr[col].push_back(row);
|
||||
Col_IndexPtr[col].push_back(value_index);
|
||||
}
|
||||
}
|
||||
|
||||
Eigen::SparseMatrix<Scalar> At = A.transpose();
|
||||
At.makeCompressed();
|
||||
AtA = At * A;
|
||||
AtA.makeCompressed();
|
||||
|
||||
assert(AtA.isCompressed());
|
||||
|
||||
// If weights are not provided, use 1
|
||||
if (data.W.size() == 0)
|
||||
data.W = Eigen::VectorXd::Ones(A.rows());
|
||||
assert(data.W.size() == A.rows());
|
||||
|
||||
data.I_outer.reserve(AtA.outerSize());
|
||||
data.I_row.reserve(2*AtA.nonZeros());
|
||||
data.I_col.reserve(2*AtA.nonZeros());
|
||||
data.I_w.reserve(2*AtA.nonZeros());
|
||||
|
||||
// 2 Construct the rules
|
||||
for (unsigned k=0; k<AtA.outerSize(); ++k)
|
||||
{
|
||||
unsigned outer_index = *(AtA.outerIndexPtr()+k);
|
||||
unsigned next_outer_index = (k+1 == AtA.outerSize()) ? AtA.nonZeros() : *(AtA.outerIndexPtr()+k+1);
|
||||
|
||||
for (unsigned l=outer_index; l<next_outer_index; ++l)
|
||||
{
|
||||
int col = k;
|
||||
int row = *(AtA.innerIndexPtr()+l);
|
||||
int value_index = l;
|
||||
assert(col < AtA.cols());
|
||||
assert(col >= 0);
|
||||
assert(row < AtA.rows());
|
||||
assert(row >= 0);
|
||||
assert(value_index >= 0);
|
||||
assert(value_index < AtA.nonZeros());
|
||||
|
||||
data.I_outer.push_back(data.I_row.size());
|
||||
|
||||
// Find correspondences
|
||||
unsigned i=0;
|
||||
unsigned j=0;
|
||||
while (i<Col_RowPtr[row].size() && j<Col_RowPtr[col].size())
|
||||
{
|
||||
if (Col_RowPtr[row][i] == Col_RowPtr[col][j])
|
||||
{
|
||||
data.I_row.push_back(Col_IndexPtr[row][i]);
|
||||
data.I_col.push_back(Col_IndexPtr[col][j]);
|
||||
data.I_w.push_back(Col_RowPtr[col][j]);
|
||||
++i;
|
||||
++j;
|
||||
} else
|
||||
if (Col_RowPtr[row][i] > Col_RowPtr[col][j])
|
||||
++j;
|
||||
else
|
||||
++i;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
data.I_outer.push_back(data.I_row.size()); // makes it more efficient to iterate later on
|
||||
|
||||
igl::AtA_cached(A,data,AtA);
|
||||
}
|
||||
|
||||
template <typename Scalar>
|
||||
IGL_INLINE void igl::AtA_cached(
|
||||
const Eigen::SparseMatrix<Scalar>& A,
|
||||
const igl::AtA_cached_data& data,
|
||||
Eigen::SparseMatrix<Scalar>& AtA)
|
||||
{
|
||||
for (unsigned i=0; i<data.I_outer.size()-1; ++i)
|
||||
{
|
||||
*(AtA.valuePtr() + i) = 0;
|
||||
for (unsigned j=data.I_outer[i]; j<data.I_outer[i+1]; ++j)
|
||||
*(AtA.valuePtr() + i) += *(A.valuePtr() + data.I_row[j]) * data.W[data.I_w[j]] * *(A.valuePtr() + data.I_col[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
template void igl::AtA_cached<double>(Eigen::SparseMatrix<double, 0, int> const&, igl::AtA_cached_data const&, Eigen::SparseMatrix<double, 0, int>&);
|
||||
template void igl::AtA_cached_precompute<double>(Eigen::SparseMatrix<double, 0, int> const&, igl::AtA_cached_data&, Eigen::SparseMatrix<double, 0, int>&);
|
||||
#endif
|
70
src/igl/AtA_cached.h
Normal file
@ -0,0 +1,70 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2017 Daniele Panozzo <daniele.panozzo@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_ATA_CACHED_H
|
||||
#define IGL_ATA_CACHED_H
|
||||
#include "igl_inline.h"
|
||||
#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
|
||||
#include <Eigen/Dense>
|
||||
#include <Eigen/Sparse>
|
||||
namespace igl
|
||||
{
|
||||
struct AtA_cached_data
|
||||
{
|
||||
// Weights
|
||||
Eigen::VectorXd W;
|
||||
|
||||
// Flatten composition rules
|
||||
std::vector<int> I_row;
|
||||
std::vector<int> I_col;
|
||||
std::vector<int> I_w;
|
||||
|
||||
// For each entry of AtA, points to the beginning
|
||||
// of the composition rules
|
||||
std::vector<int> I_outer;
|
||||
};
|
||||
|
||||
// Computes At * W * A, where A is sparse and W is diagonal. Divides the
|
||||
// construction in two phases, one
|
||||
// for fixing the sparsity pattern, and one to populate it with values. Compared to
|
||||
// evaluating it directly, this version is slower for the first time (since it requires a
|
||||
// precomputation), but faster to the subsequent evaluations.
|
||||
//
|
||||
// Input:
|
||||
// A m x n sparse matrix
|
||||
// data stores the precomputed sparsity pattern, data.W contains the optional diagonal weights (stored as a dense vector). If W is not provided, it is replaced by the identity.
|
||||
// Outputs:
|
||||
// AtA m by m matrix computed as AtA * W * A
|
||||
//
|
||||
// Example:
|
||||
// AtA_data = igl::AtA_cached_data();
|
||||
// AtA_data.W = W;
|
||||
// if (s.AtA.rows() == 0)
|
||||
// igl::AtA_cached_precompute(s.A,s.AtA_data,s.AtA);
|
||||
// else
|
||||
// igl::AtA_cached(s.A,s.AtA_data,s.AtA);
|
||||
template <typename Scalar>
|
||||
IGL_INLINE void AtA_cached_precompute(
|
||||
const Eigen::SparseMatrix<Scalar>& A,
|
||||
AtA_cached_data& data,
|
||||
Eigen::SparseMatrix<Scalar>& AtA
|
||||
);
|
||||
|
||||
template <typename Scalar>
|
||||
IGL_INLINE void AtA_cached(
|
||||
const Eigen::SparseMatrix<Scalar>& A,
|
||||
const AtA_cached_data& data,
|
||||
Eigen::SparseMatrix<Scalar>& AtA
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
#ifndef IGL_STATIC_LIBRARY
|
||||
# include "AtA_cached.cpp"
|
||||
#endif
|
||||
|
||||
#endif
|
18
src/igl/C_STR.h
Normal file
@ -0,0 +1,18 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_C_STR_H
|
||||
#define IGL_C_STR_H
|
||||
// http://stackoverflow.com/a/2433143/148668
|
||||
// Suppose you have a function:
|
||||
// void func(const char * c);
|
||||
// Then you can write:
|
||||
// func(C_STR("foo"<<1<<"bar"));
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#define C_STR(X) static_cast<std::ostringstream&>(std::ostringstream().flush() << X).str().c_str()
|
||||
#endif
|
359
src/igl/Camera.h
Normal file
@ -0,0 +1,359 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#ifndef IGL_CAMERA_H
|
||||
#define IGL_CAMERA_H
|
||||
|
||||
// you're idiot, M$!
|
||||
#if defined(_WIN32)
|
||||
#undef far
|
||||
#undef near
|
||||
#endif
|
||||
|
||||
#include <Eigen/Geometry>
|
||||
#include <Eigen/Core>
|
||||
#include <PI.h>
|
||||
|
||||
#define IGL_CAMERA_MIN_ANGLE 5.0
|
||||
namespace igl
|
||||
{
|
||||
|
||||
// A simple camera class. The camera stores projection parameters (field of
|
||||
// view angle, aspect ratio, near and far clips) as well as a rigid
|
||||
// transformation *of the camera as if it were also a scene object*. Thus, the
|
||||
// **inverse** of this rigid transformation is the modelview transformation.
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
// On windows you might need: -fno-delayed-template-parsing
|
||||
//static constexpr double IGL_CAMERA_MIN_ANGLE = 5.;
|
||||
// m_angle Field of view angle in degrees {45}
|
||||
// m_aspect Aspect ratio {1}
|
||||
// m_near near clipping plane {1e-2}
|
||||
// m_far far clipping plane {100}
|
||||
// m_at_dist distance of looking at point {1}
|
||||
// m_orthographic whether to use othrographic projection {false}
|
||||
// m_rotation_conj Conjugate of rotation part of rigid transformation of
|
||||
// camera {identity}. Note: we purposefully store the conjugate because
|
||||
// this is what TW_TYPE_QUAT4D is expecting.
|
||||
// m_translation Translation part of rigid transformation of camera
|
||||
// {(0,0,1)}
|
||||
double m_angle, m_aspect, m_near, m_far, m_at_dist;
|
||||
bool m_orthographic;
|
||||
Eigen::Quaterniond m_rotation_conj;
|
||||
Eigen::Vector3d m_translation;
|
||||
public:
|
||||
inline Camera();
|
||||
inline virtual ~Camera(){}
|
||||
// Return projection matrix that takes relative camera coordinates and
|
||||
// transforms it to viewport coordinates
|
||||
//
|
||||
// Note:
|
||||
//
|
||||
// if(m_angle > 0)
|
||||
// {
|
||||
// gluPerspective(m_angle,m_aspect,m_near,m_at_dist+m_far);
|
||||
// }else
|
||||
// {
|
||||
// gluOrtho(-0.5*aspect,0.5*aspect,-0.5,0.5,m_at_dist+m_near,m_far);
|
||||
// }
|
||||
//
|
||||
// Is equivalent to
|
||||
//
|
||||
// glMultMatrixd(projection().data());
|
||||
//
|
||||
inline Eigen::Matrix4d projection() const;
|
||||
// Return an Affine transformation (rigid actually) that
|
||||
// takes relative coordinates and tramsforms them into world 3d
|
||||
// coordinates: moves the camera into the scene.
|
||||
inline Eigen::Affine3d affine() const;
|
||||
// Return an Affine transformation (rigid actually) that puts the takes a
|
||||
// world 3d coordinate and transforms it into the relative camera
|
||||
// coordinates: moves the scene in front of the camera.
|
||||
//
|
||||
// Note:
|
||||
//
|
||||
// gluLookAt(
|
||||
// eye()(0), eye()(1), eye()(2),
|
||||
// at()(0), at()(1), at()(2),
|
||||
// up()(0), up()(1), up()(2));
|
||||
//
|
||||
// Is equivalent to
|
||||
//
|
||||
// glMultMatrixd(camera.inverse().matrix().data());
|
||||
//
|
||||
// See also: affine, eye, at, up
|
||||
inline Eigen::Affine3d inverse() const;
|
||||
// Returns world coordinates position of center or "eye" of camera.
|
||||
inline Eigen::Vector3d eye() const;
|
||||
// Returns world coordinate position of a point "eye" is looking at.
|
||||
inline Eigen::Vector3d at() const;
|
||||
// Returns world coordinate unit vector of "up" vector
|
||||
inline Eigen::Vector3d up() const;
|
||||
// Return top right corner of unit plane in relative coordinates, that is
|
||||
// (w/2,h/2,1)
|
||||
inline Eigen::Vector3d unit_plane() const;
|
||||
// Move dv in the relative coordinate frame of the camera (move the FPS)
|
||||
//
|
||||
// Inputs:
|
||||
// dv (x,y,z) displacement vector
|
||||
//
|
||||
inline void dolly(const Eigen::Vector3d & dv);
|
||||
// "Scale zoom": Move `eye`, but leave `at`
|
||||
//
|
||||
// Input:
|
||||
// s amount to scale distance to at
|
||||
inline void push_away(const double s);
|
||||
// Aka "Hitchcock", "Vertigo", "Spielberg" or "Trombone" zoom:
|
||||
// simultaneously dolly while changing angle so that `at` not only stays
|
||||
// put in relative coordinates but also projected coordinates. That is
|
||||
//
|
||||
// Inputs:
|
||||
// da change in angle in degrees
|
||||
inline void dolly_zoom(const double da);
|
||||
// Turn around eye so that rotation is now q
|
||||
//
|
||||
// Inputs:
|
||||
// q new rotation as quaternion
|
||||
inline void turn_eye(const Eigen::Quaterniond & q);
|
||||
// Orbit around at so that rotation is now q
|
||||
//
|
||||
// Inputs:
|
||||
// q new rotation as quaternion
|
||||
inline void orbit(const Eigen::Quaterniond & q);
|
||||
// Rotate and translate so that camera is situated at "eye" looking at "at"
|
||||
// with "up" pointing up.
|
||||
//
|
||||
// Inputs:
|
||||
// eye (x,y,z) coordinates of eye position
|
||||
// at (x,y,z) coordinates of at position
|
||||
// up (x,y,z) coordinates of up vector
|
||||
inline void look_at(
|
||||
const Eigen::Vector3d & eye,
|
||||
const Eigen::Vector3d & at,
|
||||
const Eigen::Vector3d & up);
|
||||
// Needed any time Eigen Structures are used as class members
|
||||
// http://eigen.tuxfamily.org/dox-devel/group__TopicStructHavingEigenMembers.html
|
||||
public:
|
||||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
|
||||
};
|
||||
}
|
||||
|
||||
// Implementation
|
||||
#include "PI.h"
|
||||
#include "EPS.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
|
||||
inline igl::Camera::Camera():
|
||||
m_angle(45.0),m_aspect(1),m_near(1e-2),m_far(100),m_at_dist(1),
|
||||
m_orthographic(false),
|
||||
m_rotation_conj(1,0,0,0),
|
||||
m_translation(0,0,1)
|
||||
{
|
||||
}
|
||||
|
||||
inline Eigen::Matrix4d igl::Camera::projection() const
|
||||
{
|
||||
Eigen::Matrix4d P;
|
||||
using namespace std;
|
||||
const double far = m_at_dist + m_far;
|
||||
const double near = m_near;
|
||||
// http://stackoverflow.com/a/3738696/148668
|
||||
if(m_orthographic)
|
||||
{
|
||||
const double f = 0.5;
|
||||
const double left = -f*m_aspect;
|
||||
const double right = f*m_aspect;
|
||||
const double bottom = -f;
|
||||
const double top = f;
|
||||
const double tx = (right+left)/(right-left);
|
||||
const double ty = (top+bottom)/(top-bottom);
|
||||
const double tz = (far+near)/(far-near);
|
||||
const double z_fix = 0.5 /m_at_dist / tan(m_angle*0.5 * (igl::PI/180.) );
|
||||
P<<
|
||||
z_fix*2./(right-left), 0, 0, -tx,
|
||||
0, z_fix*2./(top-bottom), 0, -ty,
|
||||
0, 0, -z_fix*2./(far-near), -tz,
|
||||
0, 0, 0, 1;
|
||||
}else
|
||||
{
|
||||
const double yScale = tan(PI*0.5 - 0.5*m_angle*PI/180.);
|
||||
// http://stackoverflow.com/a/14975139/148668
|
||||
const double xScale = yScale/m_aspect;
|
||||
P<<
|
||||
xScale, 0, 0, 0,
|
||||
0, yScale, 0, 0,
|
||||
0, 0, -(far+near)/(far-near), -1,
|
||||
0, 0, -2.*near*far/(far-near), 0;
|
||||
P = P.transpose().eval();
|
||||
}
|
||||
return P;
|
||||
}
|
||||
|
||||
inline Eigen::Affine3d igl::Camera::affine() const
|
||||
{
|
||||
using namespace Eigen;
|
||||
Affine3d t = Affine3d::Identity();
|
||||
t.rotate(m_rotation_conj.conjugate());
|
||||
t.translate(m_translation);
|
||||
return t;
|
||||
}
|
||||
|
||||
inline Eigen::Affine3d igl::Camera::inverse() const
|
||||
{
|
||||
using namespace Eigen;
|
||||
Affine3d t = Affine3d::Identity();
|
||||
t.translate(-m_translation);
|
||||
t.rotate(m_rotation_conj);
|
||||
return t;
|
||||
}
|
||||
|
||||
inline Eigen::Vector3d igl::Camera::eye() const
|
||||
{
|
||||
using namespace Eigen;
|
||||
return affine() * Vector3d(0,0,0);
|
||||
}
|
||||
|
||||
inline Eigen::Vector3d igl::Camera::at() const
|
||||
{
|
||||
using namespace Eigen;
|
||||
return affine() * (Vector3d(0,0,-1)*m_at_dist);
|
||||
}
|
||||
|
||||
inline Eigen::Vector3d igl::Camera::up() const
|
||||
{
|
||||
using namespace Eigen;
|
||||
Affine3d t = Affine3d::Identity();
|
||||
t.rotate(m_rotation_conj.conjugate());
|
||||
return t * Vector3d(0,1,0);
|
||||
}
|
||||
|
||||
inline Eigen::Vector3d igl::Camera::unit_plane() const
|
||||
{
|
||||
// Distance of center pixel to eye
|
||||
const double d = 1.0;
|
||||
const double a = m_aspect;
|
||||
const double theta = m_angle*PI/180.;
|
||||
const double w =
|
||||
2.*sqrt(-d*d/(a*a*pow(tan(0.5*theta),2.)-1.))*a*tan(0.5*theta);
|
||||
const double h = w/a;
|
||||
return Eigen::Vector3d(w*0.5,h*0.5,-d);
|
||||
}
|
||||
|
||||
inline void igl::Camera::dolly(const Eigen::Vector3d & dv)
|
||||
{
|
||||
m_translation += dv;
|
||||
}
|
||||
|
||||
inline void igl::Camera::push_away(const double s)
|
||||
{
|
||||
using namespace Eigen;
|
||||
#ifndef NDEBUG
|
||||
Vector3d old_at = at();
|
||||
#endif
|
||||
const double old_at_dist = m_at_dist;
|
||||
m_at_dist = old_at_dist * s;
|
||||
dolly(Vector3d(0,0,1)*(m_at_dist - old_at_dist));
|
||||
assert((old_at-at()).squaredNorm() < DOUBLE_EPS);
|
||||
}
|
||||
|
||||
inline void igl::Camera::dolly_zoom(const double da)
|
||||
{
|
||||
using namespace std;
|
||||
using namespace Eigen;
|
||||
#ifndef NDEBUG
|
||||
Vector3d old_at = at();
|
||||
#endif
|
||||
const double old_angle = m_angle;
|
||||
if(old_angle + da < IGL_CAMERA_MIN_ANGLE)
|
||||
{
|
||||
m_orthographic = true;
|
||||
}else if(old_angle + da > IGL_CAMERA_MIN_ANGLE)
|
||||
{
|
||||
m_orthographic = false;
|
||||
}
|
||||
if(!m_orthographic)
|
||||
{
|
||||
m_angle += da;
|
||||
m_angle = min(89.,max(IGL_CAMERA_MIN_ANGLE,m_angle));
|
||||
// change in distance
|
||||
const double s =
|
||||
(2.*tan(old_angle/2./180.*igl::PI)) /
|
||||
(2.*tan(m_angle/2./180.*igl::PI)) ;
|
||||
const double old_at_dist = m_at_dist;
|
||||
m_at_dist = old_at_dist * s;
|
||||
dolly(Vector3d(0,0,1)*(m_at_dist - old_at_dist));
|
||||
assert((old_at-at()).squaredNorm() < DOUBLE_EPS);
|
||||
}
|
||||
}
|
||||
|
||||
inline void igl::Camera::turn_eye(const Eigen::Quaterniond & q)
|
||||
{
|
||||
using namespace Eigen;
|
||||
Vector3d old_eye = eye();
|
||||
// eye should be fixed
|
||||
//
|
||||
// eye_1 = R_1 * t_1 = eye_0
|
||||
// t_1 = R_1' * eye_0
|
||||
m_rotation_conj = q.conjugate();
|
||||
m_translation = m_rotation_conj * old_eye;
|
||||
assert((old_eye - eye()).squaredNorm() < DOUBLE_EPS);
|
||||
}
|
||||
|
||||
inline void igl::Camera::orbit(const Eigen::Quaterniond & q)
|
||||
{
|
||||
using namespace Eigen;
|
||||
Vector3d old_at = at();
|
||||
// at should be fixed
|
||||
//
|
||||
// at_1 = R_1 * t_1 - R_1 * z = at_0
|
||||
// t_1 = R_1' * (at_0 + R_1 * z)
|
||||
m_rotation_conj = q.conjugate();
|
||||
m_translation =
|
||||
m_rotation_conj *
|
||||
(old_at +
|
||||
m_rotation_conj.conjugate() * Vector3d(0,0,1) * m_at_dist);
|
||||
assert((old_at - at()).squaredNorm() < DOUBLE_EPS);
|
||||
}
|
||||
|
||||
inline void igl::Camera::look_at(
|
||||
const Eigen::Vector3d & eye,
|
||||
const Eigen::Vector3d & at,
|
||||
const Eigen::Vector3d & up)
|
||||
{
|
||||
using namespace Eigen;
|
||||
using namespace std;
|
||||
// http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml
|
||||
// Normalize vector from at to eye
|
||||
Vector3d F = eye-at;
|
||||
m_at_dist = F.norm();
|
||||
F.normalize();
|
||||
// Project up onto plane orthogonal to F and normalize
|
||||
assert(up.cross(F).norm() > DOUBLE_EPS && "(eye-at) x up ≈ 0");
|
||||
const Vector3d proj_up = (up-(up.dot(F))*F).normalized();
|
||||
Quaterniond a,b;
|
||||
a.setFromTwoVectors(Vector3d(0,0,-1),-F);
|
||||
b.setFromTwoVectors(a*Vector3d(0,1,0),proj_up);
|
||||
m_rotation_conj = (b*a).conjugate();
|
||||
m_translation = m_rotation_conj * eye;
|
||||
//cout<<"m_at_dist: "<<m_at_dist<<endl;
|
||||
//cout<<"proj_up: "<<proj_up.transpose()<<endl;
|
||||
//cout<<"F: "<<F.transpose()<<endl;
|
||||
//cout<<"eye(): "<<this->eye().transpose()<<endl;
|
||||
//cout<<"at(): "<<this->at().transpose()<<endl;
|
||||
//cout<<"eye()-at(): "<<(this->eye()-this->at()).normalized().transpose()<<endl;
|
||||
//cout<<"eye-this->eye(): "<<(eye-this->eye()).squaredNorm()<<endl;
|
||||
assert( (eye-this->eye()).squaredNorm() < DOUBLE_EPS);
|
||||
//assert((F-(this->eye()-this->at()).normalized()).squaredNorm() <
|
||||
// DOUBLE_EPS);
|
||||
assert( (at-this->at()).squaredNorm() < DOUBLE_EPS);
|
||||
//assert( (proj_up-this->up()).squaredNorm() < DOUBLE_EPS);
|
||||
}
|
||||
|
||||
#endif
|
30
src/igl/EPS.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
// This file is part of libigl, a simple c++ geometry processing library.
|
||||
//
|
||||
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public License
|
||||
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
||||
// obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#include "EPS.h"
|
||||
|
||||
template <> IGL_INLINE float igl::EPS()
|
||||
{
|
||||
return igl::FLOAT_EPS;
|
||||
}
|
||||
template <> IGL_INLINE double igl::EPS()
|
||||
{
|
||||
return igl::DOUBLE_EPS;
|
||||
}
|
||||
|
||||
template <> IGL_INLINE float igl::EPS_SQ()
|
||||
{
|
||||
return igl::FLOAT_EPS_SQ;
|
||||
}
|
||||
template <> IGL_INLINE double igl::EPS_SQ()
|
||||
{
|
||||
return igl::DOUBLE_EPS_SQ;
|
||||
}
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
// Explicit template instantiation
|
||||
#endif
|