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!1128
  • Loading branch information
jheinen committed Sep 19, 2023
2 parents 623b909 + 5e94bd8 commit ffedfe7
Show file tree
Hide file tree
Showing 131 changed files with 31,752 additions and 7,926 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -31,3 +31,6 @@ lib/gks/qt/gksqt
moc_*.cpp
moc_*.h
qrc_*.cpp
clion-build/
lib/grm/test/public_api/grm/snoop/diff_images/
lib/grm/test/public_api/grm/snoop/snoop.jl
235 changes: 218 additions & 17 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 3rdparty/Makefile
@@ -1,5 +1,5 @@
TARGETS = freetype jpeg libpng16 zlib qhull bzip2
EXTRAS = agg tiff ogg theora vpx openh264 ffmpeg glfw zeromq pixman cairo
EXTRAS = agg tiff ogg theora vpx openh264 ffmpeg glfw zeromq pixman cairo libxml2
DIR =

default:
Expand Down
59 changes: 59 additions & 0 deletions 3rdparty/expat/Makefile
@@ -0,0 +1,59 @@
ifeq ($(strip $(PREFIX)),)
override PREFIX = $(abspath $(CURDIR)/../build)
endif

VERSION = 2.4.8
EXPAT_EXTRA_CONFIGURE_FLAGS ?=
ifeq ($(shell uname),Darwin)
EXPAT_EXTRA_CONFIGURE_FLAGS += CFLAGS=-mmacosx-version-min=10.14
endif

ifeq ($(DOWNLOAD_CMD),)
ifneq ($(shell curl --version 2>/dev/null),)
DOWNLOAD_CMD := curl -f -k -OL
endif
endif
ifeq ($(DOWNLOAD_CMD),)
ifneq ($(shell wget --version 2>/dev/null),)
DOWNLOAD_CMD := wget --no-check-certificate
endif
endif
ifeq ($(DOWNLOAD_CMD),)
DOWNLOAD_CMD := echo "Error: Unable to find curl or wget."; exit 1; \#
endif

default: install

$(PREFIX)/src/expat-$(VERSION).tar.xz:
mkdir -p $(PREFIX)/src
cd $(PREFIX)/src/ && $(DOWNLOAD_CMD) https://gr-framework.org/downloads/3rdparty/expat-$(VERSION).tar.xz

$(PREFIX)/src/expat-$(VERSION)/configure: $(PREFIX)/src/expat-$(VERSION).tar.xz
cd $(PREFIX)/src/ && tar -xf expat-$(VERSION).tar.xz
touch $@

$(PREFIX)/src/expat-$(VERSION)/Makefile: $(PREFIX)/src/expat-$(VERSION)/configure
cd $(PREFIX)/src/expat-$(VERSION) && \
./configure \
--prefix=$(PREFIX) \
--libdir=$(PREFIX)/lib \
--enable-static \
--disable-shared \
--with-pic \
$(EXPAT_EXTRA_CONFIGURE_FLAGS)
# configure doesn't update the Makefile mtime correctly
touch $@

$(PREFIX)/lib/libexpat.a: $(PREFIX)/src/expat-$(VERSION)/Makefile
$(MAKE) -C $(PREFIX)/src/expat-$(VERSION) -j4 && \
$(MAKE) -C $(PREFIX)/src/expat-$(VERSION) install

libexpat.a: $(PREFIX)/lib/libexpat.a
cp $(PREFIX)/lib/libexpat.a libexpat.a

clean:
rm -f libexpat.a

install: $(PREFIX)/lib/libexpat.a

.PHONY: default clean install
61 changes: 61 additions & 0 deletions 3rdparty/libxml2/Makefile
@@ -0,0 +1,61 @@
ifeq ($(strip $(PREFIX)),)
override PREFIX = $(abspath $(CURDIR)/../build)
endif

VERSION = 2.10.4
LIBXML2_EXTRA_CONFIGURE_FLAGS ?=
ifeq ($(shell uname),Darwin)
LIBXML2_EXTRA_CONFIGURE_FLAGS += CFLAGS=-mmacosx-version-min=10.14
endif

