[mathgl] draft port (#6463)

* [mathgl] draft port

* [mathgl] fix unmatching symbols
This commit is contained in:
Stefano Sinigardi 2019-05-24 23:42:47 +02:00 committed by Robert Schumacher
parent 09e6b4dd9d
commit ff77285e6b
3 changed files with 231 additions and 0 deletions

48
ports/mathgl/CONTROL Normal file
View File

@ -0,0 +1,48 @@
Source: mathgl
Version: 2.4.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
Feature: hdf5
Build-Depends: hdf5
Description: hdf5 module
Feature: fltk
Build-Depends: fltk
Description: fltk module
Feature: gif
Build-Depends: giflib
Description: gif module
Feature: png
Build-Depends: libpng
Description: png module
Feature: zlib
Build-Depends: zlib
Description: zlib module
Feature: jpeg
Build-Depends: libjpeg-turbo
Description: jpeg module
Feature: gsl
Build-Depends: gsl
Description: gsl module
Feature: opengl
Build-Depends: opengl
Description: opengl module
Feature: glut
Build-Depends: freeglut
Description: glut module
Feature: wx
Build-Depends: wxwidgets
Description: wx module
Feature: qt5
Build-Depends: qt5
Description: qt5 module

121
ports/mathgl/portfile.cmake Normal file
View File

@ -0,0 +1,121 @@
include(vcpkg_common_functions)
set(MATHGL_VERSION "2.4.3")
vcpkg_download_distfile(ARCHIVE
URLS "https://downloads.sourceforge.net/project/mathgl/mathgl/mathgl%20${MATHGL_VERSION}/mathgl-${MATHGL_VERSION}.tar.gz"
FILENAME "mathgl-${MATHGL_VERSION}.tar.gz"
SHA512 e47fc8171ce80c8b33a8f03d9375bc036455dae539b47cf4ee922f8fa36f5afcf8b3f0666997764e453eb698c0e8c03da36dd0ac2bf71c158e95309b247d27de
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${MATHGL_VERSION}
PATCHES
type_fix.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_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}
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/mathgl)
file(REMOVE ${CURRENT_PACKAGES_DIR}/mathgl2-config.cmake)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/mathgl2-config.cmake)
else()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/mathgl TARGET_PATH share/mathgl)
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
#somehow the native CMAKE_EXECUTABLE_SUFFIX does not work, so here we emulate it
if(CMAKE_HOST_WIN32)
set(EXECUTABLE_SUFFIX ".exe")
else()
set(EXECUTABLE_SUFFIX "")
endif()
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})
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/mathgl)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mathgl RENAME copyright)

View File

@ -0,0 +1,62 @@
diff --git a/src/complex.cpp b/src/complex.cpp
index 2fcc14c..fb3498f 100755
--- a/src/complex.cpp
+++ b/src/complex.cpp
@@ -863,12 +863,12 @@ void MGL_EXPORT mgl_datac_insert_(uintptr_t *d, const char *dir, int *at, int *n
void MGL_EXPORT mgl_datac_delete_(uintptr_t *d, const char *dir, int *at, int *num, int)
{ mgl_datac_delete(_DC_,*dir,*at,*num); }
//-----------------------------------------------------------------------------
-void MGL_EXPORT mgl_datac_set_value(HADT dat, dual v, long i, long j, long k)
+void MGL_EXPORT mgl_datac_set_value(HADT dat, mdual v, long i, long j, long k)
{
if(i>=0 && i<dat->nx && j>=0 && j<dat->ny && k>=0 && k<dat->nz)
dat->a[i+dat->nx*(j+dat->ny*k)]=v;
}
-void MGL_EXPORT mgl_datac_set_value_(uintptr_t *d, dual *v, int *i, int *j, int *k)
+void MGL_EXPORT mgl_datac_set_value_(uintptr_t *d, mdual *v, int *i, int *j, int *k)
{ mgl_datac_set_value(_DC_,*v,*i,*j,*k); }
//-----------------------------------------------------------------------------
cmdual MGL_EXPORT mgl_datac_get_value(HCDT dat, long i, long j, long k)
diff --git a/src/complex_io.cpp b/src/complex_io.cpp
index 2fcd40a..49feb5c 100755
--- a/src/complex_io.cpp
+++ b/src/complex_io.cpp
@@ -343,14 +343,14 @@ void MGL_EXPORT mgl_datac_create(HADT d,long mx,long my,long mz)
void MGL_EXPORT mgl_datac_create_(uintptr_t *d, int *nx,int *ny,int *nz)
{ mgl_datac_create(_DC_,*nx,*ny,*nz); }
//-----------------------------------------------------------------------------
-void MGL_EXPORT mgl_datac_link(HADT d, dual *A, long mx,long my,long mz)
+void MGL_EXPORT mgl_datac_link(HADT d, mdual *A, long mx,long my,long mz)
{
if(!A) return;
if(!d->link && d->a) delete [](d->a);
d->nx = mx>0 ? mx:1; d->ny = my>0 ? my:1; d->nz = mz>0 ? mz:1;
- d->link=true; d->a=A; d->NewId();
+ d->link=true; d->a=(dual*)A; d->NewId();
}
-void MGL_EXPORT mgl_datac_link_(uintptr_t *d, dual *A, int *nx,int *ny,int *nz)
+void MGL_EXPORT mgl_datac_link_(uintptr_t *d, mdual *A, int *nx,int *ny,int *nz)
{ mgl_datac_link(_DC_,A,*nx,*ny,*nz); }
//-----------------------------------------------------------------------------
int MGL_EXPORT mgl_datac_read_dim(HADT d, const char *fname,long mx,long my,long mz)
diff --git a/utils/mgltask.cpp b/utils/mgltask.cpp
index b9bb7da..4566512 100755
--- a/utils/mgltask.cpp
+++ b/utils/mgltask.cpp
@@ -2,6 +2,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
//===================================================================
@@ -100,7 +101,7 @@ int main(int argc, char *argv[])
double x1[10],x2[10],dx[10],x[10];
int k,i,n=argc-3;//=(argc==4) ? 1:2;
FILE *fm,*fo;
-
+
// first place zeros
for(i=0;i<10;i++)
{