2018-08-16 14:34:59 +00:00
|
|
|
cmake_minimum_required(VERSION 3.2)
|
2017-08-16 17:05:08 +00:00
|
|
|
|
|
|
|
project(Slic3r)
|
|
|
|
|
2017-08-18 21:18:27 +00:00
|
|
|
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)
|
|
|
|
endif()
|
|
|
|
|
2017-08-28 21:11:43 +00:00
|
|
|
if(DEFINED ENV{SLIC3R_STATIC})
|
|
|
|
set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC})
|
|
|
|
else()
|
|
|
|
if (MSVC OR MINGW OR APPLE)
|
|
|
|
set(SLIC3R_STATIC_INITIAL 1)
|
|
|
|
else()
|
|
|
|
set(SLIC3R_STATIC_INITIAL 0)
|
|
|
|
endif()
|
|
|
|
endif()
|
2017-08-16 17:05:08 +00:00
|
|
|
|
|
|
|
option(SLIC3R_STATIC "Compile Slic3r with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
|
2017-08-17 11:30:46 +00:00
|
|
|
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)
|
2017-08-16 17:05:08 +00:00
|
|
|
option(SLIC3R_PROFILE "Compile Slic3r with an invasive Shiny profiler" 0)
|
|
|
|
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
|
2018-08-17 10:38:33 +00:00
|
|
|
option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
|
2017-08-16 17:05:08 +00:00
|
|
|
|
|
|
|
if (MSVC AND SLIC3R_MSVC_COMPILE_PARALLEL)
|
2017-08-17 16:27:51 +00:00
|
|
|
add_compile_options(/MP)
|
2017-08-16 17:05:08 +00:00
|
|
|
endif ()
|
|
|
|
|
2017-08-28 17:11:16 +00:00
|
|
|
# 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}")
|
2018-08-16 14:34:59 +00:00
|
|
|
set(PERL_INCLUDE "${PROJECT_SOURCE_DIR}/local-lib/lib/perl5${ENV_PATH_SEPARATOR}$ENV{PERL5LIB}")
|
2017-08-28 17:11:16 +00:00
|
|
|
message("PATH: $ENV{PATH}")
|
2018-08-16 14:34:59 +00:00
|
|
|
message("PERL_INCLUDE: ${PERL_INCLUDE}")
|
2017-08-28 17:11:16 +00:00
|
|
|
find_package(Perl REQUIRED)
|
2018-08-16 14:34:59 +00:00
|
|
|
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()
|
|
|
|
|
2017-08-28 17:11:16 +00:00
|
|
|
|
2018-02-23 15:48:11 +00:00
|
|
|
# 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()
|
|
|
|
|
2018-05-17 08:37:26 +00:00
|
|
|
enable_testing ()
|
|
|
|
|
2018-06-04 19:22:42 +00:00
|
|
|
# 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)
|
|
|
|
if(NOT DEFINED WIN10SDK_PATH)
|
|
|
|
if(DEFINED ENV{WIN10SDK_PATH})
|
|
|
|
set(WIN10SDK_PATH "$ENV{WIN10SDK_PATH}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if(DEFINED WIN10SDK_PATH AND NOT EXISTS "${WIN10SDK_PATH}/include/winrt/windows.graphics.printing3d.h")
|
|
|
|
message("WIN10SDK_PATH is invalid: ${WIN10SDK_PATH}")
|
|
|
|
message("${WIN10SDK_PATH}/include/winrt/windows.graphics.printing3d.h was not found")
|
|
|
|
message("STL fixing by the Netfabb service will not be compiled")
|
|
|
|
unset(WIN10SDK_PATH)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-03-12 08:39:32 +00:00
|
|
|
add_subdirectory(xs)
|
|
|
|
|
2018-03-14 17:09:31 +00:00
|
|
|
get_filename_component(PERL_BIN_PATH "${PERL_EXECUTABLE}" DIRECTORY)
|
2018-02-23 15:48:11 +00:00
|
|
|
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.)
|
2018-03-12 08:39:32 +00:00
|
|
|
# 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)
|
2018-03-14 17:09:31 +00:00
|
|
|
set(PERL_PROVE "${PERL_BIN_PATH}/prove.bat")
|
|
|
|
else ()
|
|
|
|
set(PERL_PROVE "${PERL_BIN_PATH}/prove")
|
2018-02-23 15:48:11 +00:00
|
|
|
endif ()
|
|
|
|
|
2018-03-14 17:09:31 +00:00
|
|
|
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})
|
2017-08-28 17:11:16 +00:00
|
|
|
|
2017-08-16 17:05:08 +00:00
|
|
|
install(PROGRAMS slic3r.pl DESTINATION bin RENAME slic3r-prusa3d)
|
|
|
|
|
|
|
|
file(GLOB MyVar var/*.png)
|
|
|
|
install(FILES ${MyVar} DESTINATION share/slic3r-prusa3d)
|
|
|
|
install(FILES lib/Slic3r.pm DESTINATION lib/slic3r-prusa3d)
|
|
|
|
install(DIRECTORY lib/Slic3r DESTINATION lib/slic3r-prusa3d)
|