ifeq ($(DOWNLOAD_CMD),)
ifneq ($(shell curl --version 2>/dev/null),)
DOWNLOAD_CMD := curl -f -k -OL
endif
endif
ifeq ($(DOWNLOAD_CMD),)
ifneq ($(shell wget --version 2>/dev/null),)
DOWNLOAD_CMD := wget --no-check-certificate
endif
endif
ifeq ($(DOWNLOAD_CMD),)
DOWNLOAD_CMD := echo "Error: Unable to find curl or wget."; exit 1; \#
endif

default: install

$(PREFIX)/src/libxml2-$(VERSION).tar.xz:
mkdir -p $(PREFIX)/src
cd $(PREFIX)/src/ && $(DOWNLOAD_CMD) https://gr-framework.org/downloads/3rdparty/libxml2-$(VERSION).tar.xz

$(PREFIX)/src/libxml2-$(VERSION)/configure: $(PREFIX)/src/libxml2-$(VERSION).tar.xz
cd $(PREFIX)/src/ && tar -xf libxml2-$(VERSION).tar.xz
touch $@

$(PREFIX)/src/libxml2-$(VERSION)/Makefile: $(PREFIX)/src/libxml2-$(VERSION)/configure
cd $(PREFIX)/src/libxml2-$(VERSION) && \
./configure \
--prefix=$(PREFIX) \
--libdir=$(PREFIX)/lib \
--enable-static \
--disable-shared \
--with-pic \
--with-zlib=$(PREFIX) \
--without-python \
$(LIBXML2_EXTRA_CONFIGURE_FLAGS)
# configure doesn't update the Makefile mtime correctly
touch $@

$(PREFIX)/lib/libxml2.a: $(PREFIX)/src/libxml2-$(VERSION)/Makefile
$(MAKE) -C $(PREFIX)/src/libxml2-$(VERSION) -j4 && \
$(MAKE) -C $(PREFIX)/src/libxml2-$(VERSION) install

libxml2.a: $(PREFIX)/lib/libxml2.a
cp $(PREFIX)/lib/libxml2.a libxml2.a

clean:
rm -f libxml2.a

install: $(PREFIX)/lib/libxml2.a

.PHONY: default clean install
127 changes: 121 additions & 6 deletions CMakeLists.txt
Expand Up @@ -92,10 +92,31 @@ find_package(Agg)
find_package(Fontconfig)
find_package(OpenGL OPTIONAL_COMPONENTS OpenGL)
find_package(Gs)
find_package(Expat)
# CMake ships with a `FindLibXml2.cmake` module which does not configure needed libxml2 dependencies.
# Thus, use the `libxml2-config.cmake` config file shipped with libxml which configures dependencies correctly by
# skipping module search mode.
find_package(LibXml2 NO_MODULE)
if(${CMAKE_VERSION} VERSION_GREATER "3.16.0")
find_package(Qt6 OPTIONAL_COMPONENTS Widgets Core Network)
find_package(
Qt6
OPTIONAL_COMPONENTS
Widgets
Core
Network
Gui
PrintSupport
)
endif()
find_package(Qt5 OPTIONAL_COMPONENTS Widgets Core Network)
find_package(
Qt5
OPTIONAL_COMPONENTS
Widgets
Core
Network
Gui
PrintSupport
)
find_package(Qt4)

