diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76b2cf35..967b6800 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,21 +16,29 @@ jobs: build: runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: os: - - ubuntu-latest + # - ubuntu-latest - windows-latest - macos-latest build_type: - Debug - Release config: - - qt_version: "5.15" - qt_arch: win64_mingw81 + # - qt_version: "5.15" + # qt_arch: win64_mingw81 - qt_version: "6.4.*" qt_modules: qtscxml qt_arch: win64_mingw + # include: + # - os: ubuntu-latest + # build_type: + # Debug + # config: + # qt_version: "6.6.*" + # qt_modules: qtscxml + # cmake_arg: "-DWITH_INTERNAL_GRAPHVIZ=ON" steps: - name: Install Dependencies on Linux @@ -47,7 +55,7 @@ jobs: if: ${{ runner.os == 'macOS' }} run: brew install graphviz - - name: Install Qt with options and default aqtversion (Linux/macOS) + - name: Install Qt ${{ matrix.config.qt_version }} with options and default aqtversion (Linux/macOS) if: ${{ runner.os != 'Windows' }} uses: jurplel/install-qt-action@v3 with: @@ -76,6 +84,8 @@ jobs: - name: Checkout sources uses: actions/checkout@v4 + with: + submodules: recursive - name: Fetch Git submodule run: git submodule update --init --recursive @@ -90,6 +100,7 @@ jobs: -DBUILD_TESTS=${{ matrix.build_type == 'Debug' }} -DBUILD_EXAMPLES=ON -DBUILD_DOCS=${{ matrix.build_type == 'Debug' && runner.os == 'Linux' }} + ${{ matrix.config.cmake_arg }} - name: Build Project run: cmake --build ./build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..a30d015b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,18 @@ +# +# This file is part of the KDAB State Machine Editor Library. +# +# SPDX-FileCopyrightText: 2015-2023 Klarälvdalens Datakonsult AB, a KDAB Group company +# Author: Kevin Funk +# +# SPDX-License-Identifier: LGPL-2.1-only OR LicenseRef-KDAB-KDStateMachineEditor +# +# Licensees holding valid commercial KDAB State Machine Editor Library +# licenses may use this file in accordance with the KDAB State Machine Editor +# Library License Agreement provided with the Software. +# +# Contact info@kdab.com if any conditions of this licensing are not clear to you. +# + +[submodule "3rdparty/graphviz"] + path = 3rdparty/graphviz + url = https://gitlab.com/graphviz/graphviz.git diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt new file mode 100644 index 00000000..2437afd7 --- /dev/null +++ b/3rdparty/CMakeLists.txt @@ -0,0 +1,27 @@ +# +# This file is part of the KDAB State Machine Editor Library. +# +# SPDX-FileCopyrightText: 2015-2023 Klarälvdalens Datakonsult AB, a KDAB Group company +# Author: Kevin Funk +# +# SPDX-License-Identifier: LGPL-2.1-only OR LicenseRef-KDAB-KDStateMachineEditor +# +# Licensees holding valid commercial KDAB State Machine Editor Library +# licenses may use this file in accordance with the KDAB State Machine Editor +# Library License Agreement provided with the Software. +# +# Contact info@kdab.com if any conditions of this licensing are not clear to you. +# + +if(WITH_INTERNAL_GRAPHVIZ) + # Function creates extra scope to keep these variables local + function(add_sonnet_subdirectory) + #TODO check if there are unneeded features to disable + + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/graphviz/CMakeLists.txt") + message(FATAL_ERROR "Please do git submodule update --init --recursive") + endif() + + add_subdirectory(graphviz) + endfunction() +endif() diff --git a/3rdparty/graphviz b/3rdparty/graphviz new file mode 160000 index 00000000..7c8fe980 --- /dev/null +++ b/3rdparty/graphviz @@ -0,0 +1 @@ +Subproject commit 7c8fe9803e18bd69f1e8637cdc893188350b4c04 diff --git a/CMakeLists.txt b/CMakeLists.txt index be66667b..4bc0f0b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,16 +51,6 @@ project( VERSION 1.99.50 ) -add_definitions( - -DQT_NO_CAST_TO_ASCII - -DQT_NO_CAST_FROM_ASCII - -DQT_STRICT_ITERATORS - -DQT_NO_URL_CAST_FROM_STRING - -DQT_NO_CAST_FROM_BYTEARRAY - -DQT_USE_QSTRINGBUILDER - -DQT_USE_FAST_OPERATOR_PLUS -) - set(KDSME_SOVERSION "2") #means the 2.x ABI is frozen. ABI changes will must go to version 3 include(FeatureSummary) @@ -239,94 +229,7 @@ add_feature_info("Internal build of Graphviz" WITH_INTERNAL_GRAPHVIZ "enable wit set(WITH_STATIC_GRAPHVIZ OFF) # Whether the Graphviz build we're using is static or not -- WIP -if(WITH_INTERNAL_GRAPHVIZ) - # CMake is really awful here... - set(source_dir ${CMAKE_CURRENT_BINARY_DIR}/graphviz-src) - set(install_dir ${CMAKE_CURRENT_BINARY_DIR}/graphviz-install) - - # work-around: https://cmake.org/Bug/view.php?id=15052 - set(include_dir "${install_dir}/include") - file(MAKE_DIRECTORY ${include_dir}) - set(GRAPHVIZ_INCLUDE_DIR ${include_dir}) - - if(UNIX OR WITH_STATIC_GRAPHVIZ) - set(libfolder "lib") - else() - set(libfolder "bin") - endif() - - if(WITH_STATIC_GRAPHVIZ) - set(staticdotlayoutplugin_library - "${install_dir}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gvplugin_dot_layout${CMAKE_STATIC_LIBRARY_SUFFIX}" - ) - set(link_libraries_absolute) - foreach(link_library "xdot;gvc;cgraph;pathplan") - list(APPEND link_libraries_absolute - ${install_dir}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${link_library}${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - endforeach() - else() - set(GRAPHVIZ_CGRAPH_LIBRARY - "${install_dir}/${libfolder}/${CMAKE_SHARED_LIBRARY_PREFIX}cgraph${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - set(GRAPHVIZ_GVC_LIBRARY - "${install_dir}/${libfolder}/${CMAKE_SHARED_LIBRARY_PREFIX}gvc${CMAKE_SHARED_LIBRARY_SUFFIX}" - ) - set(link_libraries_absolute "${GRAPHVIZ_CGRAPH_LIBRARY};${GRAPHVIZ_GVC_LIBRARY}") - endif() - - set(win_build_utilities ${source_dir}/windows/dependencies/graphviz-build-utilities) - string(TIMESTAMP graphvizDate) - set(GRAPHVIZ_MAJOR_VERSION 2) - set(GRAPHVIZ_MINOR_VERSION 48) - set(GRAPHVIZ_PATCH_VERSION 0) - set(graphvizVersion "${GRAPHVIZ_MAJOR_VERSION}.${GRAPHVIZ_MINOR_VERSION}.${GRAPHVIZ_PATCH_VERSION}") - # cmake-lint: disable=C0301 - externalproject_add( - GraphvizExternalProject - GIT_REPOSITORY "https://gitlab.com/graphviz/graphviz.git" - GIT_TAG ${graphvizVersion} - GIT_PROGRESS 1 - USES_TERMINAL_DOWNLOAD - TRUE # needed for Ninja so we can see the Git progress (cf. https://gitlab.kitware.com/cmake/cmake/-/issues/18238) - CMAKE_ARGS - -DVERSION=${graphvizVersion} - -DDATE=${graphvizDate} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} - -DCMAKE_C_COMPILER_AR=${CMAKE_C_COMPILER_AR} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_CXX_COMPILER_AR=${CMAKE_CXX_COMPILER_AR} - -DCMAKE_INSTALL_PREFIX=${install_dir} - $<$:-DCMAKE_IGNORE_PATH="C:/Strawberry/c/bin"> - $<$:-DCMAKE_SYSTEM_PREFIX_PATH=${win_build_utilities}$${win_build_utilities}/winflexbison$${win_build_utilities}/Perl64$${win_build_utilities}/GnuWin/bin> - BUILD_COMMAND "" # skip, make install is enough - SOURCE_DIR ${source_dir} - INSTALL_DIR ${install_dir} - INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install - # Note: BUILD_BYPRODUCTS only available since CMake 3.2 - # Needed to make ExternalProject_Add in combination with the Ninja generator work - # Also see: https://cmake.org/pipermail/cmake/2015-April/060234.html - BUILD_BYPRODUCTS ${staticdotlayoutplugin_library} ${link_libraries_absolute} - ) - - if(WITH_STATIC_GRAPHVIZ) - add_library(GraphvizStaticDotLayoutPlugin IMPORTED STATIC) - set_target_properties( - GraphvizStaticDotLayoutPlugin - PROPERTIES IMPORTED_LOCATION "${staticdotlayoutplugin_library}" - INTERFACE_COMPILE_DEFINITIONS - "CGRAPH_EXPORTS;GVC_EXPORTS;WITH_CGRAPH" # Fix export macro madness in Graphviz - INTERFACE_INCLUDE_DIRECTORIES ${include_dir} - INTERFACE_LINK_LIBRARIES "${link_libraries_absolute}" - ) - else() - # in case of a Graphviz dynamic library build, we need to install - install(DIRECTORY ${install_dir}/ DESTINATION ".") - endif() - - set(GRAPHVIZ_FOUND TRUE) -endif() +add_subdirectory(3rdparty) # # Compiler & linker settings diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index ddc7c977..93aef0f7 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -13,6 +13,16 @@ # Contact info@kdab.com if any conditions of this licensing are not clear to you. # +add_definitions( + -DQT_NO_CAST_TO_ASCII + -DQT_NO_CAST_FROM_ASCII + -DQT_STRICT_ITERATORS + -DQT_NO_URL_CAST_FROM_STRING + -DQT_NO_CAST_FROM_BYTEARRAY + -DQT_USE_QSTRINGBUILDER + -DQT_USE_FAST_OPERATOR_PLUS +) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-examples.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-examples.h) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 86f32b15..742b42e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,6 +13,16 @@ # Contact info@kdab.com if any conditions of this licensing are not clear to you. # +add_definitions( + -DQT_NO_CAST_TO_ASCII + -DQT_NO_CAST_FROM_ASCII + -DQT_STRICT_ITERATORS + -DQT_NO_URL_CAST_FROM_STRING + -DQT_NO_CAST_FROM_BYTEARRAY + -DQT_USE_QSTRINGBUILDER + -DQT_USE_FAST_OPERATOR_PLUS +) + set(HAVE_GRAPHVIZ ${GRAPHVIZ_FOUND}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-kdsme.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdsme.h) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9b680103..b1a08815 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -117,7 +117,7 @@ if(GRAPHVIZ_FOUND) endif() target_link_libraries(kdstatemachineeditor_core LINK_PRIVATE ${GRAPHVIZ_GVC_LIBRARY} ${GRAPHVIZ_CGRAPH_LIBRARY}) if(WITH_INTERNAL_GRAPHVIZ) - add_dependencies(kdstatemachineeditor_core GraphvizExternalProject) + # add_dependencies(kdstatemachineeditor_core GraphvizExternalProject) endif() target_include_directories(kdstatemachineeditor_core PRIVATE ${GRAPHVIZ_INCLUDE_DIR}) endif()