early-access version 2853

This commit is contained in:
pineappleEA
2022-07-23 03:01:36 +02:00
parent 1f2b5081b5
commit 1f111bb69c
8955 changed files with 418777 additions and 999 deletions

View File

@@ -0,0 +1,14 @@
diff --git "a/include/mgl2/define.h" "b/include/mgl2/define.h"
index e23ec04..8e79086 100644
--- "a/include/mgl2/define.h"
+++ "b/include/mgl2/define.h"
@@ -141,7 +140,9 @@ typedef long msize;
#define getcwd _getcwd
#define chdir _chdir // BORLAND has chdir
#endif
+#if (_MSC_VER<1500)
#define snprintf _snprintf
+#endif
#if (_MSC_VER<1600) // based on https://hg.python.org/cpython/rev/9aedb876c2d7
#define hypot _hypot
#endif

View File

@@ -0,0 +1,11 @@
--- a/include/mgl2/define.h 2021-12-08 13:59:55.000000000 +0800
+++ a/include/mgl2/define.h 2021-12-15 10:39:09.701079400 +0800
@@ -66,6 +66,8 @@
#else
#define MGL_FUNC_CONST
#define MGL_FUNC_PURE
+#define MGL_FUNC_INIT
+#define MGL_FUNC_FINI
#endif
#define MGL_EXPORT_CONST MGL_EXPORT MGL_FUNC_CONST
#define MGL_EXPORT_PURE MGL_EXPORT MGL_FUNC_PURE

View File

@@ -0,0 +1,38 @@
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/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)

View File

@@ -0,0 +1,21 @@
diff --git "a/src/canvas_cf.cpp" "b/src/canvas_cf.cpp"
index 5e1443a..26a0a8e 100644
--- "a/src/canvas_cf.cpp"
+++ "b/src/canvas_cf.cpp"
@@ -50,7 +50,6 @@ void MGL_EXPORT MGL_FUNC_INIT mgl_init() // TODO try to add ld option: "-init mg
#endif
for(long i=0;i<360;i++) mgl_cos[i] = cos(i*M_PI/180.);
if(!mglDefFont) mglDefFont = new mglFont(MGL_DEF_FONT_NAME);
- if(!mglDefaultGr) mglDefaultGr = new mglCanvas(600,400);
}
}
void MGL_EXPORT MGL_FUNC_FINI mgl_fini() // TODO try to add ld option: "-fini mgl_fini"
@@ -434,7 +433,7 @@ void MGL_EXPORT mgl_set_legend_marks(HMGL gr, int num)
uintptr_t MGL_EXPORT mgl_create_graph_(int *width, int *height)
{ return uintptr_t(new mglCanvas(*width,*height)); }
void MGL_EXPORT mgl_delete_graph_(uintptr_t *gr) { delete _GR_; }
-uintptr_t MGL_EXPORT mgl_default_graph_() { return uintptr_t(&mglDefaultGr); }
+uintptr_t MGL_EXPORT mgl_default_graph_() { return uintptr_t(mgl_default_graph()); }
void MGL_EXPORT mgl_set_size_scl_(double *scl) { mgl_set_size_scl(*scl); }
void MGL_EXPORT mgl_set_size_(uintptr_t *gr, int *width, int *height)
{ mgl_set_size(_GR_,*width,*height); }

View File

@@ -0,0 +1,28 @@
diff --git a/include/mgl2/abstract.h b/include/mgl2/abstract.h
index c8c53b8..245333b 100644
--- a/include/mgl2/abstract.h
+++ b/include/mgl2/abstract.h
@@ -235,7 +235,11 @@ struct MGL_EXPORT mglNum
};
//-----------------------------------------------------------------------------
/// List of user-defined data arrays
+#ifndef MGL_WIDGETS_DLL
MGL_EXPORT extern std::vector<mglDataA*> mglDataList;
+#else
+__declspec(dllimport) extern std::vector<mglDataA*> mglDataList;
+#endif
//-----------------------------------------------------------------------------
/// Abstract class for data array
class MGL_EXPORT mglDataA
diff --git a/widgets/CMakeLists.txt b/widgets/CMakeLists.txt
index a9e1269..4c1d0d4 100644
--- a/widgets/CMakeLists.txt
+++ b/widgets/CMakeLists.txt
@@ -2,6 +2,7 @@ include(GenerateExportHeader)
if(MSVC)
add_definitions(-DMGL_LIB_MSVC)
+ add_definitions(-DMGL_WIDGETS_DLL)
endif(MSVC)
if(MGL_HAVE_FLTK)

85
externals/vcpkg/ports/mathgl/portfile.cmake vendored Executable file
View File

@@ -0,0 +1,85 @@
set(MATHGL_VERSION "2.5")
vcpkg_from_sourceforge(
OUT_SOURCE_PATH SOURCE_PATH
REPO mathgl/mathgl
REF mathgl%20${MATHGL_VERSION}
FILENAME "mathgl-${MATHGL_VERSION}.tar.gz"
SHA512 1fe27962ffef8d7127c4e1294d735e5da4dd2d647397f09705c3ca860f90bd06fd447ff614e584f3d2b874a02262c5518be37d59e9e0a838dd5b8b64fd77ef9d
PATCHES
fix_cmakelists_and_cpp.patch
fix_attribute.patch
fix_default_graph_init.patch
fix_mglDataList.patch
fix_arma_sprintf.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
hdf5 enable-hdf5
fltk enable-fltk
gif enable-gif
arma enable-arma
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_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}
)
vcpkg_cmake_install()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
vcpkg_cmake_config_fixup(CONFIG_PATH cmake)
file(REMOVE "${CURRENT_PACKAGES_DIR}/mathgl2-config.cmake")
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/mathgl2-config.cmake")
else()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/mathgl2)
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/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}")
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()
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")
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/mgl2/config.h" "#define MGL_INSTALL_DIR \"${CURRENT_PACKAGES_DIR}\"" "")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/mgl2/config.h" "#define MGL_FONT_PATH \"${CURRENT_PACKAGES_DIR}/fonts\"" "") # there is no fonts folder
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/mathgl" RENAME copyright)

95
externals/vcpkg/ports/mathgl/vcpkg.json vendored Executable file
View File

@@ -0,0 +1,95 @@
{
"name": "mathgl",
"version": "2.5",
"description": "MathGL is a free library of fast C++ routines for the plotting of the data varied in one or more dimensions",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"jpeg",
"opengl",
"png",
"zlib"
],
"features": {
"arma": {
"description": "Armadillo support",
"dependencies": [
"armadillo"
]
},
"fltk": {
"description": "fltk module",
"dependencies": [
"fltk"
]
},
"gif": {
"description": "gif module",
"dependencies": [
"giflib"
]
},
"glut": {
"description": "glut module",
"dependencies": [
"freeglut"
]
},
"gsl": {
"description": "gsl module",
"dependencies": [
"gsl"
]
},
"hdf5": {
"description": "hdf5 module",
"dependencies": [
"hdf5"
]
},
"jpeg": {
"description": "jpeg module",
"dependencies": [
"libjpeg-turbo"
]
},
"opengl": {
"description": "opengl module",
"dependencies": [
"opengl"
]
},
"png": {
"description": "png module",
"dependencies": [
"libpng"
]
},
"qt5": {
"description": "qt5 module",
"dependencies": [
"qt5"
]
},
"wx": {
"description": "wx module",
"dependencies": [
"wxwidgets"
]
},
"zlib": {
"description": "zlib module",
"dependencies": [
"zlib"
]
}
}
}