if(APPLE)
Expand Down Expand Up @@ -470,8 +491,11 @@ set(GRM_SOURCES
lib/grm/src/grm/dynamic_args_array.c
lib/grm/src/grm/error.c
lib/grm/src/grm/event.c
lib/grm/src/grm/interaction.c
lib/grm/src/grm/interaction.cxx
lib/grm/src/grm/json.c
lib/grm/src/grm/layout_c.cxx
lib/grm/src/grm/layout.cxx
lib/grm/src/grm/layout_error.cxx
lib/grm/src/grm/logging.c
lib/grm/src/grm/memwriter.c
lib/grm/src/grm/net.c
Expand All @@ -484,6 +508,18 @@ set(GRM_SOURCES
lib/grm/src/grm/datatype/string_list.c
lib/grm/src/grm/datatype/string_map.c
lib/grm/src/grm/datatype/uint_map.c
lib/grm/src/grm/dom_render/context.cxx
lib/grm/src/grm/dom_render/render.cxx
lib/grm/src/grm/dom_render/Drawable.cxx
lib/grm/src/grm/dom_render/graphics_tree/Comment.cxx
lib/grm/src/grm/dom_render/graphics_tree/Document.cxx
lib/grm/src/grm/dom_render/graphics_tree/Element.cxx
lib/grm/src/grm/dom_render/graphics_tree/Node.cxx
lib/grm/src/grm/dom_render/graphics_tree/Value.cxx
lib/grm/src/grm/dom_render/graphics_tree/util.cxx
lib/grm/src/grm/dom_render/ManageCustomColorIndex.cxx
lib/grm/src/grm/dom_render/ManageGRContextIds.cxx
lib/grm/src/grm/dom_render/ManageZIndex.cxx
)

add_library(grm_static STATIC ${GRM_SOURCES})
Expand All @@ -502,6 +538,17 @@ foreach(LIBRARY grm_static grm_shared grm_shared_internal)
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} GR::GKS)
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} GR::GR)
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} GR::GR3)
if(TARGET LibXml2::LibXml2)
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} LibXml2::LibXml2)
elseif(EXPAT_FOUND)
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} Expat::Expat)
endif()
if(NOT TARGET LibXml2::LibXml2)
target_compile_definitions(${LIBRARY} PRIVATE NO_LIBXML2)
endif()
if(NOT EXPAT_FOUND OR TARGET LibXml2::LibXml2)
target_compile_definitions(${LIBRARY} PRIVATE NO_EXPAT)
endif()
if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
target_link_libraries(${LIBRARY} ${GRM_LINK_MODE} m)
endif()
Expand All @@ -513,6 +560,8 @@ foreach(LIBRARY grm_static grm_shared grm_shared_internal)
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/include/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/src/> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_compile_definitions(${LIBRARY} PRIVATE BUILDING_GR)
target_compile_definitions(${LIBRARY} PRIVATE GRDIR="${GR_DIRECTORY}")
target_compile_options(${LIBRARY} PRIVATE ${COMPILER_OPTION_ERROR_IMPLICIT})
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(${LIBRARY} PRIVATE /permissive-)
Expand Down Expand Up @@ -1114,9 +1163,21 @@ 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))
if((Qt6Widgets_FOUND
AND Qt6Core_FOUND
AND Qt6Gui_FOUND
)
OR (Qt5Widgets_FOUND
AND Qt5Core_FOUND
AND Qt5Gui_FOUND
)
)
add_executable(
grplot WIN32 MACOSX_BUNDLE
lib/grm/grplot/gredit/Bounding_logic.cpp
lib/grm/grplot/gredit/Bounding_object.cpp
lib/grm/grplot/gredit/CustomTreeWidgetItem.cpp
lib/grm/grplot/gredit/TreeWidget.cpp
lib/grm/grplot/grplot.cxx
lib/grm/grplot/grplot_mainwindow.cxx
lib/grm/grplot/grplot_widget.cxx
Expand All @@ -1125,10 +1186,10 @@ if((Qt6Widgets_FOUND AND Qt6Core_FOUND) OR (Qt5Widgets_FOUND AND Qt5Core_FOUND))
lib/grm/grplot/util.cxx
)
if(Qt6Widgets_FOUND AND Qt6Core_FOUND)
target_link_libraries(grplot PRIVATE Qt6::Widgets Qt6::Core grm_static)
target_link_libraries(grplot PRIVATE Qt6::Widgets Qt6::Core Qt6::Gui grm_static)
set(grplot_INSTALL_RPATH "${INSTALL_RPATH};${Qt6_LIBRARY_DIR}")
else()
target_link_libraries(grplot PRIVATE Qt5::Widgets Qt5::Core grm_static)
target_link_libraries(grplot PRIVATE Qt5::Widgets Qt5::Core Qt5::Gui grm_static)
set(grplot_INSTALL_RPATH "${INSTALL_RPATH};${Qt5_LIBRARY_DIR}")
endif()
target_compile_definitions(grplot PRIVATE GRDIR="${GR_DIRECTORY}")
Expand Down Expand Up @@ -1182,10 +1243,46 @@ if((Qt6Widgets_FOUND AND Qt6Core_FOUND) OR (Qt5Widgets_FOUND AND Qt5Core_FOUND))
${CMAKE_CURRENT_BINARY_DIR}/moc_receiver_thread.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/qtterm/receiver_thread.h
)

