aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/mathgl/CONTROL2
-rw-r--r--ports/mathgl/fix_cmakelists_and_cpp.patch78
-rw-r--r--ports/mathgl/portfile.cmake84
3 files changed, 91 insertions, 73 deletions
diff --git a/ports/mathgl/CONTROL b/ports/mathgl/CONTROL
index 5854d5d6d..a600207e3 100644
--- a/ports/mathgl/CONTROL
+++ b/ports/mathgl/CONTROL
@@ -1,5 +1,5 @@
Source: mathgl
-Version: 2.4.3-2
+Version: 2.4.3-3
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
diff --git a/ports/mathgl/fix_cmakelists_and_cpp.patch b/ports/mathgl/fix_cmakelists_and_cpp.patch
index 1e7a253bf..a929f1ebe 100644
--- a/ports/mathgl/fix_cmakelists_and_cpp.patch
+++ b/ports/mathgl/fix_cmakelists_and_cpp.patch
@@ -68,20 +68,86 @@ index 5243549..23eebe5 100644
}
}
//-----------------------------------------------------------------------------
+diff --git a/src/parser.cpp b/src/parser.cpp
+index 577191d..e6909a1 100644
+--- a/src/parser.cpp
++++ b/src/parser.cpp
+@@ -58,7 +58,10 @@ void mglParser::FillBaseCmd()
+ HMDT MGL_NO_EXPORT mglFormulaCalc(std::wstring string, mglParser *arg, const std::vector<mglDataA*> &head);
+ HADT MGL_NO_EXPORT mglFormulaCalcC(std::wstring string, mglParser *arg, const std::vector<mglDataA*> &head);
+ //-----------------------------------------------------------------------------
++#ifndef MGL_ASK_FUNC
++#define MGL_ASK_FUNC
+ MGL_EXPORT void (*mgl_ask_func)(const wchar_t *, wchar_t *)=0;
++#endif
+ void MGL_EXPORT mgl_ask_gets(const wchar_t *quest, wchar_t *res)
+ { printf("%ls\n",quest); if(!fgetws(res,1024,stdin)) *res=0; }
+ //-----------------------------------------------------------------------------
+@@ -69,7 +72,10 @@ void MGL_EXPORT mgl_progress_txt(int value, int maximal, HMGL)
+ else for(int i=prev;i<value;i++) printf("#");
+ prev = value; fflush(stdout);
+ }
++#ifndef MGL_PROGRESS_FUNC
++#define MGL_PROGRESS_FUNC
+ MGL_EXPORT void (*mgl_progress_func)(int value, int maximal, HMGL)=mgl_progress_txt;
++#endif
+ void MGL_EXPORT mgl_progress(int value, int maximal, HMGL gr)
+ { mgl_progress_func(value, maximal, gr); }
+ //-----------------------------------------------------------------------------
diff --git a/utils/mglview.cpp b/utils/mglview.cpp
-index d360df3..15eeb3e 100644
+index d360df3..7e2634b 100644
--- a/utils/mglview.cpp
+++ b/utils/mglview.cpp
-@@ -29,6 +29,12 @@
+@@ -29,6 +29,18 @@
#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;
++#ifdef WIN32
++#ifndef MGL_ASK_FUNC
++#define MGL_ASK_FUNC
++MGL_EXPORT void (*mgl_ask_func)(const wchar_t *, wchar_t *)=0;
++#endif
++#ifndef MGL_PROGRESS_FUNC
++#define MGL_PROGRESS_FUNC
++MGL_EXPORT void (*mgl_progress_func)(int value, int maximal, HMGL)=0;
++#endif
++MGL_EXPORT std::string mglGlobalMess; ///< Buffer for receiving global messages
+#endif
+//-----------------------------------------------------------------------------
std::wstring str, opt;
std::vector<std::string> anim;
mglParse p(true);
+diff --git a/include/mgl2/datac.h b/include/mgl2/datac.h
+index f2c0251..0e69de7 100644
+--- a/include/mgl2/datac.h
++++ b/include/mgl2/datac.h
+@@ -474,7 +474,7 @@ using mglDataA::Momentum;
+ void set_v(mreal val, long i,long j=0,long k=0) { a[i+nx*(j+ny*k)]=val; }
+ #else
+ /// Get the value in given cell of the data with border checking
+- mreal v(long i,long j=0,long k=0) const { return mgl_abs(mgl_datac_get_value(this,i,j,k)); }
++ mreal v(long i,long j=0,long k=0) const { return abs(a[i+nx*(j+ny*k)]); }
+ /// Set the value in given cell of the data
+ void set_v(mreal val, long i,long j=0,long k=0) { mgl_datac_set_value(this,val,i,j,k); }
+ #endif
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d0c779d..acd9d7f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -579,10 +579,15 @@ if(enable-glut)
+ if(NOT MGL_HAVE_OPENGL)
+ message(SEND_ERROR "You have to enable OpenGL if you plan to use GLUT.")
+ endif(NOT MGL_HAVE_OPENGL)
+- include(FindGLUT)
++ find_path(GLUT_INCLUDE_DIR freeglut.h PATH_SUFFIXES GL)
++ include(SelectLibraryConfigurations)
++ find_library(GLUT_LIBRARY_RELEASE NAMES freeglut)
++ find_library(GLUT_LIBRARY_DEBUG NAMES freeglutd)
++ select_library_configurations(GLUT)
+ if(NOT GLUT_FOUND)
+ message(SEND_ERROR "Couldn't find GLUT library.")
+ endif(NOT GLUT_FOUND)
++ include_directories(${GLUT_INCLUDE_DIR}/GL)
+ else(enable-glut)
+ set(MGL_HAVE_GLUT 0)
+ endif(enable-glut)
diff --git a/ports/mathgl/portfile.cmake b/ports/mathgl/portfile.cmake
index 4e4aff5dc..3556b917c 100644
--- a/ports/mathgl/portfile.cmake
+++ b/ports/mathgl/portfile.cmake
@@ -16,76 +16,24 @@ vcpkg_extract_source_archive_ex(
fix_cmakelists_and_cpp.patch
)
-set(enable-hdf5 OFF)
-if("hdf5" IN_LIST FEATURES)
- set(enable-hdf5 ON)
-endif()
-
-set(enable-fltk OFF)
-if("fltk" IN_LIST FEATURES)
- set(enable-fltk ON)
-endif()
-
-set(enable-gif OFF)
-if("gif" IN_LIST FEATURES)
- set(enable-gif ON)
-endif()
-
-set(enable-png OFF)
-if("png" IN_LIST FEATURES)
- set(enable-png ON)
-endif()
-
-set(enable-zlib OFF)
-if("zlib" IN_LIST FEATURES)
- set(enable-zlib ON)
-endif()
-
-set(enable-jpeg OFF)
-if("jpeg" IN_LIST FEATURES)
- set(enable-jpeg ON)
-endif()
-
-set(enable-gsl OFF)
-if("gsl" IN_LIST FEATURES)
- set(enable-gsl ON)
-endif()
-
-set(enable-opengl OFF)
-if("opengl" IN_LIST FEATURES)
- set(enable-opengl ON)
-endif()
-
-set(enable-glut OFF)
-if("glut" IN_LIST FEATURES)
- set(enable-glut ON)
-endif()
-
-set(enable-wx OFF)
-if("wx" IN_LIST FEATURES)
- set(enable-wx ON)
-endif()
-
-set(enable-qt5 OFF)
-if("qt5" IN_LIST FEATURES)
- set(enable-qt5 ON)
-endif()
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ hdf5 enable-hdf5
+ fltk enable-fltk
+ gif enable-gif
+ png enable-png
+ zlib enable-zlib
+ jpeg enable-jpeg
+ gsl enable-gsl
+ opengl enable-opengl
+ glut enable-glut
+ wx enable-wx
+ qt5 enable-qt5
+)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
- OPTIONS
- -Denable-hdf5=${enable-hdf5}
- -Denable-fltk=${enable-fltk}
- -Denable-gif=${enable-gif}
- -Denable-png=${enable-png}
- -Denable-zlib=${enable-zlib}
- -Denable-jpeg=${enable-jpeg}
- -Denable-gsl=${enable-gsl}
- -Denable-opengl=${enable-opengl}
- -Denable-glut=${enable-glut}
- -Denable-wx=${enable-wx}
- -Denable-qt5=${enable-qt5}
+ OPTIONS ${FEATURE_OPTIONS}
)
vcpkg_install_cmake()
@@ -112,6 +60,7 @@ 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(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/udav${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})
@@ -121,6 +70,9 @@ 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()
+if (EXISTS ${CURRENT_PACKAGES_DIR}/bin/udav${EXECUTABLE_SUFFIX})
+ file(RENAME ${CURRENT_PACKAGES_DIR}/bin/udav${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/mathgl/udav${EXECUTABLE_SUFFIX})
+endif()
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/mathgl)