diff --git a/CMakeLists.txt b/CMakeLists.txt index 70691b0..d6adb7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_AUTORCC ON) project(QtAdvancedDockingSystem VERSION ${ads_VERSION}) option(BUILD_STATIC "Build the static library" OFF) option(BUILD_EXAMPLES "Build the examples" ON) -set(REQUIRED_QT_VERSION 5.0.0) +set(REQUIRED_QT_VERSION 5.7.0) find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) @@ -56,15 +56,15 @@ set(ads_INSTALL_INCLUDE src/FloatingDockContainer.h ) if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") - set(ads_PlatformDir "x64") -else() set(ads_PlatformDir "x86") +else() + set(ads_PlatformDir "x64") endif() if(BUILD_STATIC) - add_library(ads STATIC ${ads_SRCS}) + add_library(qtadvanceddocking STATIC ${ads_SRCS}) set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_STATIC) else() - add_library(ads SHARED ${ads_SRCS}) + add_library(qtadvanceddocking SHARED ${ads_SRCS}) set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_SHARED_EXPORT) endif() install(FILES ${ads_INSTALL_INCLUDE} @@ -77,19 +77,19 @@ install(FILES DESTINATION license COMPONENT license ) -install(TARGETS ads +install(TARGETS qtadvanceddocking EXPORT adsBinary RUNTIME DESTINATION bin COMPONENT library LIBRARY DESTINATION lib COMPONENT library ARCHIVE DESTINATION lib COMPONENT library ) -target_include_directories(ads PUBLIC +target_include_directories(qtadvanceddocking PUBLIC $ $ ) -target_link_libraries(ads PUBLIC ${ads_LIBS}) -target_compile_definitions(ads PRIVATE ${ads_COMPILE_DEFINE}) -set_target_properties(ads PROPERTIES +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 "Qt Advanced Docking System" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index b2ee246..31a679f 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -6,7 +6,7 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) project(ads_demo VERSION "1.0") -set(REQUIRED_QT_VERSION 5.0.0) +set(REQUIRED_QT_VERSION 5.7.0) find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) @@ -26,23 +26,23 @@ set(ads_demo_SRCS MainWindow.ui main.qrc ) -add_executable(ads_demo WIN32 ${ads_demo_SRCS}) +add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS}) if(BUILD_STATIC) set(ads_demo_DEFINE ${ads_demo_DEFINE} ADS_STATIC) endif() -add_dependencies(ads_demo ads) -target_include_directories(ads_demo PUBLIC +add_dependencies(AdvancedDockingSystemDemo qtadvanceddocking) +target_include_directories(AdvancedDockingSystemDemo PUBLIC $ $ ) -target_include_directories(ads_demo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_demo_INCLUDE}) -target_link_libraries(ads_demo PRIVATE ads ${ads_demo_LIBS}) -target_compile_definitions(ads_demo PRIVATE ${ads_demo_DEFINE}) -set_target_properties(ads_demo PROPERTIES +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 VERSION "1.0" SOVERSION 1 EXPORT_NAME "Qt Advanced Docking System Demo" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/demo" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/demo" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin/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" ) diff --git a/demo/demo.pro b/demo/demo.pro index 73086c9..4d6eae1 100644 --- a/demo/demo.pro +++ b/demo/demo.pro @@ -1,31 +1,44 @@ -ADS_ROOT = $${PWD}/.. ADS_OUT_ROOT = $${OUT_PWD}/.. TARGET = AdvancedDockingSystemDemo DESTDIR = $${ADS_OUT_ROOT}/lib QT += core gui widgets -CONFIG *= c++14 +CONFIG += c++11 +DEFINES += QT_DEPRECATED_WARNINGS +adsBuildStatic { + DEFINES += ADS_STATIC +} SOURCES += \ main.cpp \ MainWindow.cpp - HEADERS += \ MainWindow.h FORMS += \ mainwindow.ui - + RESOURCES += main.qrc LIBS += -L$${ADS_OUT_ROOT}/lib # Dependency: AdvancedDockingSystem (shared) -win32:CONFIG(release, debug|release): LIBS += -lqtadvanceddocking -else:win32:CONFIG(debug, debug|release): LIBS += -lqtadvanceddockingd -else:unix: LIBS += -lqtadvanceddocking +CONFIG(debug, debug|release){ + win32 { + LIBS += -lqtadvanceddockingd + } + else:mac { + LIBS += -lqtadvanceddocking_debug + } + else { + LIBS += -lqtadvanceddocking + } +} +else{ + LIBS += -lqtadvanceddocking +} INCLUDEPATH += ../src DEPENDPATH += ../src diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 8d99310..9fa8931 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -5,7 +5,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) project(ads_example VERSION "1.0") -set(REQUIRED_QT_VERSION 5.0.0) +set(REQUIRED_QT_VERSION 5.7.0) find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) @@ -24,23 +24,23 @@ set(ads_example_SRCS MainWindow.cpp MainWindow.ui ) -add_executable(ads_example WIN32 ${ads_example_SRCS}) +add_executable(Example1 WIN32 ${ads_example_SRCS}) if(BUILD_STATIC) set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) endif() -add_dependencies(ads_example ads) -target_include_directories(ads_example PUBLIC +add_dependencies(Example1 qtadvanceddocking) +target_include_directories(Example1 PUBLIC $ $ ) -target_include_directories(ads_example PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_example_INCLUDE}) -target_link_libraries(ads_example PRIVATE ads ${ads_example_LIBS}) -target_compile_definitions(ads_example PRIVATE ${ads_example_DEFINE}) -set_target_properties(ads_example PROPERTIES +target_include_directories(Example1 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_example_INCLUDE}) +target_link_libraries(Example1 PRIVATE qtadvanceddocking ${ads_example_LIBS}) +target_compile_definitions(Example1 PRIVATE ${ads_example_DEFINE}) +set_target_properties(Example1 PROPERTIES VERSION "1.0" SOVERSION 1 EXPORT_NAME "Qt Advanced Docking System Example" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/example" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/example" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin/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/example/example.pro b/example/example.pro index e571329..b1a26e6 100644 --- a/example/example.pro +++ b/example/example.pro @@ -1,32 +1,17 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2018-12-14T22:42:14 -# -#------------------------------------------------- -ADS_ROOT = $${PWD}/.. ADS_OUT_ROOT = $${OUT_PWD}/.. -QT += core gui widgets - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +QT += core gui widgets TARGET = Example1 DESTDIR = $${ADS_OUT_ROOT}/lib TEMPLATE = app -CONFIG *= c++14 +CONFIG += c++11 +adsBuildStatic { + DEFINES += ADS_STATIC +} -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - - SOURCES += \ main.cpp \ MainWindow.cpp @@ -42,9 +27,20 @@ FORMS += \ LIBS += -L$${ADS_OUT_ROOT}/lib # Dependency: AdvancedDockingSystem (shared) -win32:CONFIG(release, debug|release): LIBS += -lqtadvanceddocking -else:win32:CONFIG(debug, debug|release): LIBS += -lqtadvanceddockingd -else:unix: LIBS += -lqtadvanceddocking +CONFIG(debug, debug|release){ + win32 { + LIBS += -lqtadvanceddockingd + } + else:mac { + LIBS += -lqtadvanceddocking_debug + } + else { + LIBS += -lqtadvanceddocking + } +} +else{ + LIBS += -lqtadvanceddocking +} INCLUDEPATH += ../src DEPENDPATH += ../src diff --git a/src/src.pro b/src/src.pro index 2f4ea7d..68320d6 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,26 +1,27 @@ -ADS_ROOT = $${PWD}/.. ADS_OUT_ROOT = $${OUT_PWD}/.. - +CONFIG += c++11 TARGET = $$qtLibraryTarget(qtadvanceddocking) +DEFINES += QT_DEPRECATED_WARNINGS +CONFIG(debug, debug|release) { + mac: TARGET = $$join(TARGET,,,_debug) + win32: TARGET = $$join(TARGET,,,d) +} TEMPLATE = lib DESTDIR = $${ADS_OUT_ROOT}/lib QT += core gui widgets -CONFIG += adsBuildShared - - -adsBuildShared { +!adsBuildStatic { CONFIG += shared DEFINES += ADS_SHARED_EXPORT } -!adsBuildShared { +adsBuildStatic { CONFIG += staticlib + DEFINES += ADS_STATIC } windows { # MinGW *-g++* { - QMAKE_CXXFLAGS += -std=c++11 QMAKE_CXXFLAGS += -Wall -Wextra -pedantic } # MSVC @@ -28,10 +29,6 @@ windows { } } -unix { - CONFIG += c++11 -} - RESOURCES += ads.qrc HEADERS += \ @@ -63,3 +60,12 @@ SOURCES += \ DockSplitter.cpp \ DockAreaTitleBar.cpp \ ElidingLabel.cpp + +isEmpty(PREFIX){ + PREFIX=..\installed + warning("Install Prefix not set") +} +headers.path=$$PREFIX/include +headers.files=$$HEADERS +target.path=$$PREFIX/lib +INSTALLS += headers target \ No newline at end of file