Open lordofhyphens opened 6 years ago
I would love to help, but I would need instructions on how to run the C++ GUI on windows.
https://github.com/lordofhyphens/Slic3r/blob/cppgui/src/windows-build.txt there's the basics (written by someone else). You also need to have wxWidgets development files built and installed somewhere; the variable that needs to be set is WXWIN (for findWxWidgets). It should pick up the shared libraries no problem.
Whether or not you use VC++ (it needs to support c++11) is something that I currently don't care about. CMake should function with VC++ just fine and there's docs available online for that.
https://blogs.msdn.microsoft.com/vcblog/2016/10/05/cmake-support-in-visual-studio/
I don't do any development on Windows at this time, so that's the best I've got right now; I haven't even gotten the build server set up for Windows.
What I do know is that right now Slic3r is expecting the slic3r binary to live in the src dir and its var directory to be one directory level above it. Slic3r will just crash if it's anywhere else (this must be sorted out before this gets merged back to main branch).
when i run CMake i get the error wx not found!
https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.zip
Download and build that to their instructions. Install to whatever directory.
Set the environment variable WXWIN to the directory you installed to.
I built wxWidgets with the following two lines:
cmake -G "MinGW Makefiles" ..\wxWidgets-3.1.1 -DCMAKE_INSTALL_PREFIX=C:\dev\wxWidgets
-3.1.1-shared -DwxBUILD_SHARED=ON -DwxUSE_STL=ON
cmake --build . --target install -- -j4
I did build in a separate directory, wxWidgets-build when I ran these.
I then set WXWIN=C:\dev\wxWidgets-3.1.1-shared (search online for how to set environment variables on windows)
This assumes you built with MinGW-w64 and are using its make (I tend to use Powershell when I am on Windows).
My current "issue" on Windows is the opposite of yours; I can build and find wx, but not boost.
Update: I can build on Windows now.
In the src subdirectory, I execute the following commands:
cmake -G"MinGW Makefiles" -DBOOST_ROOT=C:\dev\boost_1_63_0
cmake --build . -- -j4
Where did you create folder wxWidgets-build
I cannot, however, right now guarantee that Windows c++ gui works as intended. I was seeing some weird behavior with the 2d plater that currently doesn't happen on Linux (wxGTK).
You can currently ignore the initial errors, those are caused by me doing something incorrectly and windows wxwidgets popping a dialog box (whereas they are just console spam on linux)
Hop onto IRC #slic3r this will go quicker there.
If your wxwidgets source folder is C:\dev\wxwidgets-src, then your wxwidgets-build dir would be C:\dev\wxwidgets-build
The "..\wxWidgets-3.1.1" in the command-line is the hint as to where wxWidgets-Build is.
I extracted the wxWidgets into "C:\dev\wxWidgets-3.1.1"
I created and environment variable called WXWIN and set it to "C:\dev\wxWidgets-3.1.1"
I then created a folder called wxWidgets-build in "C:\dev"
I cd to "C:\dev\wxWidgets-build" and ran cmake -G "MinGW Makefiles" ..\wxWidgets-3.1.1 -DCMAKE_INSTALL_PREFIX=C:\dev\wxWidgets-3.1.1-shared -DwxBUILD_SHARED=ON -DwxUSE_STL=ON
cmake --build . --target install -- -j4
I set enviroment variacle WXWIN to "C:/dev/wxWidgets-3.1.1-shared"
I opened up CMake and set where is the Source Code to "C:/Users/Eitan/Desktop/Slic3r/src" and Where to build the binaries to "C:/Users/Eitan/Desktop/Slic3r/build"
I configured and selected MinGW Makefiles and used default native compilers.
I get in red "Wx not found!"
What am I doing wrong
WXWIN needs to be the full path to where wxwidgets is installed, so C:\dev\wxWidgets-3.1.1-shared
That what I did
I'll do a clean build in a different checkout dir later today to see what is going on.
Thanks.Can you can you record how you got it to work.
mkdir C:\dev\wxwidgets-3.1.1-build
cd C:\dev\wxwidgets-3.1.1-build
cmake -G"MinGW Makefiles" ../wxwidgets-3.1.1-src -DwxBUILD_SHARED=OFF -DCMAKE_INSTALL_PREFIX=C:\dev\wxWidgets-3.1.1-static
cmake --build . --target install -- -j4
(reference: http://docs.wxwidgets.org/3.1/overview_cmake.html)mkdir /path/to/Slic3r/build
cd /path/to/Slic3r/build
cmake -G"MinGW Makefiles" ..\src\ -DBOOST_ROOT=C:\dev\boost_1_63_0
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc.exe
-- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/g++.exe
-- Check for working CXX compiler: C:/Program Files/mingw-w64/x86_64-7.3.0-posix-seh-rt_v5-rev0/mingw64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Could NOT find Boost
-- Found wxWidgets: C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxbase31u_net.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxmsw31u_gl.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxmsw31u_html.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxmsw31u_aui.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxmsw31u_core.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxbase31u.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxpng.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxtiff.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxjpeg.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxzlib.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxregexu.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxexpat.a;opengl32;glu32;winmm;comctl32;oleacc;rpcrt4;shlwapi;version;wsock32 (found version "3.1.1")
wx found!
-- Configuring done
-- Generating done
cmake --build . -- -j4
When running step 7 i get the error
MSBUILD : error MSB1001: Unknown switch. Switch: -j4
Delete the wxwidgets-build directory and repeat the updated step 7. You're getting that error because you have MSVC installed and its version of make
is getting detected instead of mingw.
Do I need to set SLIC3R_STATIC to 1 in environment variables
No; I've recently changed the CMakeLists to take it on a -D command.
Do I need to cd to /path/to/Slic3r and run Build.PL Build.PL --gui before step 14
No. You should never run the Perl build scripts with this branch.
I made a slight mistake, delete the build directory, remake it, and start again from step 14.
Do you need to set WXWIN to something before step 7
Do I need to add something from http://docs.wxwidgets.org/3.1/overview_cmake.html to /path/to/Slic3r/src/CMakeLists.txt
I added find_package(wxWidgets REQUIRED COMPONENTS net core base) include(${wxWidgets_USE_FILE}) to the CMakelists.txt file in /path/to/Slic3r/src
When I run "cmake . --build -- -j4" I get the error
CMake Error: The source directory "C:/Users/Eitan/Desktop/cppgui/build/-j4" does not exist. Specify --help for usage, or press the help button on the CMake GUI.
@EitanSomething No, you don't need to set WXWIN until right before step 14.
The CMakeLists.txt file should build on Windows as-is (and it does on my system on a clean checkout of the software).
cmake --build . -- -j4
instead, I transposed them when typing into Github.
When I run it as is I get "wx of found"
but when I replace IF(wxWidgets_FOUND) MESSAGE("wx found!") INCLUDE("${wxWidgets_USE_FILE}") add_library(slic3r_gui STATIC ${LIBDIR}/slic3r/GUI/3DScene.cpp ${LIBDIR}/slic3r/GUI/GUI.cpp)
target_link_libraries (slic3r slic3r-gui ${wxWidgets_LIBRARIES})
ELSE(wxWidgets_FOUND)
MESSAGE("wx not found!")
#skip gui when no wx included
ENDIF(wxWidgets_FOUND)
with
find_package(wxWidgets REQUIRED COMPONENTS net core base) include(${wxWidgets_USE_FILE}) add_library(slic3r_gui STATIC ${LIBDIR}/slic3r/GUI/3DScene.cpp ${LIBDIR}/slic3r/GUI/GUI.cpp)
target_link_libraries (slic3r slic3r-gui ${wxWidgets_LIBRARIES})
MESSAGE("wx found!")
I get Found wxWidgets: C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxbase31u_net.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxmsw31u_core.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/wxbase31u.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxpng.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxtiff.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxjpeg.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxzlib.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxregexu.a;C:/dev/wxWidgets-3.1.1-static/lib/gcc_lib/libwxexpat.a;winmm;comctl32;oleacc;rpcrt4;shlwapi;version;wsock32 (found version "3.1.1") wx found!
Update your checkout to whatever the current state of cppgui is on lordofhyphens/slic3r
What do you mean?
When I run "cmake . --build -- -j4" I get the error "CMake Error: The source directory "C:/Users/Eitan/Desktop/cppgui/build/-j4" does not exist. Specify --help for usage, or press the help button on the CMake GUI."
@EitanSomething http://webchat.freenode.net?channels=%23slic3r hop onto IRC because I'm tired of trying to sort this out in this time-late fashion.
for anyone else following along: if your CMakeLists file doesn't look like https://github.com/lordofhyphens/Slic3r/blob/cppgui/src/CMakeLists.txt then delete your checkout and clone from https://github.com/lordofhyphens/Slic3r.git
Really though if you are planning on contributing code you should create a fork to stage your code.
git clone https://github.com/lordofhyphens/Slic3r -b cppgui slic3r-cppgui
git remote add me https://<username>@github.com/<username>/Slic3r
To get updates that I have done: git pull origin cppgui
To get your code into lordofhyphens/slic3r
git push me cppgui
<username>/Slic3r
to lordofhyphens/Slic3r
cppgui branch.I ran "cmake . --build -- -j4"and I got these errors
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lslic3r-gui
collect2.exe: error: ld returned 1 exit status
CMakeFiles\slic3r.dir\build.make:107: recipe for target 'slic3r.exe' failed
mingw32-make.exe[2]: [slic3r.exe] Error 1
CMakeFiles\Makefile2:374: recipe for target 'CMakeFiles/slic3r.dir/all' failed
mingw32-make.exe[1]: [CMakeFiles/slic3r.dir/all] Error 2
mingw32-make.exe[1]: Waiting for unfinished jobs....
liblibslic3r.a(Model.cpp.obj):Model.cpp:(.text+0x23f8): undefined reference to Slic3r::LayerHeightSpline::LayerHeightSpline()' liblibslic3r.a(Model.cpp.obj):Model.cpp:(.text+0x25a0): undefined reference to
Slic3r::LayerHeightSpline::LayerHeightSpline(Slic3r::LayerHeightSpline const&)'
liblibslic3r.a(Model.cpp.obj):Model.cpp:(.text$_ZSt4swapIN6Slic3r17LayerHeightSplineEENSt9enable_ifIXsrSt6and_IJSt21is_move_constructibleIT_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5SC[_ZSt4swapIN6Slic3r17LayerHeightSplineEENSt9enable_ifIXsrSt6__and_IJSt21is_move_constructibleIT_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5SC]+0x2d): undefined reference to `Slic3r::LayerHeightSpline::LayerHeightSpline(Slic3r::LayerHeightSpline const&)'
liblibslic3r.a(Model.cpp.obj):Model.cpp:(.text$_ZSt4swapIN6Slic3r17LayerHeightSplineEENSt9enable_ifIXsrSt6and_IJSt21is_move_constructibleIT_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5SC[_ZSt4swapIN6Slic3r17LayerHeightSplineEENSt9enable_ifIXsrSt6and_IJSt21is_move_constructibleIT_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5SC]+0x45): undefined reference to `Slic3r::LayerHeightSpline::operator=(Slic3r::LayerHeightSpline const&)'
liblibslic3r.a(Model.cpp.obj):Model.cpp:(.text$_ZSt4swapIN6Slic3r17LayerHeightSplineEENSt9enable_ifIXsrSt6__and_IJSt21is_move_constructibleIT_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5SC[_ZSt4swapIN6Slic3r17LayerHeightSplineEENSt9enable_ifIXsrSt6and_IJSt21is_move_constructibleIT_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5SC]+0x60): undefined reference to `Slic3r::LayerHeightSpline::operator=(Slic3r::LayerHeightSpline const&)'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\extrude-tin.dir\build.make:98: recipe for target 'extrude-tin.exe' failed
mingw32-make.exe[2]: [extrude-tin.exe] Error 1
CMakeFiles\Makefile2:294: recipe for target 'CMakeFiles/extrude-tin.dir/all' failed
mingw32-make.exe[1]: [CMakeFiles/extrude-tin.dir/all] Error 2
Makefile:82: recipe for target 'all' failed
mingw32-make.exe: [all] Error 2
@EitanSomething You clearly have something seriously wrong going on (extrude-tin.exe should not be building).
Delete your Slic3r checkout and follow the instructions at #31 to do a new checkout.
@EitanSomething I've updated the instructions slightly to add more links, etc.
I’m working on the 3D plater.Where are the initiation bed size found.
@EitanSomething start by reading 3DScene.pm.
I'm going to add an option to set height so that you can see if your print will be taller than max z axis
So I took some time familiarizing myself with the code, specifically reading Plate2D.cpp for an idea of how wx specific cpp works.
@lordofhyphens, Should most of the wx calls be one to one between perl and cpp? I have pretty much zero familiarity with wx so if it isn't that will be some trouble. And does wx mainly use wide strings for UI?
@TheThirdOne Yeah, most of the wx calls are 1:1.
If it is UI-facing, use wxString. It'll sort itself out. I tend to use std::wstring as literals; libslic3r needs std::string.
@TheThirdOne Another note on event handling:
Instead of the static event tables that the wxPerl code uses, you need to use Bind() with a lambda instead.
There's numerous examples in the existing code; Plater.cpp:169 is the first one I came across.
I figured out how to set up Plate3D to be able to use OpenGL to render (and have rendered a red triangle), but struggled getting the Canvas to fill the available area. Once I get that and input figured out it should be mostly smooth sailing because I won't need to be working on wx stuff.
I saw the event handling stuff in Plate2D. It looks like a simple translation from the Perl version.
You can take over this part of the project.
@EitanSomething could you continue your efforts building on Visual Studio 2017?
On Thu, Jun 7, 2018, 8:28 AM EitanSomething notifications@github.com wrote:
You can take over the project
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lordofhyphens/Slic3r/issues/19#issuecomment-395420013, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB8CuvPym6O9jJbFypz615NVSCwXeMDks5t6Sp4gaJpZM4T0Xod .
I will continue working on getting it to work with visual studios in the summer. I think the best bet is to use the MinGW debugger in VS.
As soon as I made Plate3D based on wxGLCanvas instead of wxPanel, it scaled automatically. Not sure why I couldn't get it to do that as a child. I played around with the mouse input, and didn't have any big problems.
@lordofhyphens, design question, I was thinking of having a base class which is just a renderer with camera movement which all of the 3D windows would extend. Most of the input controls and additional features aren't shared between the plater, preview and dialogs. Thoughts? Additionally, would it be ok to only support rendering triangles; if so, it would make the base renderer quite concise.That would require the 3d preview to generate triangles instead of quads, but I don't think it would affect any other code.
@Thethirdone sounds like a good design. The 3D view gets reused a lot in Slic3r.
Better part rotation is needed.
Port 3D Plater to C++ GUI.