Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
merge develop into master

See merge request Scientific-IT-Systems/gr!952
  • Loading branch information
jheinen committed Nov 23, 2022
2 parents 2ffade8 + 98609cb commit 129ec06
Show file tree
Hide file tree
Showing 32 changed files with 2,914 additions and 151 deletions.
113 changes: 74 additions & 39 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

96 changes: 95 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ if(Qt4_FOUND)
foreach(DIR IN LISTS QT_INCLUDE_DIR)
set(QT4_MOC_INCLUDE_FLAGS ${QT4_MOC_INCLUDE_FLAGS} -I${DIR})
endforeach()
if(NOT DEFINED Qt4_LIBRARY_DIR)
get_filename_component(Qt4_LIBRARY_DIR "${QT_LIBRARY_DIR}/../.." ABSOLUTE)
endif()
endif()
if(Qt5Widgets_FOUND
AND Qt5Core_FOUND
Expand All @@ -143,6 +146,9 @@ if(Qt5Widgets_FOUND
foreach(DIR IN LISTS Qt5Core_INCLUDE_DIRS Qt5Gui_INCLUDE_DIRS Qt5Widgets_INCLUDE_DIRS)
set(QT5_MOC_INCLUDE_FLAGS ${QT5_MOC_INCLUDE_FLAGS} -I${DIR})
endforeach()
if(NOT DEFINED Qt5_LIBRARY_DIR)
get_filename_component(Qt5_LIBRARY_DIR "${Qt5_DIR}/../.." ABSOLUTE)
endif()
endif()
if(Qt6Widgets_FOUND
AND Qt6Core_FOUND
Expand All @@ -152,6 +158,9 @@ if(Qt6Widgets_FOUND
foreach(DIR IN LISTS Qt6Core_INCLUDE_DIRS Qt6Gui_INCLUDE_DIRS Qt6Widgets_INCLUDE_DIRS)
set(QT6_MOC_INCLUDE_FLAGS ${QT6_MOC_INCLUDE_FLAGS} -I${DIR})
endforeach()
if(NOT DEFINED Qt6_LIBRARY_DIR)
get_filename_component(Qt6_LIBRARY_DIR "${Qt6_DIR}/../.." ABSOLUTE)
endif()
endif()

if(X11_FOUND)
Expand Down Expand Up @@ -468,6 +477,8 @@ set(GRM_SOURCES
lib/grm/src/grm/net.c
lib/grm/src/grm/plot.cxx
lib/grm/src/grm/util.c
lib/grm/src/grm/import.cxx
lib/grm/src/grm/utilcpp.cxx
lib/grm/src/grm/datatype/double_map.c
lib/grm/src/grm/datatype/string_array_map.c
lib/grm/src/grm/datatype/string_list.c
Expand Down Expand Up @@ -1001,22 +1012,27 @@ if(Qt4_FOUND
)
)
add_executable(gksqt WIN32 MACOSX_BUNDLE lib/gks/qt/gksqt.cxx lib/gks/qt/gksserver.cxx lib/gks/qt/gkswidget.cxx)
set_target_properties(gksqt PROPERTIES CXX_STANDARD 11 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON)
target_link_libraries(gksqt PUBLIC gks_static)
if(Qt6Widgets_FOUND
AND Qt6Core_FOUND
AND Qt6Network_FOUND
)
target_link_libraries(gksqt PUBLIC Qt6::Widgets Qt6::Core Qt6::Network)
set(gksqt_INSTALL_RPATH "${INSTALL_RPATH};${Qt6_LIBRARY_DIR}")
elseif(
Qt5Widgets_FOUND
AND Qt5Core_FOUND
AND Qt5Network_FOUND
)
target_link_libraries(gksqt PUBLIC Qt5::Widgets Qt5::Core Qt5::Network)
set(gksqt_INSTALL_RPATH "${INSTALL_RPATH};${Qt5_LIBRARY_DIR}")
elseif(Qt4_FOUND)
target_link_libraries(gksqt PUBLIC Qt4::QtCore Qt4::QtGui Qt4::QtNetwork)
set(gksqt_INSTALL_RPATH "${INSTALL_RPATH};${Qt4_LIBRARY_DIR}")
endif()
set_target_properties(
gksqt PROPERTIES CXX_STANDARD 11 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON INSTALL_RPATH "${gksqt_INSTALL_RPATH}"
)
if(MINGW)
target_compile_options(gksqt PRIVATE -fno-exceptions ${COMPILER_OPTION_ERROR_IMPLICIT})
endif()
Expand Down Expand Up @@ -1084,6 +1100,70 @@ else()
string(APPEND GR_REPORT "- gksqt: No (Qt4 / Qt5 / Qt6 not found)\n")
endif()

if((Qt6Widgets_FOUND AND Qt6Core_FOUND) OR (Qt5Widgets_FOUND AND Qt5Core_FOUND))
add_executable(
grm-plots WIN32 MACOSX_BUNDLE lib/grm/grm-plots/grmplots.cxx lib/grm/grm-plots/grmplots_mainwindow.cxx
lib/grm/grm-plots/grmplots_widget.cxx
)
if(Qt6Widgets_FOUND AND Qt6Core_FOUND)
target_link_libraries(grm-plots PRIVATE Qt6::Widgets Qt6::Core grm_static)
set(grm-plots_INSTALL_RPATH "${INSTALL_RPATH};${Qt6_LIBRARY_DIR}")
else()
target_link_libraries(grm-plots PRIVATE Qt5::Widgets Qt5::Core grm_static)
set(grm-plots_INSTALL_RPATH "${INSTALL_RPATH};${Qt5_LIBRARY_DIR}")
endif()
set_target_properties(
grm-plots PROPERTIES CXX_STANDARD 17 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON INSTALL_RPATH
"${grm-plots_INSTALL_RPATH}"
)
if(GR_MANUAL_MOC_AND_RCC)
set_target_properties(grm-plots PROPERTIES AUTOMOC OFF AUTORCC OFF)
if(Qt6Widgets_FOUND AND Qt6Core_FOUND)
set(MOC_INCLUDE_FLAGS ${QT6_MOC_INCLUDE_FLAGS})
else()
set(MOC_INCLUDE_FLAGS ${QT5_MOC_INCLUDE_FLAGS})
endif()
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_grmplots_widget.cxx
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grm-plots/grmplots_widget.hxx -o
${CMAKE_CURRENT_BINARY_DIR}/moc_grmplots_widget.cxx
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grm-plots/grmplots_widget.hxx
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_grmplots_mainwindow.cxx
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grm-plots/grmplots_mainwindow.hxx -o
${CMAKE_CURRENT_BINARY_DIR}/moc_grmplots_mainwindow.cxx
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grm-plots/grmplots_mainwindow.hxx
)
target_sources(
grm-plots PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/moc_grmplots_mainwindow.cxx
${CMAKE_CURRENT_BINARY_DIR}/moc_grmplots_widget.cxx
)
else()
set_target_properties(grm-plots PROPERTIES AUTOMOC ON AUTORCC ON)
target_sources(
grm-plots PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grm-plots/grmplots_mainwindow.hxx
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grm-plots/grmplots_widget.hxx
)
endif()
if(APPLE)
set_target_properties(grm-plots PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "de.fz-juelich.grm-plots")
endif()
if(WIN32)
target_compile_definitions(grm-plots PRIVATE GR_STATIC_LIB)
endif()
if(MINGW)
target_compile_options(grm-plots PRIVATE -fno-exceptions ${COMPILER_OPTION_ERROR_IMPLICIT})
endif()
string(APPEND GR_REPORT "- grm-plots: Yes\n")
else()
string(APPEND GR_REPORT "- grm-plots: No (Qt6 or Qt5 not found)\n")
endif()

if(GR_BUILD_DEMOS)
add_executable(gksdemo lib/gks/demo.c)
target_link_libraries(gksdemo PUBLIC gks_static)
Expand Down Expand Up @@ -1229,6 +1309,20 @@ if(GR_INSTALL)
BUNDLE DESTINATION Applications
)
endif()
if(TARGET grm-plots)
install(
TARGETS grm-plots
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION Applications
)
if(APPLE)
install(
PROGRAMS lib/grm/grm-plots/grm-plots.macos.sh
DESTINATION ${CMAKE_INSTALL_BINDIR}
RENAME grm-plots
)
endif()
endif()
install(FILES lib/gr/gr.h lib/gks/gks.h lib/gr3/gr3.h lib/grm/include/grm.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/)
install(DIRECTORY lib/grm/include/grm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/)
if(TARGET qt4gr
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ osxpkg:
ln -s ../gr/bin/gr tmp/bin/gr
ln -s ../gr/Applications/glgr.app/Contents/MacOS/glgr tmp/bin/glgr
ln -s ../gr/Applications/gksqt.app/Contents/MacOS/gksqt tmp/bin/gksqt
@if [ -e ../gr/Applications/grm-plots.app/Contents/MacOS/grm-plots ]; then \
ln -s ../gr/Applications/grm-plots.app/Contents/MacOS/grm-plots tmp/bin/grm-plots; fi
sudo chown -R -h root:wheel tmp/
pkgbuild --identifier de.fz-juelich.gr --root tmp --install-location /usr/local --ownership preserve gr.pkg
sudo rm -rf tmp
Expand Down
21 changes: 19 additions & 2 deletions lib/gks/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
#include "gks.h"
#include "gkscore.h"

#if defined(_WIN32)
#define STRSAFE_NO_DEPRECATE
#define _CRT_NON_CONFORMING_WCSTOK
#define __STRSAFE__NO_INLINE
#include <windows.h>
#include <strsafe.h>
#endif

#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
Expand All @@ -25,17 +33,26 @@ int gks_open_font(void)
char fontdb[MAXPATHLEN];
int fd;

#ifndef _WIN32
path = gks_getenv("GKS_FONTPATH");
if (path == NULL)
{
path = gks_getenv("GRDIR");
if (path == NULL) path = GRDIR;
}
strcpy(fontdb, (char *)path);
#ifndef _WIN32
strcat(fontdb, "/fonts/gksfont.dat");
#else
strcat(fontdb, "\\FONTS\\GKSFONT.DAT");
wchar_t wfontdb[MAXPATHLEN];
if (!GetEnvironmentVariableW(L"GKS_FONTPATH", wfontdb, MAXPATHLEN))
{
if (!GetEnvironmentVariableW(L"GRDIR", wfontdb, MAXPATHLEN))
{
MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, GRDIR, -1, wfontdb, MAXPATHLEN);
}
}
StringCbCatW(wfontdb, MAXPATHLEN, L"\\FONTS\\GKSFONT.DAT");
WideCharToMultiByte(CP_UTF8, 0, wfontdb, wcslen(wfontdb) + 1, fontdb, MAXPATHLEN, NULL, NULL);
#endif
fd = gks_open_file(fontdb, "r");

Expand Down
Loading

0 comments on commit 129ec06

Please sign in to comment.