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
This commit is contained in:
Luca 2020-05-24 08:14:33 +01:00 committed by GitHub
parent 6a393955cd
commit c53be0e97d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 554 additions and 305 deletions

View File

@ -1,36 +1,28 @@
version: '2.3.2.{build}' version: '{build}'
branches: branches:
only: only:
- master - master
image: Visual Studio 2015 image: Visual Studio 2017
clone_depth: 1
environment: environment:
global: global:
# Appveyor doesn't have Qt 12 yet # Appveyor doesn't have Qt 12 yet
LatestLTSQtVersion: 5.9 LatestQtVersion: 5.13
LatestQtVersion: 5.11
matrix: 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 # 32 bit builds
# MSVC 2015 builds # MSVC 2015 builds
# Dynamic Library builds # Dynamic Library builds
# LTS version of Qt, dll, 32bit, MSVC 2015, qmake # LTS version of Qt, dll, 32bit, MSVC 2015, qmake
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - QT5: C:\Qt\%LatestQtVersion%\msvc2017
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
targetPlatform: x86 targetPlatform: x86
use_mingw: "false" use_mingw: "false"
use_static: "false" use_static: "false"
use_cmake: "false" use_cmake: "false"
# LTS version of Qt, dll, 32bit, MSVC 2015, cmake # LTS version of Qt, dll, 32bit, MSVC 2015, cmake
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - QT5: C:\Qt\%LatestQtVersion%\msvc2017
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
targetPlatform: x86 targetPlatform: x86
use_mingw: "false" use_mingw: "false"
use_static: "false" use_static: "false"
@ -38,15 +30,15 @@ environment:
# end Dynamic Library builds # end Dynamic Library builds
# Static Library builds # Static Library builds
# LTS version of Qt, static, 32bit, MSVC 2015, qmake # LTS version of Qt, static, 32bit, MSVC 2015, qmake
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - QT5: C:\Qt\%LatestQtVersion%\msvc2017
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
targetPlatform: x86 targetPlatform: x86
use_mingw: "false" use_mingw: "false"
use_static: "true" use_static: "true"
use_cmake: "false" use_cmake: "false"
# LTS version of Qt, static, 32bit, MSVC 2015, cmake # LTS version of Qt, static, 32bit, MSVC 2015, cmake
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 - QT5: C:\Qt\%LatestQtVersion%\msvc2017
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
targetPlatform: x86 targetPlatform: x86
use_mingw: "false" use_mingw: "false"
use_static: "true" use_static: "true"
@ -56,15 +48,15 @@ environment:
# MinGW builds # MinGW builds
# Dynamic Library builds # Dynamic Library builds
# LTS version of Qt, dll, 32bit, MinGW, qmake # LTS version of Qt, dll, 32bit, MinGW, qmake
- QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - QT5: C:\Qt\%LatestQtVersion%\mingw73_32
COMPILER: C:\Qt\Tools\mingw530_32 COMPILER: C:\Qt\Tools\mingw730_32
targetPlatform: x86 targetPlatform: x86
use_mingw: "true" use_mingw: "true"
use_static: "false" use_static: "false"
use_cmake: "false" use_cmake: "false"
# LTS version of Qt, dll, 32bit, MinGW, cmake # LTS version of Qt, dll, 32bit, MinGW, cmake
- QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - QT5: C:\Qt\%LatestQtVersion%\mingw73_32
COMPILER: C:\Qt\Tools\mingw530_32 COMPILER: C:\Qt\Tools\mingw730_32
targetPlatform: x86 targetPlatform: x86
use_mingw: "true" use_mingw: "true"
use_static: "false" use_static: "false"
@ -72,15 +64,15 @@ environment:
# end Dynamic Library builds # end Dynamic Library builds
# Static Library builds # Static Library builds
# LTS version of Qt, static, 32bit, MinGW, qmake # LTS version of Qt, static, 32bit, MinGW, qmake
- QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - QT5: C:\Qt\%LatestQtVersion%\mingw73_32
COMPILER: C:\Qt\Tools\mingw530_32 COMPILER: C:\Qt\Tools\mingw730_32
targetPlatform: x86 targetPlatform: x86
use_mingw: "true" use_mingw: "true"
use_static: "true" use_static: "true"
use_cmake: "false" use_cmake: "false"
# LTS version of Qt, static, 32bit, MinGW, cmake # LTS version of Qt, static, 32bit, MinGW, cmake
- QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 - QT5: C:\Qt\%LatestQtVersion%\mingw73_32
COMPILER: C:\Qt\Tools\mingw530_32 COMPILER: C:\Qt\Tools\mingw730_32
targetPlatform: x86 targetPlatform: x86
use_mingw: "true" use_mingw: "true"
use_static: "true" use_static: "true"
@ -92,15 +84,15 @@ environment:
# MSVC 2015 builds # MSVC 2015 builds
# Dynamic Library builds # Dynamic Library builds
# LTS version of Qt, dll, 64bit, MSVC 2015, qmake # LTS version of Qt, dll, 64bit, MSVC 2015, qmake
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
targetPlatform: amd64 targetPlatform: amd64
use_mingw: "false" use_mingw: "false"
use_static: "false" use_static: "false"
use_cmake: "false" use_cmake: "false"
# LTS version of Qt, dll, 64bit, MSVC 2015, cmake # LTS version of Qt, dll, 64bit, MSVC 2015, cmake
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
targetPlatform: amd64 targetPlatform: amd64
use_mingw: "false" use_mingw: "false"
use_static: "false" use_static: "false"
@ -108,15 +100,15 @@ environment:
# end Dynamic Library builds # end Dynamic Library builds
# Static Library builds # Static Library builds
# LTS version of Qt, static, 64bit, MSVC 2015, qmake # LTS version of Qt, static, 64bit, MSVC 2015, qmake
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
targetPlatform: amd64 targetPlatform: amd64
use_mingw: "false" use_mingw: "false"
use_static: "true" use_static: "true"
use_cmake: "false" use_cmake: "false"
# LTS version of Qt, static, 64bit, MSVC 2015, cmake # LTS version of Qt, static, 64bit, MSVC 2015, cmake
- QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 - QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
targetPlatform: amd64 targetPlatform: amd64
use_mingw: "false" use_mingw: "false"
use_static: "true" use_static: "true"
@ -129,10 +121,9 @@ matrix:
fast_finish: true fast_finish: true
before_build: before_build:
- set PATH=%COMPILER%\bin;%QT5%\bin;%PATH%
- set originalWD=%CD% - set originalWD=%CD%
- call "%QT5%\bin\qtenv2.bat" - call "%QT5%\bin\qtenv2.bat"
- cd %originalWD% - cd /D %originalWD%
- if %use_mingw%==false call "%COMPILER%\vcvarsall.bat" %targetPlatform% - if %use_mingw%==false call "%COMPILER%\vcvarsall.bat" %targetPlatform%
- if %use_static%==true (set USESTATIC=ON) else (set USESTATIC=OFF) - if %use_static%==true (set USESTATIC=ON) else (set USESTATIC=OFF)
- if %use_mingw%==true (set CMAKEGENERATOR="MinGW Makefiles") else (set CMAKEGENERATOR="NMake Makefiles") - 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;=% - if %use_mingw%==true set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
build_script: build_script:
- if %use_cmake%==true mkdir .\build - if %use_cmake%==true mkdir build
- if %use_cmake%==true cd .\build - if %use_cmake%==true cd build
- if %use_cmake%==true cmake --version - 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 -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 . - if %use_cmake%==true cmake --build .

