CMakeLists.txt 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Boost 1.63 requires CMake 3.7 or newer
  2. cmake_minimum_required(VERSION 2.8)
  3. project(Slic3r)
  4. if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  5. message(STATUS "No build type selected, default to Release")
  6. set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
  7. endif()
  8. if(DEFINED ENV{SLIC3R_STATIC})
  9. set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC})
  10. else()
  11. if (MSVC OR MINGW OR APPLE)
  12. set(SLIC3R_STATIC_INITIAL 1)
  13. else()
  14. set(SLIC3R_STATIC_INITIAL 0)
  15. endif()
  16. endif()
  17. option(SLIC3R_STATIC "Compile Slic3r with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
  18. option(SLIC3R_GUI "Compile Slic3r with GUI components (OpenGL, wxWidgets)" 1)
  19. option(SLIC3R_PRUSACONTROL "Compile Slic3r with the PrusaControl prject file format (requires wxWidgets base library)" 1)
  20. option(SLIC3R_PROFILE "Compile Slic3r with an invasive Shiny profiler" 0)
  21. option(SLIC3R_HAS_BROKEN_CROAK "Compile Slic3r for a broken Strawberry Perl 64bit" 0)
  22. option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
  23. if (MSVC AND SLIC3R_MSVC_COMPILE_PARALLEL)
  24. add_compile_options(/MP)
  25. endif ()
  26. # Find the Perl interpreter, add local-lib to PATH and PERL5LIB environment variables,
  27. # so the locally installed modules (mainly the Alien::wxPerl) will be reached.
  28. if (WIN32)
  29. set(ENV_PATH_SEPARATOR ";")
  30. else()
  31. set(ENV_PATH_SEPARATOR ":")
  32. endif()
  33. set(ENV{PATH} "${PROJECT_SOURCE_DIR}/local-lib/bin${ENV_PATH_SEPARATOR}$ENV{PATH}")
  34. set(ENV{PERL5LIB} "${PROJECT_SOURCE_DIR}/local-lib/lib/perl${ENV_PATH_SEPARATOR}$ENV{PERL5LIB}")
  35. message("PATH: $ENV{PATH}")
  36. message("PERL5LIB: $ENV{PERL5LIB}")
  37. find_package(Perl REQUIRED)
  38. add_subdirectory(xs)
  39. enable_testing ()
  40. get_filename_component(PERL_BIN_PATH "${PERL_EXECUTABLE}" DIRECTORY)
  41. add_test (NAME xs COMMAND "${PERL_EXECUTABLE}" ${PERL_BIN_PATH}/prove -I ${PROJECT_SOURCE_DIR}/local-lib/lib/perl5 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/xs)
  42. add_test (NAME integration COMMAND "${PERL_EXECUTABLE}" ${PERL_BIN_PATH}/prove WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
  43. install(PROGRAMS slic3r.pl DESTINATION bin RENAME slic3r-prusa3d)
  44. file(GLOB MyVar var/*.png)
  45. install(FILES ${MyVar} DESTINATION share/slic3r-prusa3d)
  46. install(FILES lib/Slic3r.pm DESTINATION lib/slic3r-prusa3d)
  47. install(DIRECTORY lib/Slic3r DESTINATION lib/slic3r-prusa3d)