[mathgl]Fix build failure on x86-windows. (#8145)

* [mathgl]Add function declare, change member function name, add link lib in Windows.

* [mathgl]Determine whether there is a file then duplicate.
This commit is contained in:
Alvin 2019-09-13 04:31:04 +08:00 committed by Griffin Downs
parent fba465af91
commit 595363d842
3 changed files with 98 additions and 1 deletions

View File

@ -1,5 +1,5 @@
Source: mathgl
Version: 2.4.3-1
Version: 2.4.3-2
Description: MathGL is a free library of fast C++ routines for the plotting of the data varied in one or more dimensions
Default-Features: opengl, jpeg, png, zlib

View File

@ -0,0 +1,87 @@
diff --git a/mgllab/CMakeLists.txt b/mgllab/CMakeLists.txt
index 1649104..eeec1c1 100644
--- a/mgllab/CMakeLists.txt
+++ b/mgllab/CMakeLists.txt
@@ -38,7 +38,11 @@ if(MGL_HAVE_FLTK)
set(mgllab_src ${mgllab_src} mgllab.rc)
endif(WIN32)
add_executable(mgllab ${mgllab_src} ${mgllab_hdr})
- target_link_libraries(mgllab mgl mgl-fltk ${FLTK_LIBRARIES})
+ if(WIN32)
+ target_link_libraries(mgllab mgl mgl-fltk mgl-fltk-static mgl-static getopt-static ${FLTK_LIBRARIES})
+ else(WIN32)
+ target_link_libraries(mgllab mgl mgl-fltk ${FLTK_LIBRARIES})
+ endif(WIN32)
install(
TARGETS mgllab
RUNTIME DESTINATION bin )
diff --git a/mgllab/table.cpp b/mgllab/table.cpp
index 5243549..23eebe5 100644
--- a/mgllab/table.cpp
+++ b/mgllab/table.cpp
@@ -559,8 +559,13 @@ public:
o->tooltip(_("Change data values and close this window"));
w->set_modal(); w->end();
}
- double min() { return wmin->value(); }
- double max() { return wmax->value(); }
+ #if WIN32
+ double _min() { return wmin->value(); }
+ double _max() { return wmax->value(); }
+ #else
+ double min() { return wmin->value(); }
+ double max() { return wmax->value(); }
+ #endif
int sym() { return wsym->value(); }
bool ok() { return !result.empty(); }
void cb_ok()
@@ -581,8 +586,14 @@ void fill_cb(Fl_Widget*, void*v)
HMDT d = dynamic_cast<HMDT>(e->var);
HADT c = dynamic_cast<HADT>(e->var);
char ch = nrm_dlg.result[0];
- if(d) { d->Fill(nrm_dlg.min(),nrm_dlg.max(),ch); e->refresh(); }
- if(c) { c->Fill(nrm_dlg.min(),nrm_dlg.max(),ch); e->refresh(); }
+ #if WIN32
+ if(d) { d->Fill(nrm_dlg._min(),nrm_dlg._max(),ch); e->refresh(); }
+ if(c) { c->Fill(nrm_dlg._min(),nrm_dlg._max(),ch); e->refresh(); }
+ #else
+ if(d) { d->Fill(nrm_dlg.min(),nrm_dlg.max(),ch); e->refresh(); }
+ if(c) { c->Fill(nrm_dlg.min(),nrm_dlg.max(),ch); e->refresh(); }
+ #endif
+
}
}
//-----------------------------------------------------------------------------
@@ -594,8 +605,13 @@ void normal_cb(Fl_Widget*, void*v)
{
HMDT d = dynamic_cast<HMDT>(e->var);
HADT c = dynamic_cast<HADT>(e->var);
- if(d) { d->Norm(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym()); e->refresh(); }
- if(c) { c->Fill(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym()); e->refresh(); }
+ #if WIN32
+ if(d) { d->Norm(nrm_dlg._min(),nrm_dlg._max(),nrm_dlg.sym()); e->refresh(); }
+ if(c) { c->Fill(nrm_dlg._min(),nrm_dlg._max(),nrm_dlg.sym()); e->refresh(); }
+ #else
+ if(d) { d->Norm(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym()); e->refresh(); }
+ if(c) { c->Fill(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym()); e->refresh(); }
+ #endif
}
}
//-----------------------------------------------------------------------------
diff --git a/utils/mglview.cpp b/utils/mglview.cpp
index d360df3..15eeb3e 100644
--- a/utils/mglview.cpp
+++ b/utils/mglview.cpp
@@ -29,6 +29,12 @@
#include "mgl2/qt.h"
#endif
//-----------------------------------------------------------------------------
+#if WIN32
+ MGL_EXPORT void (*mgl_ask_func)(const wchar_t *, wchar_t *)=0;
+ MGL_EXPORT void (*mgl_progress_func)(int value, int maximal, HMGL)=0;
+ MGL_EXPORT std::string mglGlobalMess;
+#endif
+//-----------------------------------------------------------------------------
std::wstring str, opt;
std::vector<std::string> anim;
mglParse p(true);

View File

@ -13,6 +13,7 @@ vcpkg_extract_source_archive_ex(
REF ${MATHGL_VERSION}
PATCHES
type_fix.patch
fix_cmakelists_and_cpp.patch
)
set(enable-hdf5 OFF)
@ -107,11 +108,20 @@ else()
set(EXECUTABLE_SUFFIX "")
endif()
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/mgllab${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/mglview${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/mglconv${EXECUTABLE_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/mgltask${EXECUTABLE_SUFFIX})
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/mathgl/)
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/mglconv${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/mathgl/mglconv${EXECUTABLE_SUFFIX})
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/mgltask${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/mathgl/mgltask${EXECUTABLE_SUFFIX})
if (EXISTS ${CURRENT_PACKAGES_DIR}/bin/mgllab${EXECUTABLE_SUFFIX})
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/mgllab${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/mathgl/mgllab${EXECUTABLE_SUFFIX})
endif()
if (EXISTS ${CURRENT_PACKAGES_DIR}/bin/mglview${EXECUTABLE_SUFFIX})
file(RENAME ${CURRENT_PACKAGES_DIR}/bin/mglview${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/mathgl/mglview${EXECUTABLE_SUFFIX})
endif()
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/mathgl)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)