Fixes to project files

Fixed naming of projects using CMake
Added working static compile using qmake
Added conventional naming of debug libraries
Added install target to qmake
This commit is contained in:
Luca Beldi 2019-01-16 16:49:59 +00:00
parent 2570a880af
commit 275520ae29
6 changed files with 89 additions and 74 deletions

View File

@ -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
$<BUILD_INTERFACE:${ads_INCLUDE}>
$<INSTALL_INTERFACE:include>
)
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"

View File

@ -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
$<BUILD_INTERFACE:${ads_demo_INCLUDE}>
$<INSTALL_INTERFACE:include>
)
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"
)

View File

@ -1,17 +1,19 @@
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
@ -23,9 +25,20 @@ 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

View File

@ -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
$<BUILD_INTERFACE:${ads_example_INCLUDE}>
$<INSTALL_INTERFACE:include>
)
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"
)

View File

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

View File

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