add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_Bounding_logic.cpp
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/Bounding_logic.h -o
${CMAKE_CURRENT_BINARY_DIR}/moc_Bounding_logic.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/Bounding_logic.h
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_Bounding_object.cpp
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/Bounding_object.h -o
${CMAKE_CURRENT_BINARY_DIR}/moc_Bounding_object.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/Bounding_object.h
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_CustomTreeWidgetItem.cpp
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/CustomTreeWidgetItem.h -o
${CMAKE_CURRENT_BINARY_DIR}/moc_CustomTreeWidgetItem.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/CustomTreeWidgetItem.h
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/moc_TreeWidget.cpp
COMMAND
${QT_MOC_EXECUTABLE} -DGRDIR=\"$(GR_DIRECTORY)\" ${MOC_INCLUDE_FLAGS}
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/TreeWidget.h -o ${CMAKE_CURRENT_BINARY_DIR}/moc_TreeWidget.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/TreeWidget.h
)
target_sources(
grplot
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/moc_grplot_mainwindow.cxx
${CMAKE_CURRENT_BINARY_DIR}/moc_grplot_widget.cxx
${CMAKE_CURRENT_BINARY_DIR}/moc_Bounding_logic.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_Bounding_object.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_CustomTreeWidgetItem.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_TreeWidget.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_grm_args_t_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/moc_receiver_thread.cpp
)
Expand All @@ -1195,6 +1292,10 @@ if((Qt6Widgets_FOUND AND Qt6Core_FOUND) OR (Qt5Widgets_FOUND AND Qt5Core_FOUND))
grplot
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/grplot_mainwindow.hxx
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/grplot_widget.hxx
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/Bounding_logic.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/Bounding_object.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/CustomTreeWidgetItem.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/gredit/TreeWidget.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/qtterm/grm_args_t_wrapper.h
${CMAKE_CURRENT_SOURCE_DIR}/lib/grm/grplot/qtterm/receiver_thread.h
)
Expand All @@ -1213,6 +1314,15 @@ else()
string(APPEND GR_REPORT "- grplot: No (Qt6 and Qt5 not found)\n")
endif()

string(APPEND GR_REPORT "\nGRM integrations:\n")
if(TARGET LibXml2::LibXml2)
string(APPEND GR_REPORT "- libxml2: Yes\n- Expat: No\n")
elseif(EXPAT_FOUND)
string(APPEND GR_REPORT "- libxml2: No\n- Expat: Yes\n")
else()
string(APPEND GR_REPORT "- libxml2: No\n- Expat: No\n")
endif()

if(GR_BUILD_DEMOS)
add_executable(gksdemo lib/gks/demo.c)
target_link_libraries(gksdemo PUBLIC gks_static)
Expand All @@ -1231,6 +1341,11 @@ endif()

if(GR_INSTALL)
install(FILES LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR}/)
install(
FILES lib/grm/src/grm/dom_render/graphics_tree/schema.xsd
DESTINATION ${CMAKE_INSTALL_DATADIR}/xml/GRM
RENAME grm_graphics_tree_schema.xsd
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
"cmake/Config.cmake.in" "GRConfig.cmake" INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/GR"
Expand Down

0 comments on commit ffedfe7

Please sign in to comment.