From c53be0e97d2c24e8382ab859997f6e7de2b36ba1 Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 24 May 2020 08:14:33 +0100 Subject: [PATCH] Modernised CMake build files and CI configs (#185) * Modernised CMake build files and CI configs Fixed include formats * Fixed build errors and warnings * Fixes to allow CMake find_package --- .appveyor.yml | 71 ++++---- .travis.yml | 142 +++++++++++---- CMakeLists.txt | 131 ++----------- cmake/modules/GetGitRevisionDescription.cmake | 172 ++++++++++++++++++ .../GetGitRevisionDescription.cmake.in | 41 +++++ demo/CMakeLists.txt | 58 +++--- examples/CMakeLists.txt | 5 + examples/deleteonclose/CMakeLists.txt | 21 +++ examples/sidebar/CMakeLists.txt | 51 ++---- examples/simple/CMakeLists.txt | 51 ++---- src/CMakeLists.txt | 106 +++++++++++ src/DockAreaTabBar.cpp | 2 +- src/DockComponentsFactory.cpp | 2 +- src/DockWidgetTab.cpp | 2 +- src/qtadvanceddockingConfig.cmake | 2 + src/src.pro | 2 +- 16 files changed, 554 insertions(+), 305 deletions(-) create mode 100644 cmake/modules/GetGitRevisionDescription.cmake create mode 100644 cmake/modules/GetGitRevisionDescription.cmake.in create mode 100644 examples/CMakeLists.txt create mode 100644 examples/deleteonclose/CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/qtadvanceddockingConfig.cmake diff --git a/.appveyor.yml b/.appveyor.yml index 35ef837..9771255 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,36 +1,28 @@ -version: '2.3.2.{build}' +version: '{build}' branches: only: - master -image: Visual Studio 2015 -clone_depth: 1 +image: Visual Studio 2017 + environment: global: # Appveyor doesn't have Qt 12 yet - LatestLTSQtVersion: 5.9 - LatestQtVersion: 5.11 + LatestQtVersion: 5.13 matrix: - # Latest version of Qt, dll, 64bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC - targetPlatform: amd64 - use_mingw: "false" - use_static: "false" - use_cmake: "false" # 32 bit builds # MSVC 2015 builds # Dynamic Library builds # LTS version of Qt, dll, 32bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: x86 use_mingw: "false" use_static: "false" use_cmake: "false" # LTS version of Qt, dll, 32bit, MSVC 2015, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: x86 use_mingw: "false" use_static: "false" @@ -38,15 +30,15 @@ environment: # end Dynamic Library builds # Static Library builds # LTS version of Qt, static, 32bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: x86 use_mingw: "false" use_static: "true" use_cmake: "false" # LTS version of Qt, static, 32bit, MSVC 2015, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: x86 use_mingw: "false" use_static: "true" @@ -56,15 +48,15 @@ environment: # MinGW builds # Dynamic Library builds # LTS version of Qt, dll, 32bit, MinGW, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - COMPILER: C:\Qt\Tools\mingw530_32 + - QT5: C:\Qt\%LatestQtVersion%\mingw73_32 + COMPILER: C:\Qt\Tools\mingw730_32 targetPlatform: x86 use_mingw: "true" use_static: "false" use_cmake: "false" # LTS version of Qt, dll, 32bit, MinGW, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - COMPILER: C:\Qt\Tools\mingw530_32 + - QT5: C:\Qt\%LatestQtVersion%\mingw73_32 + COMPILER: C:\Qt\Tools\mingw730_32 targetPlatform: x86 use_mingw: "true" use_static: "false" @@ -72,15 +64,15 @@ environment: # end Dynamic Library builds # Static Library builds # LTS version of Qt, static, 32bit, MinGW, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - COMPILER: C:\Qt\Tools\mingw530_32 + - QT5: C:\Qt\%LatestQtVersion%\mingw73_32 + COMPILER: C:\Qt\Tools\mingw730_32 targetPlatform: x86 use_mingw: "true" use_static: "true" use_cmake: "false" # LTS version of Qt, static, 32bit, MinGW, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - COMPILER: C:\Qt\Tools\mingw530_32 + - QT5: C:\Qt\%LatestQtVersion%\mingw73_32 + COMPILER: C:\Qt\Tools\mingw730_32 targetPlatform: x86 use_mingw: "true" use_static: "true" @@ -92,15 +84,15 @@ environment: # MSVC 2015 builds # Dynamic Library builds # LTS version of Qt, dll, 64bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: amd64 use_mingw: "false" use_static: "false" use_cmake: "false" # LTS version of Qt, dll, 64bit, MSVC 2015, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: amd64 use_mingw: "false" use_static: "false" @@ -108,15 +100,15 @@ environment: # end Dynamic Library builds # Static Library builds # LTS version of Qt, static, 64bit, MSVC 2015, qmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: amd64 use_mingw: "false" use_static: "true" use_cmake: "false" # LTS version of Qt, static, 64bit, MSVC 2015, cmake - - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build targetPlatform: amd64 use_mingw: "false" use_static: "true" @@ -129,10 +121,9 @@ matrix: fast_finish: true before_build: -- set PATH=%COMPILER%\bin;%QT5%\bin;%PATH% - set originalWD=%CD% - call "%QT5%\bin\qtenv2.bat" -- cd %originalWD% +- cd /D %originalWD% - if %use_mingw%==false call "%COMPILER%\vcvarsall.bat" %targetPlatform% - if %use_static%==true (set USESTATIC=ON) else (set USESTATIC=OFF) - if %use_mingw%==true (set CMAKEGENERATOR="MinGW Makefiles") else (set CMAKEGENERATOR="NMake Makefiles") @@ -140,8 +131,8 @@ before_build: - if %use_mingw%==true set PATH=%PATH:C:\Program Files\Git\usr\bin;=% build_script: -- if %use_cmake%==true mkdir .\build -- if %use_cmake%==true cd .\build +- if %use_cmake%==true mkdir build +- if %use_cmake%==true cd build - if %use_cmake%==true cmake --version - if %use_cmake%==true cmake -G %CMAKEGENERATOR% -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DBUILD_STATIC=%USESTATIC% -DCMAKE_INSTALL_PREFIX="./installed" ../ - if %use_cmake%==true cmake --build . diff --git a/.travis.yml b/.travis.yml index 6b4afaa..d45b526 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,6 @@ language: cpp # gcc is clang on mac compiler: gcc -git: - depth: 1 - matrix: fast_finish: true include: @@ -21,74 +18,152 @@ matrix: packages: - qt55base - qt55tools - - gcc-6 - - g++-6 - - libc6-i386 + - gcc-9 + - g++-9 script: - PATH="/opt/qt55/bin:$PATH" - - CXX="g++-6" - - CC="gcc-6" + - CXX="g++-9" + - CC="gcc-9" - qt55-env.sh - qmake - make - make install - name: Ubuntu qmake dll os: linux - dist: xenial + dist: bionic group: stable + services: + - xvfb + compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test - - sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial' + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' update: true packages: - - qt512base - - qt512tools - - gcc-6 - - g++-6 + - qt514base + - qt514tools + - gcc-9 + - g++-9 - libc6-i386 - libgl-dev - libgl1-mesa-dev - mesa-common-dev script: - - PATH="/opt/qt512/bin:$PATH" - - CXX="g++-6" - - CC="gcc-6" - - qt512-env.sh + - PATH="/opt/qt514/bin:$PATH" + - CXX="g++-9" + - CC="gcc-9" + - qt514-env.sh - qmake - make - make install - name: Ubuntu qmake static os: linux - dist: xenial + dist: bionic group: stable + services: + - xvfb + compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test - - sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial' + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' update: true packages: - - qt512base - - qt512tools - - gcc-6 - - g++-6 + - qt514base + - qt514tools + - gcc-9 + - g++-9 - libc6-i386 - libgl-dev - libgl1-mesa-dev - mesa-common-dev script: - - PATH="/opt/qt512/bin:$PATH" - - CXX="g++-6" - - CC="gcc-6" - - qt512-env.sh + - PATH="/opt/qt514/bin:$PATH" + - CXX="g++-9" + - CC="gcc-9" + - qt514-env.sh - qmake "CONFIG+=adsBuildStatic" - make - make install + - name: Ubuntu CMake dll + os: linux + dist: bionic + group: stable + services: + - xvfb + compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' + update: true + packages: + - qt514base + - qt514tools + - gcc-9 + - g++-9 + - libc6-i386 + - libgl-dev + - libgl1-mesa-dev + - mesa-common-dev + script: + - PATH="/opt/qt514/bin:$PATH" + - CXX="g++-9" + - CC="gcc-9" + - qt514-env.sh + - mkdir ./build + - cd ./build + - cmake --version + - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_STATIC=OFF -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_STATIC=OFF -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - name: Ubuntu CMake Static + os: linux + dist: bionic + group: stable + services: + - xvfb + compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic' + update: true + packages: + - qt514base + - qt514tools + - gcc-9 + - g++-9 + - libc6-i386 + - libgl-dev + - libgl1-mesa-dev + - mesa-common-dev + script: + - PATH="/opt/qt514/bin:$PATH" + - CXX="g++-9" + - CC="gcc-9" + - qt514-env.sh + - mkdir ./build + - cd ./build + - cmake --version + - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_STATIC=ON -DBUILD_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_STATIC=ON -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install - name: macOS CMake dll os: osx - osx_image: xcode10.1 + osx_image: xcode11.3 + compiler: clang addons: homebrew: packages: @@ -107,7 +182,8 @@ matrix: - cmake --build . --target install - name: macOS CMake static os: osx - osx_image: xcode10.1 + osx_image: xcode11.3 + compiler: clang addons: homebrew: packages: @@ -126,7 +202,8 @@ matrix: - cmake --build . --target install - name: macOS qmake dll os: osx - osx_image: xcode10.1 + osx_image: xcode11.3 + compiler: clang addons: homebrew: packages: @@ -139,7 +216,8 @@ matrix: - make install - name: macOS qmake static os: osx - osx_image: xcode10.1 + osx_image: xcode11.3 + compiler: clang addons: homebrew: packages: diff --git a/CMakeLists.txt b/CMakeLists.txt index a246a97..94fdb8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,131 +1,22 @@ -cmake_minimum_required(VERSION 3.3) -set(ads_VERSION "2.3.2") -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -project(QtAdvancedDockingSystem VERSION ${ads_VERSION}) +cmake_minimum_required(VERSION 3.5) +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) +include(GetGitRevisionDescription) +git_describe(GitTagVersion --tags) +string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GitTagVersion}") +string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GitTagVersion}") +string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GitTagVersion}") +set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") +project(QtADS LANGUAGES CXX VERSION ${VERSION_SHORT}) option(BUILD_STATIC "Build the static library" OFF) option(BUILD_EXAMPLES "Build the examples" ON) -set(REQUIRED_QT_VERSION 5.5.0) -find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) -message(STATUS "Found Qt ${Qt5Core_VERSION}") -set(ads_INCLUDE ${ads_INCLUDE} ${Qt5Core_INCLUDE_DIRS}) -set(ads_INCLUDE ${ads_INCLUDE} "${CMAKE_CURRENT_SOURCE_DIR}/src") -set(ads_LIBS ${ads_LIBS} ${Qt5Core_LIBRARIES}) -set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS}) -set(ads_LIBS ${ads_LIBS} ${Qt5Gui_LIBRARIES}) -set(ads_INCLUDE ${ads_INCLUDE} ${Qt5Gui_INCLUDE_DIRS}) -set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS}) -set(ads_LIBS ${ads_LIBS} ${Qt5Widgets_LIBRARIES}) -set(ads_INCLUDE ${ads_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS}) -set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS}) -if(BUILD_STATIC) - set(CMAKE_STATIC_LIBRARY_SUFFIX "_static${CMAKE_STATIC_LIBRARY_SUFFIX}") -endif() -set(ads_SRCS - src/ads_globals.cpp - src/DockAreaTabBar.cpp - src/DockAreaTitleBar.cpp - src/DockAreaWidget.cpp - src/DockContainerWidget.cpp - src/DockManager.cpp - src/DockOverlay.cpp - src/DockSplitter.cpp - src/DockWidget.cpp - src/DockWidgetTab.cpp - src/DockingStateReader.cpp - src/ElidingLabel.cpp - src/FloatingDockContainer.cpp - src/FloatingDragPreview.cpp - src/IconProvider.cpp - src/DockComponentsFactory.cpp - src/ads.qrc - src/linux/FloatingWidgetTitleBar.cpp -) -set(ads_INSTALL_INCLUDE - src/ads_globals.h - src/DockAreaTabBar.h - src/DockAreaTitleBar.h - src/DockAreaTitleBar_p.h - src/DockAreaWidget.h - src/DockContainerWidget.h - src/DockManager.h - src/DockOverlay.h - src/DockSplitter.h - src/DockWidget.h - src/DockWidgetTab.h - src/DockingStateReader.h - src/ElidingLabel.h - src/FloatingDockContainer.h - src/FloatingDragPreview.h - src/IconProvider.h - src/DockComponentsFactory.h - src/linux/FloatingWidgetTitleBar.h -) if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") set(ads_PlatformDir "x86") else() set(ads_PlatformDir "x64") endif() -if(BUILD_STATIC) - add_library(qtadvanceddocking STATIC ${ads_SRCS}) - target_compile_definitions(qtadvanceddocking PUBLIC ADS_STATIC) -else() - add_library(qtadvanceddocking SHARED ${ads_SRCS}) - set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_SHARED_EXPORT) -endif() -install(FILES ${ads_INSTALL_INCLUDE} - DESTINATION include - COMPONENT headers -) -install(FILES - "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" - "${CMAKE_CURRENT_SOURCE_DIR}/gnu-lgpl-v2.1.md" - DESTINATION license - COMPONENT license -) -install(TARGETS qtadvanceddocking - EXPORT adsTargets - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - INCLUDES DESTINATION include -) - -include(CMakePackageConfigHelpers) -write_basic_package_version_file("adsConfigVersion.cmake" - VERSION ${ads_VERSION} - COMPATIBILITY SameMajorVersion -) -install(EXPORT adsTargets - FILE adsTargets.cmake - NAMESPACE ads:: - DESTINATION lib/cmake/ads -) -install(FILES "adsConfig.cmake" "${CMAKE_BINARY_DIR}/adsConfigVersion.cmake" - DESTINATION lib/cmake/ads -) - -target_include_directories(qtadvanceddocking PUBLIC - "$" - $ - ) -target_link_libraries(qtadvanceddocking PUBLIC ${ads_LIBS}) -target_compile_definitions(qtadvanceddocking PRIVATE ${ads_COMPILE_DEFINE}) -set_target_properties(qtadvanceddocking PROPERTIES - VERSION ${ads_VERSION} - EXPORT_NAME "QtAdvancedDockingSystem" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" -) +add_subdirectory(src) if(BUILD_EXAMPLES) - add_subdirectory(examples/simple) - add_subdirectory(examples/sidebar) + add_subdirectory(examples) add_subdirectory(demo) endif() diff --git a/cmake/modules/GetGitRevisionDescription.cmake b/cmake/modules/GetGitRevisionDescription.cmake new file mode 100644 index 0000000..a9ad77b --- /dev/null +++ b/cmake/modules/GetGitRevisionDescription.cmake @@ -0,0 +1,172 @@ +# - Returns a version string from Git +# +# These functions force a re-configure on each git commit so that you can +# trust the values of the variables in your build system. +# +# get_git_head_revision( [ ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe( [ ...]) +# +# Returns the results of git describe on the source tree, and adjusting +# the output so that it tests false if an error occurs. +# +# git_get_exact_tag( [ ...]) +# +# Returns the results of git describe --exact-match on the source tree, +# and adjusting the output so that it tests false if there was no exact +# matching tag. +# +# git_local_changes() +# +# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes. +# Uses the return code of "git diff-index --quiet HEAD --". +# Does not regard untracked files. +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_git_revision_description) + return() +endif() +set(__get_git_revision_description YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(get_git_head_revision _refspecvar _hashvar) + set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + # check if this is a submodule + if(NOT IS_DIRECTORY ${GIT_DIR}) + file(READ ${GIT_DIR} submodule) + string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) + get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) + get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) + endif() + if(NOT IS_DIRECTORY "${GIT_DIR}") + file(READ ${GIT_DIR} worktree) + string(REGEX REPLACE "gitdir: (.*)worktrees(.*)\n$" "\\1" GIT_DIR ${worktree}) + endif() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY) + include("${GIT_DATA}/grabRef.cmake") + + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) +endfunction() + +function(git_describe _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + # TODO sanitize + #if((${ARGN}" MATCHES "&&") OR + # (ARGN MATCHES "||") OR + # (ARGN MATCHES "\\;")) + # message("Please report the following error to the project!") + # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") + #endif() + + #message(STATUS "Arguments to execute_process: ${ARGN}") + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + describe + ${hash} + ${ARGN} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_get_exact_tag _var) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_local_changes _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + diff-index --quiet HEAD -- + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(res EQUAL 0) + set(${_var} "CLEAN" PARENT_SCOPE) + else() + set(${_var} "DIRTY" PARENT_SCOPE) + endif() +endfunction() diff --git a/cmake/modules/GetGitRevisionDescription.cmake.in b/cmake/modules/GetGitRevisionDescription.cmake.in new file mode 100644 index 0000000..6d8b708 --- /dev/null +++ b/cmake/modules/GetGitRevisionDescription.cmake.in @@ -0,0 +1,41 @@ +# +# Internal file for GetGitRevisionDescription.cmake +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + else() + configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) + file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_HASH "${CMAKE_MATCH_1}") + endif() + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index aa88d62..d2bc9e0 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -1,29 +1,9 @@ -cmake_minimum_required(VERSION 3.3) -set (CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTORCC ON) -project(ads_demo VERSION "1.0") -set(REQUIRED_QT_VERSION 5.5.0) -find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) -set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Core_LIBRARIES}) -set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Core_INCLUDE_DIRS}) -set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS} ) -set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Gui_LIBRARIES}) -set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Gui_INCLUDE_DIRS}) -set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS}) -set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5Widgets_LIBRARIES}) -set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS}) -set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS}) +cmake_minimum_required(VERSION 3.5) +project(ads_demo VERSION ${VERSION_SHORT}) + +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) if(WIN32) - find_package(Qt5AxContainer ${REQUIRED_QT_VERSION} REQUIRED) - set(ads_demo_LIBS ${ads_demo_LIBS} ${Qt5AxContainer_LIBRARIES}) - set(ads_demo_INCLUDE ${ads_demo_INCLUDE} ${Qt5AxContainer_INCLUDE_DIRS}) - set(ads_demo_COMPILE_DEFINE ${ads_demo_COMPILE_DEFINE} ${Qt5AxContainer_COMPILE_DEFINITIONS}) + find_package(Qt5 5.5 COMPONENTS AxContainer REQUIRED) endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) set(ads_demo_SRCS @@ -35,22 +15,26 @@ set(ads_demo_SRCS demo.qrc ) add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS}) -if(BUILD_STATIC) - set(ads_demo_DEFINE ${ads_demo_DEFINE} ADS_STATIC) +target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src") +target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) +if(WIN32) + target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt5::AxContainer) endif() -add_dependencies(AdvancedDockingSystemDemo qtadvanceddocking) -target_include_directories(AdvancedDockingSystemDemo PUBLIC - $ - $ - ) -target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_demo_INCLUDE}) -target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking ${ads_demo_LIBS}) -target_compile_definitions(AdvancedDockingSystemDemo PRIVATE ${ads_demo_DEFINE}) +target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking) set_target_properties(AdvancedDockingSystemDemo PROPERTIES - VERSION "1.0" - SOVERSION 1 + AUTOMOC ON + AUTORCC ON + AUTOUIC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} EXPORT_NAME "Qt Advanced Docking System Demo" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" ) +#if(BUILD_STATIC) +# target_compile_definitions(AdvancedDockingSystemDemo PRIVATE ADS_STATIC) +#endif() + diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..d1a4516 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.5) +project(QtADSExamples LANGUAGES CXX VERSION ${VERSION_SHORT}) +add_subdirectory(simple) +add_subdirectory(sidebar) +add_subdirectory(deleteonclose) \ No newline at end of file diff --git a/examples/deleteonclose/CMakeLists.txt b/examples/deleteonclose/CMakeLists.txt new file mode 100644 index 0000000..0aa8630 --- /dev/null +++ b/examples/deleteonclose/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.5) +project(ads_example_deleteonclose VERSION ${VERSION_SHORT}) +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +add_executable(DeleteOnCloseTest WIN32 + main.cpp +) +target_include_directories(DeleteOnCloseTest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src") +target_link_libraries(DeleteOnCloseTest PRIVATE qtadvanceddocking) +target_link_libraries(DeleteOnCloseTest PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) +set_target_properties(DeleteOnCloseTest PROPERTIES + AUTOMOC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} + EXPORT_NAME "Qt Advanced Docking System Delete on Close Example" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" +) diff --git a/examples/sidebar/CMakeLists.txt b/examples/sidebar/CMakeLists.txt index a050e88..6940583 100644 --- a/examples/sidebar/CMakeLists.txt +++ b/examples/sidebar/CMakeLists.txt @@ -1,45 +1,24 @@ -cmake_minimum_required(VERSION 3.3) -set (CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -project(ads_example VERSION "1.0") -set(REQUIRED_QT_VERSION 5.5.0) -find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Core_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Core_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS} ) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Gui_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Gui_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS}) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Widgets_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS}) +cmake_minimum_required(VERSION 3.5) +project(ads_example_sidebar VERSION ${VERSION_SHORT}) +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(ads_example_SRCS +add_executable(SidebarExample WIN32 main.cpp MainWindow.cpp MainWindow.ui ) -add_executable(SidebarExample WIN32 ${ads_example_SRCS}) -if(BUILD_STATIC) - set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) -endif() -add_dependencies(SidebarExample qtadvanceddocking) -target_include_directories(SidebarExample PUBLIC - $ - $ - ) -target_include_directories(SidebarExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src" ${ads_example_INCLUDE}) -target_link_libraries(SidebarExample PRIVATE qtadvanceddocking ${ads_example_LIBS}) -target_compile_definitions(SidebarExample PRIVATE ${ads_example_DEFINE}) +target_include_directories(SidebarExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src") +target_link_libraries(SidebarExample PRIVATE qtadvanceddocking) +target_link_libraries(SidebarExample PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) set_target_properties(SidebarExample PROPERTIES - VERSION "1.0" - SOVERSION 1 - EXPORT_NAME "Qt Advanced Docking System Example" + AUTOMOC ON + AUTORCC ON + AUTOUIC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} + EXPORT_NAME "Qt Advanced Docking System Sidebar Example" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" diff --git a/examples/simple/CMakeLists.txt b/examples/simple/CMakeLists.txt index 35e9866..8c66a5a 100644 --- a/examples/simple/CMakeLists.txt +++ b/examples/simple/CMakeLists.txt @@ -1,45 +1,24 @@ -cmake_minimum_required(VERSION 3.3) -set (CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -project(ads_example VERSION "1.0") -set(REQUIRED_QT_VERSION 5.5.0) -find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) -find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Core_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Core_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS} ) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Gui_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Gui_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS}) -set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Widgets_LIBRARIES}) -set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS}) -set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS}) +cmake_minimum_required(VERSION 3.5) +project(ads_example_simple VERSION ${VERSION_SHORT}) +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(ads_example_SRCS +add_executable(SimpleExample WIN32 main.cpp MainWindow.cpp MainWindow.ui ) -add_executable(SimpleExample WIN32 ${ads_example_SRCS}) -if(BUILD_STATIC) - set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) -endif() -add_dependencies(SimpleExample qtadvanceddocking) -target_include_directories(SimpleExample PUBLIC - $ - $ - ) -target_include_directories(SimpleExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src" ${ads_example_INCLUDE}) -target_link_libraries(SimpleExample PRIVATE qtadvanceddocking ${ads_example_LIBS}) -target_compile_definitions(SimpleExample PRIVATE ${ads_example_DEFINE}) +target_include_directories(SimpleExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src") +target_link_libraries(SimpleExample PRIVATE qtadvanceddocking) +target_link_libraries(SimpleExample PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) set_target_properties(SimpleExample PROPERTIES - VERSION "1.0" - SOVERSION 1 - EXPORT_NAME "Qt Advanced Docking System Example" + AUTOMOC ON + AUTORCC ON + AUTOUIC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} + EXPORT_NAME "Qt Advanced Docking System Simple Example" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..7893cce --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,106 @@ +cmake_minimum_required(VERSION 3.5) +project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT}) +find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +if(BUILD_STATIC) + set(CMAKE_STATIC_LIBRARY_SUFFIX "_static${CMAKE_STATIC_LIBRARY_SUFFIX}") +endif() +set(ads_SRCS + ads_globals.cpp + DockAreaTabBar.cpp + DockAreaTitleBar.cpp + DockAreaWidget.cpp + DockContainerWidget.cpp + DockManager.cpp + DockOverlay.cpp + DockSplitter.cpp + DockWidget.cpp + DockWidgetTab.cpp + DockingStateReader.cpp + ElidingLabel.cpp + FloatingDockContainer.cpp + FloatingDragPreview.cpp + IconProvider.cpp + DockComponentsFactory.cpp + ads.qrc +) +set(ads_INSTALL_INCLUDE + ads_globals.h + DockAreaTabBar.h + DockAreaTitleBar.h + DockAreaTitleBar_p.h + DockAreaWidget.h + DockContainerWidget.h + DockManager.h + DockOverlay.h + DockSplitter.h + DockWidget.h + DockWidgetTab.h + DockingStateReader.h + ElidingLabel.h + FloatingDockContainer.h + FloatingDragPreview.h + IconProvider.h + DockComponentsFactory.h +) +if (UNIX) + set(ads_SRCS linux/FloatingWidgetTitleBar.cpp ${ads_SRCS}) + set(ads_INSTALL_INCLUDE linux/FloatingWidgetTitleBar.h ${ads_INSTALL_INCLUDE}) +endif() +if(BUILD_STATIC) + add_library(qtadvanceddocking STATIC ${ads_SRCS}) + target_compile_definitions(qtadvanceddocking PUBLIC ADS_STATIC) +else() + add_library(qtadvanceddocking SHARED ${ads_SRCS}) + target_compile_definitions(qtadvanceddocking PRIVATE ADS_SHARED_EXPORT) +endif() +target_link_libraries(qtadvanceddocking PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets) +set_target_properties(qtadvanceddocking PROPERTIES + AUTOMOC ON + AUTORCC ON + CXX_STANDARD 14 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS OFF + VERSION ${VERSION_SHORT} + EXPORT_NAME "qtadvanceddocking" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" +) +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "qtadvanceddockingConfigVersion.cmake" + VERSION ${VERSION_SHORT} + COMPATIBILITY SameMajorVersion +) +install(FILES ${ads_INSTALL_INCLUDE} + DESTINATION include + COMPONENT headers +) +install(FILES + "${CMAKE_SOURCE_DIR}/LICENSE" + "${CMAKE_SOURCE_DIR}/gnu-lgpl-v2.1.md" + DESTINATION license + COMPONENT license +) +install(TARGETS qtadvanceddocking + EXPORT adsTargets + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + INCLUDES DESTINATION include +) + +install(EXPORT adsTargets + FILE adsTargets.cmake + NAMESPACE ads:: + DESTINATION lib/cmake/qtadvanceddocking +) +install(FILES qtadvanceddockingConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/qtadvanceddockingConfigVersion.cmake" + DESTINATION lib/cmake/qtadvanceddocking +) + +target_include_directories(qtadvanceddocking PUBLIC + $ +) + diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index 4e68727..d135d04 100644 --- a/src/DockAreaTabBar.cpp +++ b/src/DockAreaTabBar.cpp @@ -27,7 +27,7 @@ //============================================================================ // INCLUDES //============================================================================ -#include +#include "FloatingDragPreview.h" #include "DockAreaTabBar.h" #include diff --git a/src/DockComponentsFactory.cpp b/src/DockComponentsFactory.cpp index 85a5475..1f8be65 100644 --- a/src/DockComponentsFactory.cpp +++ b/src/DockComponentsFactory.cpp @@ -8,7 +8,7 @@ //============================================================================ // INCLUDES //============================================================================ -#include +#include "DockComponentsFactory.h" #include diff --git a/src/DockWidgetTab.cpp b/src/DockWidgetTab.cpp index 6a33e3f..e60a717 100644 --- a/src/DockWidgetTab.cpp +++ b/src/DockWidgetTab.cpp @@ -28,7 +28,7 @@ //============================================================================ // INCLUDES //============================================================================ -#include +#include "FloatingDragPreview.h" #include "ElidingLabel.h" #include "DockWidgetTab.h" diff --git a/src/qtadvanceddockingConfig.cmake b/src/qtadvanceddockingConfig.cmake new file mode 100644 index 0000000..65173fa --- /dev/null +++ b/src/qtadvanceddockingConfig.cmake @@ -0,0 +1,2 @@ +include(CMakeFindDependencyMacro) +include("${CMAKE_CURRENT_LIST_DIR}/adsTargets.cmake") \ No newline at end of file diff --git a/src/src.pro b/src/src.pro index f117495..b54cbeb 100644 --- a/src/src.pro +++ b/src/src.pro @@ -73,7 +73,7 @@ SOURCES += linux/FloatingWidgetTitleBar.cpp } isEmpty(PREFIX){ - PREFIX=..\installed + PREFIX=../installed warning("Install Prefix not set") } headers.path=$$PREFIX/include