2019-01-16 17:44:34 +08:00
|
|
|
cmake_minimum_required(VERSION 3.3)
|
|
|
|
set(ads_VERSION "2.3.2")
|
2019-01-26 00:28:36 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
2019-01-16 17:44:34 +08:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
project(QtAdvancedDockingSystem VERSION ${ads_VERSION})
|
|
|
|
option(BUILD_STATIC "Build the static library" OFF)
|
|
|
|
option(BUILD_EXAMPLES "Build the examples" ON)
|
2019-01-26 00:28:36 +08:00
|
|
|
set(REQUIRED_QT_VERSION 5.5.0)
|
2019-01-16 17:44:34 +08:00
|
|
|
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
|
2019-11-29 22:56:57 +08:00
|
|
|
src/DockingStateReader.cpp
|
2019-01-16 17:44:34 +08:00
|
|
|
src/ElidingLabel.cpp
|
|
|
|
src/FloatingDockContainer.cpp
|
2019-12-16 18:18:22 +08:00
|
|
|
src/FloatingDragPreview.cpp
|
2019-10-18 20:22:06 +08:00
|
|
|
src/IconProvider.cpp
|
2020-02-11 15:32:49 +08:00
|
|
|
src/DockComponentsFactory.cpp
|
2019-01-16 17:44:34 +08:00
|
|
|
src/ads.qrc
|
2019-07-12 20:35:06 +08:00
|
|
|
src/linux/FloatingWidgetTitleBar.cpp
|
2019-01-16 17:44:34 +08:00
|
|
|
)
|
|
|
|
set(ads_INSTALL_INCLUDE
|
|
|
|
src/ads_globals.h
|
|
|
|
src/DockAreaTabBar.h
|
|
|
|
src/DockAreaTitleBar.h
|
|
|
|
src/DockAreaWidget.h
|
|
|
|
src/DockContainerWidget.h
|
|
|
|
src/DockManager.h
|
|
|
|
src/DockOverlay.h
|
|
|
|
src/DockSplitter.h
|
|
|
|
src/DockWidget.h
|
|
|
|
src/DockWidgetTab.h
|
2019-11-29 22:56:57 +08:00
|
|
|
src/DockingStateReader.h
|
2019-01-16 17:44:34 +08:00
|
|
|
src/ElidingLabel.h
|
|
|
|
src/FloatingDockContainer.h
|
2019-12-16 18:18:22 +08:00
|
|
|
src/FloatingDragPreview.h
|
2019-10-18 20:22:06 +08:00
|
|
|
src/IconProvider.h
|
2020-02-11 15:32:49 +08:00
|
|
|
src/DockComponentsFactory.h
|
2019-07-12 20:35:06 +08:00
|
|
|
src/linux/FloatingWidgetTitleBar.h
|
2019-01-16 17:44:34 +08:00
|
|
|
)
|
|
|
|
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
|
|
|
set(ads_PlatformDir "x86")
|
2019-01-17 00:49:59 +08:00
|
|
|
else()
|
|
|
|
set(ads_PlatformDir "x64")
|
2019-01-16 17:44:34 +08:00
|
|
|
endif()
|
|
|
|
if(BUILD_STATIC)
|
2019-01-17 00:49:59 +08:00
|
|
|
add_library(qtadvanceddocking STATIC ${ads_SRCS})
|
2019-10-09 18:39:32 +08:00
|
|
|
target_compile_definitions(qtadvanceddocking PUBLIC ADS_STATIC)
|
2019-01-16 17:44:34 +08:00
|
|
|
else()
|
2019-01-17 00:49:59 +08:00
|
|
|
add_library(qtadvanceddocking SHARED ${ads_SRCS})
|
2019-01-16 17:44:34 +08:00
|
|
|
set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_SHARED_EXPORT)
|
|
|
|
endif()
|
|
|
|
install(FILES ${ads_INSTALL_INCLUDE}
|
|
|
|
DESTINATION include
|
|
|
|
COMPONENT headers
|
|
|
|
)
|
|
|
|
install(FILES
|
2020-02-01 04:39:10 +08:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE"
|
2019-01-16 17:44:34 +08:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/gnu-lgpl-v2.1.md"
|
|
|
|
DESTINATION license
|
|
|
|
COMPONENT license
|
|
|
|
)
|
2019-01-17 00:49:59 +08:00
|
|
|
install(TARGETS qtadvanceddocking
|
2019-10-01 16:25:24 +08:00
|
|
|
EXPORT adsTargets
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
ARCHIVE DESTINATION lib
|
|
|
|
INCLUDES DESTINATION include
|
2019-01-16 17:44:34 +08:00
|
|
|
)
|
2019-10-01 16:25:24 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
)
|
|
|
|
|
2019-01-17 00:49:59 +08:00
|
|
|
target_include_directories(qtadvanceddocking PUBLIC
|
2019-08-11 07:40:08 +08:00
|
|
|
"$<BUILD_INTERFACE:${ads_INCLUDE}>"
|
2019-01-16 17:44:34 +08:00
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
|
)
|
2019-01-17 00:49:59 +08:00
|
|
|
target_link_libraries(qtadvanceddocking PUBLIC ${ads_LIBS})
|
|
|
|
target_compile_definitions(qtadvanceddocking PRIVATE ${ads_COMPILE_DEFINE})
|
|
|
|
set_target_properties(qtadvanceddocking PROPERTIES
|
2019-01-16 17:44:34 +08:00
|
|
|
VERSION ${ads_VERSION}
|
2019-10-01 16:25:24 +08:00
|
|
|
EXPORT_NAME "QtAdvancedDockingSystem"
|
2019-01-16 17:44:34 +08:00
|
|
|
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)
|
2020-05-07 20:39:02 +08:00
|
|
|
add_subdirectory(examples/simple)
|
|
|
|
add_subdirectory(examples/sidebar)
|
2019-01-16 17:44:34 +08:00
|
|
|
add_subdirectory(demo)
|
|
|
|
endif()
|
|
|
|
|