diff --git a/src/Mod/Path/libarea/Area.cpp b/src/Mod/Path/libarea/Area.cpp index 4755f9eff..cb5573a0a 100644 --- a/src/Mod/Path/libarea/Area.cpp +++ b/src/Mod/Path/libarea/Area.cpp @@ -24,6 +24,24 @@ bool CArea::m_set_processing_length_in_split = false; double CArea::m_after_MakeOffsets_length = 0.0; //static const double PI = 3.1415926535897932; +#define _CAREA_PARAM_DEFINE(_class,_type,_name) \ + _type CArea::get_##_name() {return _class::_name;}\ + void CArea::set_##_name(_type _name) {_class::_name = _name;} + +#define CAREA_PARAM_DEFINE(_type,_name) \ + _type CArea::get_##_name() {return m_##_name;}\ + void CArea::set_##_name(_type _name) {m_##_name = _name;} + +_CAREA_PARAM_DEFINE(Point,double,tolerance); +CAREA_PARAM_DEFINE(bool,fit_arcs) +CAREA_PARAM_DEFINE(bool,clipper_simple); +CAREA_PARAM_DEFINE(double,clipper_clean_distance); +CAREA_PARAM_DEFINE(double,accuracy); +CAREA_PARAM_DEFINE(double,units); +CAREA_PARAM_DEFINE(short,min_arc_points); +CAREA_PARAM_DEFINE(short,max_arc_points); +CAREA_PARAM_DEFINE(double,clipper_scale); + void CArea::append(const CCurve& curve) { m_curves.push_back(curve); diff --git a/src/Mod/Path/libarea/Area.h b/src/Mod/Path/libarea/Area.h index 56c221e04..224f48327 100644 --- a/src/Mod/Path/libarea/Area.h +++ b/src/Mod/Path/libarea/Area.h @@ -84,6 +84,21 @@ public: void SpanIntersections(const Span& span, std::list &pts)const; void CurveIntersections(const CCurve& curve, std::list &pts)const; void InsideCurves(const CCurve& curve, std::list &curves_inside)const; + + //Avoid outside direct accessing static member variable because of Windows DLL issue +#define CAREA_PARAM_DECLARE(_type,_name) \ + static _type get_##_name();\ + static void set_##_name(_type _name); + + CAREA_PARAM_DECLARE(double,tolerance); + CAREA_PARAM_DECLARE(bool,fit_arcs) + CAREA_PARAM_DECLARE(bool,clipper_simple); + CAREA_PARAM_DECLARE(double,clipper_clean_distance); + CAREA_PARAM_DECLARE(double,accuracy); + CAREA_PARAM_DECLARE(double,units); + CAREA_PARAM_DECLARE(short,min_arc_points); + CAREA_PARAM_DECLARE(short,max_arc_points); + CAREA_PARAM_DECLARE(double,clipper_scale); }; enum eOverlapType diff --git a/src/Mod/Path/libarea/CMakeLists.txt b/src/Mod/Path/libarea/CMakeLists.txt index 8359267ab..6e489b638 100644 --- a/src/Mod/Path/libarea/CMakeLists.txt +++ b/src/Mod/Path/libarea/CMakeLists.txt @@ -65,37 +65,52 @@ file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") # this makes the Python module add_library( - area - MODULE + area-native + SHARED ${AREA_SRC_COMMON} ${AREA_SRC_CLIPPER} - ${PYAREA_SRC} +) + +add_library( + area + MODULE + ${PYAREA_SRC} ) if(MSVC) - set(area_LIBS - ${Boost_LIBRARIES} - ${PYTHON_LIBRARIES} + set(area_native_LIBS debug MSVCRTD.LIB debug MSVCPRTD.LIB optimized MSVCRT.LIB optimized MSVCPRT.LIB ) -elseif(MINGW) set(area_LIBS ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} + ${area_native_LIBS} + ) +elseif(MINGW) + set(area_native_LIBS Rpcrt4.lib ) + set(area_LIBS + ${Boost_LIBRARIES} + ${PYTHON_LIBRARIES} + ${area_native_LIBS} + ) else(MSVC) + set(area_native_LIBS + ) set(area_LIBS ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ) endif(MSVC) -target_link_libraries(area ${area_LIBS}) +target_link_libraries(area-native ${area_native_LIBS}) +SET_BIN_DIR(area-native area-native) +target_link_libraries(area area-native ${area_LIBS} ${area_native_LIBS}) SET_BIN_DIR(area area) SET_PYTHON_PREFIX_SUFFIX(area) @@ -108,8 +123,20 @@ execute_process( message(STATUS "area module (for Path Workbench) will be installed to: " ${CMAKE_INSTALL_LIBDIR}) +if(WIN32) + set_target_properties(area-native PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + INSTALL(TARGETS area-native + RUNTIME DESTINATION bin + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) +else(WIN32) + INSTALL(TARGETS area-native + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) +endif(WIN32) + # this installs the python library install( TARGETS area - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + DESTINATION ${CMAKE_INSTALL_LIBDIR} ) diff --git a/src/Mod/Path/libarea/Curve.cpp b/src/Mod/Path/libarea/Curve.cpp index 456c546e3..d62763196 100644 --- a/src/Mod/Path/libarea/Curve.cpp +++ b/src/Mod/Path/libarea/Curve.cpp @@ -13,6 +13,12 @@ double Point::tolerance = 0.001; //static const double PI = 3.1415926535897932; duplicated in kurve/geometry.h +//This function is moved from header here to solve windows DLL not export +//static variable problem +bool Point::operator==(const Point& p)const{ + return fabs(x-p.x)::const_iterator It = c.m_vertices.begin(); It != c.m_vertices.end(); It++, i++) { const CVertex& vertex = *It; - printf("vertex %d type = %d, x = %g, y = %g", i+1, vertex.m_type, vertex.m_p.x / CArea::m_units, vertex.m_p.y / CArea::m_units); - if(vertex.m_type)printf(", xc = %g, yc = %g", vertex.m_c.x / CArea::m_units, vertex.m_c.y / CArea::m_units); + printf("vertex %d type = %d, x = %g, y = %g", i+1, vertex.m_type, vertex.m_p.x / CArea::get_units(), vertex.m_p.y / CArea::get_units()); + if(vertex.m_type)printf(", xc = %g, yc = %g", vertex.m_c.x / CArea::get_units(), vertex.m_c.y / CArea::get_units()); printf("\n"); } } @@ -112,12 +112,12 @@ static CVertex LastVertex(const CCurve& curve) static void set_units(double units) { - CArea::m_units = units; + CArea::set_units(units); } static double get_units() { - return CArea::m_units; + return CArea::get_units(); } static bool holes_linked()