From 6003005812ec68eab3b321107f7a6c1d4dbae935 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Wed, 19 Sep 2018 17:19:06 +0200 Subject: [PATCH] Removed dependency on wxWidgets from Alien. Updated source code to wxWidgets 3.1.1 Moved invocation of perl unit / integration tests to the xs project. --- CMakeLists.txt | 44 ++---------------------------- src/CMakeLists.txt | 3 ++ src/slic3r/GUI/GUI_ObjectParts.cpp | 2 +- src/slic3r/GUI/Tab.cpp | 4 +-- src/slic3r/GUI/wxExtensions.hpp | 1 + xs/CMakeLists.txt | 16 +++++++++++ 6 files changed, 25 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 84f6bcbd5..65a124055 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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,22 +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}) - file(GLOB MyVar var/*.png) install(FILES ${MyVar} DESTINATION share/slic3r-prusa3d) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ea3d35018..d2b79ae78 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,6 +64,9 @@ endif () # Add the Slic3r GUI library, libcurl, OpenGL and GLU libraries. if (SLIC3R_GUI) + find_package(wxWidgets REQUIRED COMPONENTS base core adv html gl) + include(${wxWidgets_USE_FILE}) + target_link_libraries(slic3r libslic3r_gui ${wxWidgets_LIBRARIES} ${CURL_LIBRARIES}) # Configure libcurl & OpenSSL diff --git a/src/slic3r/GUI/GUI_ObjectParts.cpp b/src/slic3r/GUI/GUI_ObjectParts.cpp index ae34359ce..4fc3b88c0 100644 --- a/src/slic3r/GUI/GUI_ObjectParts.cpp +++ b/src/slic3r/GUI/GUI_ObjectParts.cpp @@ -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 selected_options; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index e0db63803..5b438d4a1 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -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; diff --git a/src/slic3r/GUI/wxExtensions.hpp b/src/slic3r/GUI/wxExtensions.hpp index 51c02035c..a6cbf1773 100644 --- a/src/slic3r/GUI/wxExtensions.hpp +++ b/src/slic3r/GUI/wxExtensions.hpp @@ -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, diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 3f37213ae..b3bda1877 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -185,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}/..)