View File

@ -2,9 +2,6 @@ language: cpp
# gcc is clang on mac # gcc is clang on mac
compiler: gcc compiler: gcc
git:
depth: 1
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
@ -21,74 +18,152 @@ matrix:
packages: packages:
- qt55base - qt55base
- qt55tools - qt55tools
- gcc-6 - gcc-9
- g++-6 - g++-9
- libc6-i386
script: script:
- PATH="/opt/qt55/bin:$PATH" - PATH="/opt/qt55/bin:$PATH"
- CXX="g++-6" - CXX="g++-9"
- CC="gcc-6" - CC="gcc-9"
- qt55-env.sh - qt55-env.sh
- qmake - qmake
- make - make
- make install - make install
- name: Ubuntu qmake dll - name: Ubuntu qmake dll
os: linux os: linux
dist: xenial dist: bionic
group: stable group: stable
services:
- xvfb
compiler: gcc
addons: addons:
apt: apt:
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial' - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic'
update: true update: true
packages: packages:
- qt512base - qt514base
- qt512tools - qt514tools
- gcc-6 - gcc-9
- g++-6 - g++-9
- libc6-i386 - libc6-i386
- libgl-dev - libgl-dev
- libgl1-mesa-dev - libgl1-mesa-dev
- mesa-common-dev - mesa-common-dev
script: script:
- PATH="/opt/qt512/bin:$PATH" - PATH="/opt/qt514/bin:$PATH"
- CXX="g++-6" - CXX="g++-9"
- CC="gcc-6" - CC="gcc-9"
- qt512-env.sh - qt514-env.sh
- qmake - qmake
- make - make
- make install - make install
- name: Ubuntu qmake static - name: Ubuntu qmake static
os: linux os: linux
dist: xenial dist: bionic
group: stable group: stable
services:
- xvfb
compiler: gcc
addons: addons:
apt: apt:
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial' - sourceline: 'ppa:beineri/opt-qt-5.14.2-bionic'
update: true update: true
packages: packages:
- qt512base - qt514base
- qt512tools - qt514tools
- gcc-6 - gcc-9
- g++-6 - g++-9
- libc6-i386 - libc6-i386
- libgl-dev - libgl-dev
- libgl1-mesa-dev - libgl1-mesa-dev
- mesa-common-dev - mesa-common-dev
script: script:
- PATH="/opt/qt512/bin:$PATH" - PATH="/opt/qt514/bin:$PATH"
- CXX="g++-6" - CXX="g++-9"
- CC="gcc-6" - CC="gcc-9"
- qt512-env.sh - qt514-env.sh
- qmake "CONFIG+=adsBuildStatic" - qmake "CONFIG+=adsBuildStatic"
- make - make
- make install - 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 - name: macOS CMake dll
os: osx os: osx
osx_image: xcode10.1 osx_image: xcode11.3
compiler: clang
addons: addons:
homebrew: homebrew:
packages: packages:
@ -107,7 +182,8 @@ matrix:
- cmake --build . --target install - cmake --build . --target install
- name: macOS CMake static - name: macOS CMake static
os: osx os: osx
osx_image: xcode10.1 osx_image: xcode11.3
compiler: clang
addons: addons:
homebrew: homebrew:
packages: packages:
@ -126,7 +202,8 @@ matrix:
- cmake --build . --target install - cmake --build . --target install
- name: macOS qmake dll - name: macOS qmake dll
os: osx os: osx
osx_image: xcode10.1 osx_image: xcode11.3
compiler: clang
addons: addons:
homebrew: homebrew:
packages: packages:
@ -139,7 +216,8 @@ matrix:
- make install - make install
- name: macOS qmake static - name: macOS qmake static
os: osx os: osx
osx_image: xcode10.1 osx_image: xcode11.3
compiler: clang
addons: addons:
homebrew: homebrew:
packages: packages:

View File

@ -1,131 +1,22 @@
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.5)
set(ads_VERSION "2.3.2") set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
set(CMAKE_CXX_STANDARD 14) include(GetGitRevisionDescription)
set(CMAKE_CXX_STANDARD_REQUIRED ON) git_describe(GitTagVersion --tags)
set(CMAKE_CXX_EXTENSIONS OFF) string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GitTagVersion}")
set(CMAKE_AUTOMOC ON) string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GitTagVersion}")
set(CMAKE_AUTORCC ON) string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GitTagVersion}")
project(QtAdvancedDockingSystem VERSION ${ads_VERSION}) 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_STATIC "Build the static library" OFF)
option(BUILD_EXAMPLES "Build the examples" ON) 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") if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(ads_PlatformDir "x86") set(ads_PlatformDir "x86")
else() else()
set(ads_PlatformDir "x64") set(ads_PlatformDir "x64")
endif() endif()
if(BUILD_STATIC) add_subdirectory(src)
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
"$<BUILD_INTERFACE:${ads_INCLUDE}>"
$<INSTALL_INTERFACE:include>
)
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"
)
if(BUILD_EXAMPLES) if(BUILD_EXAMPLES)
add_subdirectory(examples/simple) add_subdirectory(examples)
add_subdirectory(examples/sidebar)
add_subdirectory(demo) add_subdirectory(demo)
endif() endif()

View File

@ -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(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
#
# Returns the refspec and sha hash of the current head revision
#
# git_describe(<var> [<additional arguments to 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(<var> [<additional arguments to git describe> ...])
#
# 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(<var>)
#
# 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 <rpavlik@iastate.edu> <abiryan@ryand.net>
# 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()

View File

@ -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 <rpavlik@iastate.edu> <abiryan@ryand.net>
# 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()

View File

@ -1,29 +1,9 @@
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.5)
set (CMAKE_CXX_STANDARD 14) project(ads_demo VERSION ${VERSION_SHORT})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED)
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})
if(WIN32) if(WIN32)
find_package(Qt5AxContainer ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5 5.5 COMPONENTS AxContainer 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})
endif() endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(ads_demo_SRCS set(ads_demo_SRCS
@ -35,22 +15,26 @@ set(ads_demo_SRCS
demo.qrc demo.qrc
) )
add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS}) add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS})
if(BUILD_STATIC) target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src")
set(ads_demo_DEFINE ${ads_demo_DEFINE} ADS_STATIC) target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets)
if(WIN32)
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt5::AxContainer)
endif() endif()
add_dependencies(AdvancedDockingSystemDemo qtadvanceddocking) target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking)
target_include_directories(AdvancedDockingSystemDemo PUBLIC
$<BUILD_INTERFACE:${ads_demo_INCLUDE}>
$<INSTALL_INTERFACE:include>
)
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})
set_target_properties(AdvancedDockingSystemDemo PROPERTIES set_target_properties(AdvancedDockingSystemDemo PROPERTIES
VERSION "1.0" AUTOMOC ON
SOVERSION 1 AUTORCC ON
AUTOUIC ON
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
VERSION ${VERSION_SHORT}
EXPORT_NAME "Qt Advanced Docking System Demo" EXPORT_NAME "Qt Advanced Docking System Demo"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
LIBRARY_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" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
) )
#if(BUILD_STATIC)
# target_compile_definitions(AdvancedDockingSystemDemo PRIVATE ADS_STATIC)
#endif()

