Modified build system for static linking of boost on windows/mingw

Added Windows/MinGW build instructions
This commit is contained in:
Kliment Yanev 2016-06-01 20:19:28 +02:00
parent d8ef6e9cc1
commit 257e34573e
2 changed files with 44 additions and 4 deletions

View File

@ -7,7 +7,7 @@ set(workaround "-fno-inline-small-functions")
endif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.3)
endif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7.0)
set(CMAKE_CXX_FLAGS "-D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE -std=c++14 ${workaround}")
set(CMAKE_CXX_FLAGS "-DM_PI=3.14159265358979323846 -D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE -std=c++14 ${workaround}")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
IF(CMAKE_HOST_APPLE)
@ -88,14 +88,18 @@ set_target_properties(bthread PROPERTIES IMPORTED_LOCATION ${bthread_l})
include_directories(${Boost_INCLUDE_DIRS})
#find_package(wxWidgets)
#disable wx for the time being - we're not building any of the gui yet
IF(CMAKE_HOST_UNIX)
set(Boost_LIBRARIES bsystem bthread)
ENDIF(CMAKE_HOST_UNIX)
IF(wxWidgets_FOUND)
MESSAGE("wx found!")
INCLUDE("${wxWidgets_USE_FILE}")
target_link_libraries (slic3r slic3r_gui libslic3r admesh clipper polypartition poly2tri bsystem bthread ${wxWidgets_LIBRARIES})
target_link_libraries (slic3r slic3r_gui libslic3r admesh clipper polypartition poly2tri ${Boost_LIBRARIES} ${wxWidgets_LIBRARIES})
ELSE(wxWidgets_FOUND)
# For convenience. When we cannot continue, inform the user
MESSAGE("wx not found!")
target_link_libraries (slic3r slic3r_gui libslic3r admesh clipper polypartition poly2tri bsystem bthread)
target_link_libraries (slic3r libslic3r admesh clipper polypartition poly2tri ${Boost_LIBRARIES})
#skip gui when no wx included
ENDIF(wxWidgets_FOUND)

36
src/windows-build.txt Normal file
View File

@ -0,0 +1,36 @@
Install:
mingw
boost
cmake
git
Assuming boost is in c:\program files\boost\boost_1_61_0 and mingw is in c:\mingw
start cmd.exe
> cd c:\program files\boost\boost_1_61_0
> set PATH=c:\mingw\bin
> bootstrap gcc
> .\b2 --build-dir=c:\boost-mingw toolset=gcc link=static runtime-link=static variant=release --with-system --with-thread
leave cmd window open
start git bash
> cd /c
> git clone http://github.com/alexrj/slic3r
> cd slic3r
> git checkout cppsvg
close git bash when done
make sure c:\mingw\bin is part of the Path system variable, add it otherwise
start cmake gui
source code: c:\slic3r\src
build directory: c:\slic3r\build
click configure, select "mingw makefiles" from list, select "default native compilers", click finish
click generate
close cmake gui
go back to cmd window
> cd c:\slic3r\build
> mingw32-make.exe
might be mingw64 on 64-bit setup, I'm not sure
The resulting slic3r.exe is the target executable, it has no dependencies except windows system libraries (kernel32 and msvcrt)