Update source from mathgl_2.4.4.orig.tar.gz in the archive
authorDimitrios Eftaxiopoulos <eftaxi12@otenet.gr>
Sat, 30 Nov 2019 20:16:32 +0000 (22:16 +0200)
committerDimitrios Eftaxiopoulos <eftaxi12@otenet.gr>
Sat, 30 Nov 2019 20:16:32 +0000 (22:16 +0200)
FindMathGL2.cmake [new file with mode: 0644]
MathGLConfig.cmake.in [new file with mode: 0644]
MathGLConfigVersion.cmake.in [new file with mode: 0644]
cmake-qt4.txt [new file with mode: 0644]
cmake-qt5.txt [new file with mode: 0644]
win32-install-deps/CMakeLists.txt [new file with mode: 0644]
win32-install-deps/install-deps.txt [new file with mode: 0644]

diff --git a/FindMathGL2.cmake b/FindMathGL2.cmake
new file mode 100644 (file)
index 0000000..2003379
--- /dev/null
@@ -0,0 +1,148 @@
+# - FindMathGL2.cmake
+# This module can be used to find MathGL v.2.* and several of its optional components.
+#
+# You can specify one or more component as you call this find module.
+# Possible components are: FLTK, GLUT, Qt, WX.
+#
+# The following variables will be defined for your use:
+#
+#  MATHGL2_FOUND           = MathGL v.2 and all specified components found
+#  MATHGL2_INCLUDE_DIRS    = The MathGL v.2 include directories
+#  MATHGL2_LIBRARIES       = The libraries to link against to use MathGL v.2
+#                           and all specified components
+#  MATHGL2_VERSION_STRING  = A human-readable version of the MathGL v.2 (e.g. 2.1)
+#  MATHGL2_XXX_FOUND       = Component XXX found (replace XXX with uppercased
+#                           component name -- for example, QT or FLTK)
+#
+# The minimum required version and needed components can be specified using
+# the standard find_package()-syntax, here are some examples:
+#  find_package(MathGL2 REQUIRED)                              - v.2.* (no interfaces), required
+#  find_package(MathGL2 REQUIRED Qt)           - v.2.1 + Qt interface, required
+#  find_package(MathGL2 2.1 REQUIRED)                  - v.2.1 (no interfaces), required
+#  find_package(MathGL2 COMPONENTS Qt WX)      - v.2.0 + Qt and WX interfaces, optional
+#
+# Note, some cmake builds require to write "COMPONENTS" always, like
+#  find_package(MathGL2 REQUIRED COMPONENTS Qt)        - v.2.* + Qt interface, required
+#
+# Typical usage could be something like this:
+#   find_package(MathGL REQUIRED FLTK)
+#   include_directories(${MATHGL2_INCLUDE_DIRS})
+#   add_executable(myexe main.cpp)
+#   target_link_libraries(myexe ${MATHGL2_LIBRARIES} ${MATHGL2_FLTK_LIBRARIES})
+#
+
+#=============================================================================
+# Copyright (c) 2011 Denis Pesotsky <denis@kde.ru>, 2014 Alexey Balakin <mathgl.abalakin@gmail.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file COPYING-CMAKE-MODULES for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+FIND_PATH(MATHGL2_INCLUDE_DIR
+               NAMES mgl2/mgl.h
+               DOC "The MathGL2 v.2.* include directory")
+FIND_LIBRARY(MATHGL2_LIBRARY
+               NAMES mgl
+               PATHS ${MATHGL2_LIBRARY_DIR}
+               DOC "The MathGL v.2.* include directory")
+
+GET_FILENAME_COMPONENT(MATHGL2_LIBRARY_DIR ${MATHGL2_LIBRARY} PATH)
+
+SET(MATHGL2_LIBRARIES ${MATHGL2_LIBRARY})
+SET(MATHGL2_INCLUDE_DIRS ${MATHGL2_INCLUDE_DIR})
+
+IF(MATHGL2_INCLUDE_DIR)
+       SET(_CONFIG_FILE_PATH "${MATHGL2_INCLUDE_DIR}/mgl2/define.h")
+       SET(_VERSION_ERR "Cannot determine MathGL v.2.* version")
+       IF(EXISTS "${_CONFIG_FILE_PATH}")
+               FILE(STRINGS "${_CONFIG_FILE_PATH}"
+                       MATHGL2_VERSION_STRING REGEX "^#define MGL_VER2.*$")
+               IF(MATHGL2_VERSION_STRING)
+                       STRING(REGEX
+                               REPLACE "#define MGL_VER2" ""
+                               MATHGL2_VERSION_STRING ${MATHGL2_VERSION_STRING})
+                       STRING(REGEX
+                               REPLACE "//.*" ""
+                               MATHGL2_VERSION_STRING ${MATHGL2_VERSION_STRING})
+                       STRING(STRIP ${MATHGL2_VERSION_STRING} MATHGL2_VERSION_STRING)
+                       SET(MATHGL2_VERSION_STRING 2.${MATHGL2_VERSION_STRING})
+#                      MESSAGE(STATUS "Find MathGL version -- ${MATHGL2_VERSION_STRING}")
+               ELSE()
+                       SET(_ERR_MESSAGE "${_VERSION_ERR}: ${_CONFIG_FILE_PATH} parse error")
+               ENDIF()
+       ELSE()
+               SET(_ERR_MESSAGE "${_VERSION_ERR}: ${_CONFIG_FILE_PATH} not found")
+       ENDIF()
+       IF(_ERR_MESSAGE)
+               UNSET(_ERR_MESSAGE)
+               SET(_CONFIG_FILE_PATH "${MATHGL2_INCLUDE_DIR}/mgl2/config.h")
+               SET(_VERSION_ERR "Cannot determine MathGL v.2.* version")
+               IF(EXISTS "${_CONFIG_FILE_PATH}")
+                       FILE(STRINGS "${_CONFIG_FILE_PATH}"
+                               MATHGL2_VERSION_STRING REGEX "^#define MGL_VER2.*$")
+                       IF(MATHGL2_VERSION_STRING)
+                               STRING(REGEX
+                                       REPLACE "#define MGL_VER2" ""
+                                       MATHGL2_VERSION_STRING ${MATHGL2_VERSION_STRING})
+                               STRING(REGEX
+                                       REPLACE "//.*" ""
+                                       MATHGL2_VERSION_STRING ${MATHGL2_VERSION_STRING})
+                               STRING(STRIP ${MATHGL2_VERSION_STRING} MATHGL2_VERSION_STRING)
+                               SET(MATHGL2_VERSION_STRING 2.${MATHGL2_VERSION_STRING})
+       #                       MESSAGE(STATUS "Find MathGL version -- ${MATHGL2_VERSION_STRING}")
+                       ELSE()
+                               SET(_ERR_MESSAGE "${_VERSION_ERR}: ${_CONFIG_FILE_PATH} parse error")
+                       ENDIF()
+               ELSE()
+                       SET(_ERR_MESSAGE "${_VERSION_ERR}: ${_CONFIG_FILE_PATH} not found")
+               ENDIF()
+       ENDIF(_ERR_MESSAGE)
+
+       if(_ERR_MESSAGE)
+               MESSAGE(FATAL_ERROR ${_ERR_MESSAGE})
+       endif(_ERR_MESSAGE)
+ENDIF()
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(MathGL2
+               REQUIRED_VARS MATHGL2_LIBRARY MATHGL2_INCLUDE_DIR
+               VERSION_VAR MATHGL2_VERSION_STRING)
+
+FOREACH(_Component ${MathGL2_FIND_COMPONENTS})
+       STRING(TOLOWER ${_Component} _component)
+       STRING(TOUPPER ${_Component} _COMPONENT)
+
+       SET(MATHGL2_${_Component}_FIND_REQUIRED ${MATHGL2_FIND_REQUIRED})
+       SET(MATHGL2_${_Component}_FIND_QUIETLY true)
+       if(${_component} STREQUAL "qt4" OR ${_component} STREQUAL "qt5")
+               FIND_PATH(MATHGL2_${_COMPONENT}_INCLUDE_DIR
+                                       NAMES mgl2/qt.h
+                                       PATHS ${MATHGL2_INCLUDE_DIR} NO_DEFAULT_PATH)
+       else(${_component} STREQUAL "qt4" OR ${_component} STREQUAL "qt5")
+               FIND_PATH(MATHGL2_${_COMPONENT}_INCLUDE_DIR
+                               NAMES mgl2/${_component}.h
+                               PATHS ${MATHGL2_INCLUDE_DIR} NO_DEFAULT_PATH)
+       endif(${_component} STREQUAL "qt4" OR ${_component} STREQUAL "qt5")
+       FIND_LIBRARY(MATHGL2_${_COMPONENT}_LIBRARY
+                               NAMES mgl-${_component}
+                               PATHS ${MATHGL2_LIBRARY_DIR} NO_DEFAULT_PATH)
+
+       FIND_PACKAGE_HANDLE_STANDARD_ARGS(MATHGL2_${_Component} DEFAULT_MSG
+                                                                               MATHGL2_${_COMPONENT}_LIBRARY
+                                                                               MATHGL2_${_COMPONENT}_INCLUDE_DIR)
+
+       IF(MATHGL2_${_COMPONENT}_FOUND)
+               SET(MATHGL2_LIBRARIES
+                       ${MATHGL2_LIBRARIES} ${MATHGL2_${_COMPONENT}_LIBRARY})
+               SET(MATHGL2_INCLUDE_DIRS
+                       ${MATHGL2_INCLUDE_DIRS} ${MATHGL2_${_COMPONENT}_INCLUDE_DIR})
+       ENDIF()
+
+       MARK_AS_ADVANCED(MATHGL2_${_COMPONENT}_INCLUDE_DIR MATHGL2_${_COMPONENT}_LIBRARY)
+ENDFOREACH()
+
+MARK_AS_ADVANCED(MATHGL2_INCLUDE_DIR MATHGL2_LIBRARY MATHGL2_VERSION_STRING)
diff --git a/MathGLConfig.cmake.in b/MathGLConfig.cmake.in
new file mode 100644 (file)
index 0000000..1231020
--- /dev/null
@@ -0,0 +1,18 @@
+# - Config file for the MathGL package
+# It defines the following variables
+set(MathGL_INCLUDE_DIRS "@MathGL_INSTALL_INCLUDE_DIR@")
+set(MathGL_LIBRARIES_DIRS "@MathGL_INSTALL_LIB_DIR@")
+set(MathGL_HAVE_QT5 "@enable-qt5@")
+set(MathGL_HAVE_QT4 "@enable-qt4@")
+set(MathGL_HAVE_WX "@enable-wx@")
+set(MathGL_HAVE_FLTK "@enable-fltk@")
+set(MathGL_HAVE_GLUT "@enable-glut@")
+
+# Compute paths
+get_filename_component(MathGL_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+# Our library dependencies (contains definitions for IMPORTED targets)
+if(NOT TARGET mgl AND NOT MathGL_BINARY_DIR)
+  include("${MathGL_CMAKE_DIR}/MathGLTargets.cmake")
+endif()
diff --git a/MathGLConfigVersion.cmake.in b/MathGLConfigVersion.cmake.in
new file mode 100644 (file)
index 0000000..ef66b05
--- /dev/null
@@ -0,0 +1,11 @@
+set(PACKAGE_VERSION "@MathGL_VERSION@")
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+  set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+  set(PACKAGE_VERSION_COMPATIBLE TRUE)
+  if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+    set(PACKAGE_VERSION_EXACT TRUE)
+  endif()
+endif()
diff --git a/cmake-qt4.txt b/cmake-qt4.txt
new file mode 100644 (file)
index 0000000..c38c7da
--- /dev/null
@@ -0,0 +1,14 @@
+set(MGL_HAVE_QT4 1)
+set(MGL_QT4_LIBS_FIND QtCore QtGui QtOpenGL)
+set(MGL_QT4_LIBS_FIND_JSON QtNetwork QtWebKit)
+
+FIND_PACKAGE(Qt4 4.8 REQUIRED ${MGL_QT4_LIBS_FIND})
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(MGL_QT4_LIBS)
+foreach(mgl_qt4_lib ${MGL_QT4_LIBS_FIND})
+       set(MGL_QT4_LIBS ${MGL_QT4_LIBS} Qt4::${mgl_qt4_lib})
+endforeach(mgl_qt4_lib)
diff --git a/cmake-qt5.txt b/cmake-qt5.txt
new file mode 100644 (file)
index 0000000..ceec34a
--- /dev/null
@@ -0,0 +1,22 @@
+set(MGL_HAVE_QT5 1)
+
+macro(find_qt5_libs qt5_lib_req qt5_lib_add)
+       foreach(mgl_qt5_lib ${ARGN})
+               find_package(Qt5${mgl_qt5_lib} QUIET)
+               if(NOT Qt5${mgl_qt5_lib}_FOUND)
+                       if(${qt5_lib_req})
+                               message(SEND_ERROR "Couldn't find Qt5 ${mgl_qt5_lib} library.")
+                       endif(${qt5_lib_req})
+               else(NOT Qt5${mgl_qt5_lib}_FOUND)
+                       if(${qt5_lib_add})
+                               set(MGL_QT5_LIBS ${MGL_QT5_LIBS} Qt5::${mgl_qt5_lib})
+                       endif(${qt5_lib_add})
+               endif(NOT Qt5${mgl_qt5_lib}_FOUND)
+       endforeach(mgl_qt5_lib)
+endmacro(find_qt5_libs qt5_lib_req)
+
+find_qt5_libs(ON ON Core Gui Widgets PrintSupport OpenGL)
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOUIC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
diff --git a/win32-install-deps/CMakeLists.txt b/win32-install-deps/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2824d13
--- /dev/null
@@ -0,0 +1,10 @@
+if(enable-qt5)
+       find_package(Qt5Gui QUIET)
+       if(Qt5Gui_FOUND)
+               get_target_property(mgl_qt_loc Qt5::QWindowsIntegrationPlugin LOCATION)
+       endif(Qt5Gui_FOUND)
+endif(enable-qt5)
+
+install(CODE "SET(mgl_qt_loc \"${mgl_qt_loc}\")")
+install(CODE "SET(CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")")
+install(SCRIPT install-deps.txt)
diff --git a/win32-install-deps/install-deps.txt b/win32-install-deps/install-deps.txt
new file mode 100644 (file)
index 0000000..9bab2f7
--- /dev/null
@@ -0,0 +1,36 @@
+include(GetPrerequisites)
+
+message("\nInstalling depended libraries to ${CMAKE_INSTALL_PREFIX}/bin:\n")
+
+file(GLOB_RECURSE exe_list "${CMAKE_INSTALL_PREFIX}/*.exe")
+file(GLOB_RECURSE dll_list "${CMAKE_INSTALL_PREFIX}/*.dll")
+
+if(NOT (exe_list OR dll_list))
+       message("Exe and dll files not found, cannot generate dependency list")
+       return()
+endif(NOT (exe_list OR dll_list))
+
+set(mgl_all_dep)
+foreach(exe_file ${exe_list} ${dll_list})
+       get_prerequisites(${exe_file} DEPENDENCIES 1 1 "" "${CMAKE_INSTALL_PREFIX}/bin")
+       foreach(DEPENDENCY_FILE ${DEPENDENCIES})
+               gp_resolve_item("${exe_file}" "${DEPENDENCY_FILE}" "" "${CMAKE_INSTALL_PREFIX}/bin" resolved_file)
+               if(NOT resolved_file MATCHES ".*libmgl.*")
+                       list(APPEND mgl_all_dep ${resolved_file})
+               endif(NOT resolved_file MATCHES ".*libmgl.*")
+       endforeach(DEPENDENCY_FILE ${DEPENDENCIES})
+endforeach(exe_file ${exe_list})
+
+list(REMOVE_DUPLICATES mgl_all_dep)
+list(SORT mgl_all_dep)
+
+foreach(dll_file ${mgl_all_dep})
+       message("Installing: ${dll_file}")
+endforeach(dll_file ${mgl_all_dep})
+
+file(COPY ${mgl_all_dep} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
+
+if(mgl_qt_loc)
+       message("Installing: ${mgl_qt_loc}")
+       file(COPY ${mgl_qt_loc} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin/plugins/platforms")
+endif(mgl_qt_loc)