5
examples/CMakeLists.txt Normal file
View File

@ -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)

View File

@ -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"
)

View File

@ -1,45 +1,24 @@
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.5)
set (CMAKE_CXX_STANDARD 14) project(ads_example_sidebar VERSION ${VERSION_SHORT})
set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED)
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})
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(ads_example_SRCS add_executable(SidebarExample WIN32
main.cpp main.cpp
MainWindow.cpp MainWindow.cpp
MainWindow.ui MainWindow.ui
) )
add_executable(SidebarExample WIN32 ${ads_example_SRCS}) target_include_directories(SidebarExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
if(BUILD_STATIC) target_link_libraries(SidebarExample PRIVATE qtadvanceddocking)
set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) target_link_libraries(SidebarExample PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets)
endif()
add_dependencies(SidebarExample qtadvanceddocking)
target_include_directories(SidebarExample PUBLIC
$<BUILD_INTERFACE:${ads_example_INCLUDE}>
$<INSTALL_INTERFACE:include>
)
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})
set_target_properties(SidebarExample PROPERTIES set_target_properties(SidebarExample PROPERTIES
VERSION "1.0" AUTOMOC ON
SOVERSION 1 AUTORCC ON
EXPORT_NAME "Qt Advanced Docking System Example" 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" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
LIBRARY_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" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"

View File

@ -1,45 +1,24 @@
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.5)
set (CMAKE_CXX_STANDARD 14) project(ads_example_simple VERSION ${VERSION_SHORT})
set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED)
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})
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(ads_example_SRCS add_executable(SimpleExample WIN32
main.cpp main.cpp
MainWindow.cpp MainWindow.cpp
MainWindow.ui MainWindow.ui
) )
add_executable(SimpleExample WIN32 ${ads_example_SRCS}) target_include_directories(SimpleExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
if(BUILD_STATIC) target_link_libraries(SimpleExample PRIVATE qtadvanceddocking)
set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) target_link_libraries(SimpleExample PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets)
endif()
add_dependencies(SimpleExample qtadvanceddocking)
target_include_directories(SimpleExample PUBLIC
$<BUILD_INTERFACE:${ads_example_INCLUDE}>
$<INSTALL_INTERFACE:include>
)
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})
set_target_properties(SimpleExample PROPERTIES set_target_properties(SimpleExample PROPERTIES
VERSION "1.0" AUTOMOC ON
SOVERSION 1 AUTORCC ON
EXPORT_NAME "Qt Advanced Docking System Example" 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" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
LIBRARY_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" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"

106
src/CMakeLists.txt Normal file
View File

@ -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
$<INSTALL_INTERFACE:include>
)

View File

@ -27,7 +27,7 @@
//============================================================================ //============================================================================
// INCLUDES // INCLUDES
//============================================================================ //============================================================================
#include <FloatingDragPreview.h> #include "FloatingDragPreview.h"
#include "DockAreaTabBar.h" #include "DockAreaTabBar.h"
#include <QMouseEvent> #include <QMouseEvent>

View File

@ -8,7 +8,7 @@
//============================================================================ //============================================================================
// INCLUDES // INCLUDES
//============================================================================ //============================================================================
#include <DockComponentsFactory.h> #include "DockComponentsFactory.h"
#include <memory> #include <memory>

View File

@ -28,7 +28,7 @@
//============================================================================ //============================================================================
// INCLUDES // INCLUDES
//============================================================================ //============================================================================
#include <FloatingDragPreview.h> #include "FloatingDragPreview.h"
#include "ElidingLabel.h" #include "ElidingLabel.h"
#include "DockWidgetTab.h" #include "DockWidgetTab.h"

View File

@ -0,0 +1,2 @@
include(CMakeFindDependencyMacro)
include("${CMAKE_CURRENT_LIST_DIR}/adsTargets.cmake")

View File

@ -73,7 +73,7 @@ SOURCES += linux/FloatingWidgetTitleBar.cpp
} }
isEmpty(PREFIX){ isEmpty(PREFIX){
PREFIX=..\installed PREFIX=../installed
warning("Install Prefix not set") warning("Install Prefix not set")
} }
headers.path=$$PREFIX/include headers.path=$$PREFIX/include