From 58a0c41713a43641143fac157219966d3f38c4c8 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 19 Sep 2018 13:12:57 +0200 Subject: [PATCH] Fixed compilation on OSX & Linux --- CMakeLists.txt | 4 ---- src/CMakeLists.txt | 9 +++++++-- xs/CMakeLists.txt | 6 ++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80aa7ff08..84f6bcbd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,9 +287,5 @@ 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}) -#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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d0c008293..7d184c59f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,11 +36,9 @@ 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() @@ -51,6 +49,13 @@ add_subdirectory(slic3r) # Create a slic3r executable add_executable(slic3r slic3r.cpp) target_link_libraries(slic3r libslic3r libslic3r_gui ${wxWidgets_LIBRARIES} ${CURL_LIBRARIES}) +if (APPLE) +# add_compile_options(-stdlib=libc++) +# add_definitions(-DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE) + target_link_libraries(XS "-framework IOKit" "-framework CoreFoundation" -lc++) +elseif (NOT MSVC) + target_link_libraries(XS -lstdc++) +endif () # Add the OpenGL and GLU libraries. if (SLIC3R_GUI) if (MSVC) diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 92964c900..8756d98eb 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -97,7 +97,7 @@ if(SLIC3R_PROFILE) target_link_libraries(XS Shiny) endif() -target_include_directories(XS PRIVATE src src/libslic3r) # Local include directories +target_include_directories(XS PRIVATE src) target_compile_definitions(XS PRIVATE -DSLIC3RXS) set_target_properties(XS PROPERTIES PREFIX "") # Prevent cmake from generating libXS.so instead of XS.so @@ -157,7 +157,7 @@ target_link_libraries(XS ${EXPAT_LIBRARIES}) # target_link_libraries(XS ${GLEW_LIBRARIES}) # Install the XS.pm and XS.{so,dll,bundle} into the local-lib directory. -set(PERL_LOCAL_LIB_DIR "../local-lib/lib/perl5/${PerlEmbed_ARCHNAME}") +set(PERL_LOCAL_LIB_DIR "../../local-lib/lib/perl5/${PerlEmbed_ARCHNAME}") add_custom_command( TARGET XS POST_BUILD @@ -175,8 +175,6 @@ if(APPLE) ) endif() -target_include_directories(XS PRIVATE src src/libslic3r) - if(SLIC3R_PROFILE) target_link_libraries(Shiny) endif()