Merge remote-tracking branch 'origin/dev_native' into ys_dev_native

This commit is contained in:
YuSanka 2018-09-20 08:41:57 +02:00
commit bcbeb56217
8 changed files with 76 additions and 70 deletions

View File

@ -175,33 +175,6 @@ 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()
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
@ -270,26 +243,9 @@ add_subdirectory(resources/localization)
add_subdirectory(src)
# Perl bindings, currently only used for the unit / integration tests of libslic3r.
# Also runs the unit / integration tests.
#FIXME Port the tests into C++ to finally get rid of the Perl!
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")
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)

View File

@ -19,7 +19,6 @@ add_subdirectory(libnest2d)
include_directories(${LIBDIR}/qhull/src)
#message(STATUS ${LIBDIR}/qhull/src)
# ##############################################################################
# Configure rasterizer target
# ##############################################################################
@ -36,23 +35,65 @@ 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)
message(STATUS "WXWIN environment set to: $ENV{WXWIN}")
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.
if(SLIC3R_GUI)
set_target_properties(slic3r PROPERTIES OUTPUT_NAME "slic3r-gui")
else()
set_target_properties(slic3r PROPERTIES OUTPUT_NAME "slic3r-console")
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 (NOT MSVC)
target_link_libraries(slic3r -ldl -lstdc++)
endif ()
# Add the Slic3r GUI library, libcurl, OpenGL and GLU libraries.
if (SLIC3R_GUI)
target_link_libraries(slic3r libslic3r_gui ${wxWidgets_LIBRARIES} ${CURL_LIBRARIES})
# Configure libcurl & OpenSSL
find_package(CURL REQUIRED)
target_include_directories(slic3r PRIVATE ${CURL_INCLUDE_DIRS})
target_link_libraries(slic3r ${CURL_LIBRARIES})
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 +101,6 @@ 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 ()

View File

@ -1,7 +1,6 @@
#include "Analyzer.hpp"
#include "PreviewData.hpp"
#include <float.h>
#include <wx/intl.h>
#include <I18N.hpp>
#include <boost/format.hpp>

View File

@ -97,7 +97,9 @@ wxBitmap* BitmapCache::insert(const std::string &bitmap_key, const wxBitmap *beg
if (bmp->GetWidth() > 0) {
if (bmp->GetDepth() == 32) {
wxAlphaPixelData data(*const_cast<wxBitmap*>(bmp));
data.UseAlpha();
//FIXME The following method is missing from wxWidgets 3.1.1.
// It looks like the wxWidgets 3.0.3 called the wrapped bitmap's UseAlpha().
//data.UseAlpha();
if (data) {
for (int r = 0; r < bmp->GetHeight(); ++ r) {
wxAlphaPixelData::Iterator src(data);

View File

@ -1008,7 +1008,7 @@ void get_settings_choice(wxMenu *menu, int id, bool is_part)
if (!settings_list)
return;
if (wxGetMultipleChoices(selections, _(L("Select showing settings")), category_name, names) ==0 )
if (wxGetSelectedChoices(selections, _(L("Select showing settings")), category_name, names) == -1)
return;
std::vector <std::string> selected_options;

View File

@ -2645,7 +2645,7 @@ void Tab::update_presetsctrl(wxDataViewTreeCtrl* ui, bool show_incompatible)
wxDataViewTreeStoreContainerNode *node = ui->GetStore()->FindContainerNode(root_sys);
if (node)
{
wxDataViewTreeStoreNodeList::iterator iter;
wxDataViewTreeStoreNodes::iterator iter;
for (iter = node->GetChildren().begin(); iter != node->GetChildren().end(); iter++)
{
wxDataViewTreeStoreNode* child = *iter;
@ -2731,7 +2731,7 @@ void Tab::update_tab_presets(wxComboCtrl* ui, bool show_incompatible)
wxDataViewTreeStoreContainerNode *node = popup->GetStore()->FindContainerNode(root_sys);
if (node)
{
wxDataViewTreeStoreNodeList::iterator iter;
wxDataViewTreeStoreNodes::iterator iter;
for (iter = node->GetChildren().begin(); iter != node->GetChildren().end(); iter++)
{
wxDataViewTreeStoreNode* child = *iter;

View File

@ -111,6 +111,7 @@ class PrusaCollapsiblePaneMSW : public PrusaCollapsiblePane//wxCollapsiblePane
wxButton* m_pDisclosureTriangleButton = nullptr;
wxBitmap m_bmp_close;
wxBitmap m_bmp_open;
wxString m_strLabel;
public:
PrusaCollapsiblePaneMSW() {}
PrusaCollapsiblePaneMSW( wxWindow *parent,

View File

@ -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
@ -109,7 +109,8 @@ target_link_libraries(XS ${Boost_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++)
# -liconv: boost links to libiconv by default
target_link_libraries(XS "-liconv -framework IOKit" "-framework CoreFoundation" -lc++)
elseif (MSVC)
target_link_libraries(XS )
else ()
@ -142,14 +143,6 @@ if (WIN32)
target_link_libraries(XS ${PERL_LIBRARY})
endif()
# Find and configure boost
if(SLIC3R_STATIC)
# Use static boost libraries.
set(Boost_USE_STATIC_LIBS ON)
# Use boost libraries linked statically to the C++ runtime.
# set(Boost_USE_STATIC_RUNTIME ON)
endif()
target_link_libraries(XS ${Boost_LIBRARIES})
target_link_libraries(XS ${TBB_LIBRARIES})
# target_link_libraries(XS ${wxWidgets_LIBRARIES})
@ -157,7 +150,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 +168,6 @@ if(APPLE)
)
endif()
target_include_directories(XS PRIVATE src src/libslic3r)
if(SLIC3R_PROFILE)
target_link_libraries(Shiny)
endif()
@ -194,3 +185,19 @@ endif()
# Installation
install(TARGETS XS DESTINATION ${PERL_VENDORARCH}/auto/Slic3r/XS)
install(FILES lib/Slic3r/XS.pm DESTINATION ${PERL_VENDORLIB}/Slic3r)
# Unit / integration tests
enable_testing()
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")
endif ()
add_test (NAME xs COMMAND "${PERL_EXECUTABLE}" ${PERL_PROVE} -I ${PROJECT_SOURCE_DIR}/../local-lib/lib/perl5 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
add_test (NAME integration COMMAND "${PERL_EXECUTABLE}" ${PERL_PROVE} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/..)