diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..dfa9fda79 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,101 @@ +cmake_minimum_required (VERSION 2.8) +project (slic3r) +set(workaround "") +if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7.0) +if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.3) +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_INCLUDE_CURRENT_DIR ON) + +IF(CMAKE_HOST_APPLE) + set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -framework IOKit -framework CoreFoundation") +ELSE(CMAKE_HOST_APPLE) + set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") +ENDIF(CMAKE_HOST_APPLE) +set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_STATIC_RUNTIME ON) +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +find_package(Boost COMPONENTS system thread) + +set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/../xs/src/) + +include_directories(${LIBDIR}) +include_directories(${LIBDIR}/libslic3r) +include_directories(${LIBDIR}/Slic3r/GUI/) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/standalone/) +include_directories(${LIBDIR}/admesh/) +include_directories(${LIBDIR}/poly2tri/) +include_directories(${LIBDIR}/poly2tri/sweep) +include_directories(${LIBDIR}/poly2tri/common) +add_library(slic3r_gui STATIC ${LIBDIR}/slic3r/GUI/3DScene.cpp ${LIBDIR}/slic3r/GUI/GUI.cpp) +add_library(libslic3r STATIC ${LIBDIR}/libslic3r/BoundingBox.cpp + ${LIBDIR}/libslic3r/ExPolygon.cpp + ${LIBDIR}/libslic3r/GCode.cpp + ${LIBDIR}/libslic3r/LayerRegion.cpp + ${LIBDIR}/libslic3r/PerimeterGenerator.cpp + ${LIBDIR}/libslic3r/Polyline.cpp + ${LIBDIR}/libslic3r/SurfaceCollection.cpp + ${LIBDIR}/libslic3r/BridgeDetector.cpp + ${LIBDIR}/libslic3r/Extruder.cpp + ${LIBDIR}/libslic3r/GCodeSender.cpp + ${LIBDIR}/libslic3r/Line.cpp + ${LIBDIR}/libslic3r/PlaceholderParser.cpp + ${LIBDIR}/libslic3r/PrintConfig.cpp + ${LIBDIR}/libslic3r/Surface.cpp + ${LIBDIR}/libslic3r/ClipperUtils.cpp + ${LIBDIR}/libslic3r/ExtrusionEntityCollection.cpp + ${LIBDIR}/libslic3r/GCodeWriter.cpp + ${LIBDIR}/libslic3r/Model.cpp + ${LIBDIR}/libslic3r/Point.cpp + ${LIBDIR}/libslic3r/Print.cpp + ${LIBDIR}/libslic3r/SVG.cpp + ${LIBDIR}/libslic3r/SVGExport.cpp + ${LIBDIR}/libslic3r/Config.cpp + ${LIBDIR}/libslic3r/ExtrusionEntity.cpp + ${LIBDIR}/libslic3r/Geometry.cpp + ${LIBDIR}/libslic3r/MotionPlanner.cpp + ${LIBDIR}/libslic3r/Polygon.cpp + ${LIBDIR}/libslic3r/PrintObject.cpp + ${LIBDIR}/libslic3r/TriangleMesh.cpp + ${LIBDIR}/libslic3r/ExPolygonCollection.cpp + ${LIBDIR}/libslic3r/Flow.cpp + ${LIBDIR}/libslic3r/Layer.cpp + ${LIBDIR}/libslic3r/MultiPoint.cpp + ${LIBDIR}/libslic3r/PolylineCollection.cpp + ${LIBDIR}/libslic3r/PrintRegion.cpp) +add_library(admesh STATIC ${LIBDIR}/admesh/util.c ${LIBDIR}/admesh/stl_io.c ${LIBDIR}/admesh/stlinit.c ${LIBDIR}/admesh/shared.c ${LIBDIR}/admesh/normals.c ${LIBDIR}/admesh/connect.c) +add_library(clipper STATIC ${LIBDIR}/clipper.cpp) +add_library(polypartition STATIC ${LIBDIR}/polypartition.cpp) +add_library(poly2tri STATIC ${LIBDIR}/poly2tri/sweep/sweep.cc ${LIBDIR}/poly2tri/sweep/sweep_context.cc ${LIBDIR}/poly2tri/sweep/cdt.cc ${LIBDIR}/poly2tri/sweep/advancing_front.cc ${LIBDIR}/poly2tri/common/shapes.cc) +add_executable(slic3r slic3r.cpp) +set_target_properties(slic3r PROPERTIES LINK_SEARCH_START_STATIC 1) +set_target_properties(slic3r PROPERTIES LINK_SEARCH_END_STATIC 1) +set(wxWidgets_USE_STATIC) +SET(wxWidgets_USE_LIBS) + +set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_STATIC_RUNTIME ON) +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +find_library(bsystem_l boost_system) +add_library(bsystem STATIC IMPORTED) +set_target_properties(bsystem PROPERTIES IMPORTED_LOCATION ${bsystem_l}) +find_library(bthread_l boost_thread) +add_library(bthread STATIC IMPORTED) +set_target_properties(bthread PROPERTIES IMPORTED_LOCATION ${bthread_l}) +include_directories(${Boost_INCLUDE_DIRS}) + +#find_package(wxWidgets) + +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}) +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) +ENDIF(wxWidgets_FOUND) + diff --git a/xs/src/slic3r.cpp b/src/slic3r.cpp similarity index 99% rename from xs/src/slic3r.cpp rename to src/slic3r.cpp index 219435ec0..7e39ae0e3 100644 --- a/xs/src/slic3r.cpp +++ b/src/slic3r.cpp @@ -25,6 +25,7 @@ void exportSVG(const char* stlname, const char* svgname, float layerheight=0.2, t.repair(); t.scale(scale); t.rotate_z(rotate); + t.mirror_x(); t.align_to_origin(); SVGExport e(t,layerheight,initialheight); const char* svgfilename=outname.data(); diff --git a/xs/src/standalone/config.h b/src/standalone/config.h similarity index 100% rename from xs/src/standalone/config.h rename to src/standalone/config.h diff --git a/xs/src/tclap/Arg.h b/src/tclap/Arg.h similarity index 100% rename from xs/src/tclap/Arg.h rename to src/tclap/Arg.h diff --git a/xs/src/tclap/ArgException.h b/src/tclap/ArgException.h similarity index 100% rename from xs/src/tclap/ArgException.h rename to src/tclap/ArgException.h diff --git a/xs/src/tclap/ArgTraits.h b/src/tclap/ArgTraits.h similarity index 100% rename from xs/src/tclap/ArgTraits.h rename to src/tclap/ArgTraits.h diff --git a/xs/src/tclap/CmdLine.h b/src/tclap/CmdLine.h similarity index 100% rename from xs/src/tclap/CmdLine.h rename to src/tclap/CmdLine.h diff --git a/xs/src/tclap/CmdLineInterface.h b/src/tclap/CmdLineInterface.h similarity index 100% rename from xs/src/tclap/CmdLineInterface.h rename to src/tclap/CmdLineInterface.h diff --git a/xs/src/tclap/CmdLineOutput.h b/src/tclap/CmdLineOutput.h similarity index 100% rename from xs/src/tclap/CmdLineOutput.h rename to src/tclap/CmdLineOutput.h diff --git a/xs/src/tclap/Constraint.h b/src/tclap/Constraint.h similarity index 100% rename from xs/src/tclap/Constraint.h rename to src/tclap/Constraint.h diff --git a/xs/src/tclap/DocBookOutput.h b/src/tclap/DocBookOutput.h similarity index 100% rename from xs/src/tclap/DocBookOutput.h rename to src/tclap/DocBookOutput.h diff --git a/xs/src/tclap/HelpVisitor.h b/src/tclap/HelpVisitor.h similarity index 100% rename from xs/src/tclap/HelpVisitor.h rename to src/tclap/HelpVisitor.h diff --git a/xs/src/tclap/IgnoreRestVisitor.h b/src/tclap/IgnoreRestVisitor.h similarity index 100% rename from xs/src/tclap/IgnoreRestVisitor.h rename to src/tclap/IgnoreRestVisitor.h diff --git a/xs/src/tclap/Makefile.am b/src/tclap/Makefile.am similarity index 100% rename from xs/src/tclap/Makefile.am rename to src/tclap/Makefile.am diff --git a/xs/src/tclap/Makefile.in b/src/tclap/Makefile.in similarity index 100% rename from xs/src/tclap/Makefile.in rename to src/tclap/Makefile.in diff --git a/xs/src/tclap/MultiArg.h b/src/tclap/MultiArg.h similarity index 100% rename from xs/src/tclap/MultiArg.h rename to src/tclap/MultiArg.h diff --git a/xs/src/tclap/MultiSwitchArg.h b/src/tclap/MultiSwitchArg.h similarity index 100% rename from xs/src/tclap/MultiSwitchArg.h rename to src/tclap/MultiSwitchArg.h diff --git a/xs/src/tclap/OptionalUnlabeledTracker.h b/src/tclap/OptionalUnlabeledTracker.h similarity index 100% rename from xs/src/tclap/OptionalUnlabeledTracker.h rename to src/tclap/OptionalUnlabeledTracker.h diff --git a/xs/src/tclap/StandardTraits.h b/src/tclap/StandardTraits.h similarity index 100% rename from xs/src/tclap/StandardTraits.h rename to src/tclap/StandardTraits.h diff --git a/xs/src/tclap/StdOutput.h b/src/tclap/StdOutput.h similarity index 100% rename from xs/src/tclap/StdOutput.h rename to src/tclap/StdOutput.h diff --git a/xs/src/tclap/SwitchArg.h b/src/tclap/SwitchArg.h similarity index 100% rename from xs/src/tclap/SwitchArg.h rename to src/tclap/SwitchArg.h diff --git a/xs/src/tclap/UnlabeledMultiArg.h b/src/tclap/UnlabeledMultiArg.h similarity index 100% rename from xs/src/tclap/UnlabeledMultiArg.h rename to src/tclap/UnlabeledMultiArg.h diff --git a/xs/src/tclap/UnlabeledValueArg.h b/src/tclap/UnlabeledValueArg.h similarity index 100% rename from xs/src/tclap/UnlabeledValueArg.h rename to src/tclap/UnlabeledValueArg.h diff --git a/xs/src/tclap/ValueArg.h b/src/tclap/ValueArg.h similarity index 100% rename from xs/src/tclap/ValueArg.h rename to src/tclap/ValueArg.h diff --git a/xs/src/tclap/ValuesConstraint.h b/src/tclap/ValuesConstraint.h similarity index 100% rename from xs/src/tclap/ValuesConstraint.h rename to src/tclap/ValuesConstraint.h diff --git a/xs/src/tclap/VersionVisitor.h b/src/tclap/VersionVisitor.h similarity index 100% rename from xs/src/tclap/VersionVisitor.h rename to src/tclap/VersionVisitor.h diff --git a/xs/src/tclap/Visitor.h b/src/tclap/Visitor.h similarity index 100% rename from xs/src/tclap/Visitor.h rename to src/tclap/Visitor.h diff --git a/xs/src/tclap/XorHandler.h b/src/tclap/XorHandler.h similarity index 100% rename from xs/src/tclap/XorHandler.h rename to src/tclap/XorHandler.h diff --git a/xs/src/tclap/ZshCompletionOutput.h b/src/tclap/ZshCompletionOutput.h similarity index 100% rename from xs/src/tclap/ZshCompletionOutput.h rename to src/tclap/ZshCompletionOutput.h diff --git a/xs/src/CMakeLists.txt b/xs/src/CMakeLists.txt deleted file mode 100644 index 9a862b9a8..000000000 --- a/xs/src/CMakeLists.txt +++ /dev/null @@ -1,98 +0,0 @@ -cmake_minimum_required (VERSION 2.8) -project (slic3r) -set(workaround "") -if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7.0) -if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.3) -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_INCLUDE_CURRENT_DIR ON) - -IF(CMAKE_HOST_APPLE) - set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -framework IOKit -framework CoreFoundation") -ELSE(CMAKE_HOST_APPLE) - set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") -ENDIF(CMAKE_HOST_APPLE) -set(Boost_USE_STATIC_LIBS ON) -set(Boost_USE_STATIC_RUNTIME ON) -set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -find_package(Boost COMPONENTS system thread) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libslic3r) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Slic3r/GUI/) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/standalone/) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/admesh/) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/poly2tri/) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/poly2tri/sweep) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/poly2tri/common) -add_library(slic3r_gui STATIC slic3r/GUI/3DScene.cpp slic3r/GUI/GUI.cpp) -add_library(libslic3r STATIC libslic3r/BoundingBox.cpp - libslic3r/ExPolygon.cpp - libslic3r/GCode.cpp - libslic3r/LayerRegion.cpp - libslic3r/PerimeterGenerator.cpp - libslic3r/Polyline.cpp - libslic3r/SurfaceCollection.cpp - libslic3r/BridgeDetector.cpp - libslic3r/Extruder.cpp - libslic3r/GCodeSender.cpp - libslic3r/Line.cpp - libslic3r/PlaceholderParser.cpp - libslic3r/PrintConfig.cpp - libslic3r/Surface.cpp - libslic3r/ClipperUtils.cpp - libslic3r/ExtrusionEntityCollection.cpp - libslic3r/GCodeWriter.cpp - libslic3r/Model.cpp - libslic3r/Point.cpp - libslic3r/Print.cpp - libslic3r/SVG.cpp - libslic3r/SVGExport.cpp - libslic3r/Config.cpp - libslic3r/ExtrusionEntity.cpp - libslic3r/Geometry.cpp - libslic3r/MotionPlanner.cpp - libslic3r/Polygon.cpp - libslic3r/PrintObject.cpp - libslic3r/TriangleMesh.cpp - libslic3r/ExPolygonCollection.cpp - libslic3r/Flow.cpp - libslic3r/Layer.cpp - libslic3r/MultiPoint.cpp - libslic3r/PolylineCollection.cpp - libslic3r/PrintRegion.cpp) -add_library(admesh STATIC admesh/util.c admesh/stl_io.c admesh/stlinit.c admesh/shared.c admesh/normals.c admesh/connect.c) -add_library(clipper STATIC clipper.cpp) -add_library(polypartition STATIC polypartition.cpp) -add_library(poly2tri STATIC poly2tri/sweep/sweep.cc poly2tri/sweep/sweep_context.cc poly2tri/sweep/cdt.cc poly2tri/sweep/advancing_front.cc poly2tri/common/shapes.cc) -add_executable(slic3r slic3r.cpp) -set_target_properties(slic3r PROPERTIES LINK_SEARCH_START_STATIC 1) -set_target_properties(slic3r PROPERTIES LINK_SEARCH_END_STATIC 1) -set(wxWidgets_USE_STATIC) -SET(wxWidgets_USE_LIBS) - -set(Boost_USE_STATIC_LIBS ON) -set(Boost_USE_STATIC_RUNTIME ON) -set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -find_library(bsystem_l boost_system) -add_library(bsystem STATIC IMPORTED) -set_target_properties(bsystem PROPERTIES IMPORTED_LOCATION ${bsystem_l}) -find_library(bthread_l boost_thread) -add_library(bthread STATIC IMPORTED) -set_target_properties(bthread PROPERTIES IMPORTED_LOCATION ${bthread_l}) -include_directories(${Boost_INCLUDE_DIRS}) - -#find_package(wxWidgets) - -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}) -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) -ENDIF(wxWidgets_FOUND) -