From 88781a003ffd5f699f70b06d2d99325cf4e60c0f Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 21 Apr 2022 14:10:09 +0200 Subject: [PATCH] CMake: Qt Creator Static build support This adds the build system feature that allows Qt Creator's libraries and plugins to be compiled statically. Fixes some symbol clashes when all plugins are linked into the same executable. Support for actually loading static plugins will be added in a separate commit. The feature is controlled by QTC_STATIC_BUILD which by default is OFF. Change-Id: I1fab7953c43e42dc75619e35660029ee067106df Reviewed-by: hjk Reviewed-by: Eike Ziller Reviewed-by: Reviewed-by: Qt CI Bot --- cmake/FindQt5.cmake | 8 +- cmake/Findyaml-cpp.cmake | 8 +- cmake/QtCreatorAPI.cmake | 94 +++++++++++++------ cmake/QtCreatorAPIInternal.cmake | 12 +++ src/CMakeLists.txt | 2 +- src/app/CMakeLists.txt | 33 +++++++ src/libs/3rdparty/cplusplus/CMakeLists.txt | 7 +- .../syntax-highlighting/CMakeLists.txt | 10 +- src/libs/CMakeLists.txt | 8 +- src/libs/advanceddockingsystem/ads_globals.h | 12 +-- src/libs/aggregation/aggregation_global.h | 2 + src/libs/clangsupport/CMakeLists.txt | 1 - src/libs/clangsupport/clangsupport_global.h | 4 +- src/libs/cplusplus/CMakeLists.txt | 9 +- .../extensionsystem/extensionsystem_global.h | 2 + src/libs/glsl/glsl.h | 2 +- .../languageserverprotocol_global.h | 2 + src/libs/languageutils/languageutils_global.h | 2 +- src/libs/modelinglib/CMakeLists.txt | 1 - .../qmt/infrastructure/qmt_global.h | 2 + src/libs/qmldebug/qmldebug_global.h | 2 +- .../qmleditorwidgets_global.h | 2 +- src/libs/qmljs/parser/qmljsglobal_p.h | 2 +- src/libs/qmljs/qmljs_global.h | 2 +- src/libs/sqlite/CMakeLists.txt | 5 +- src/libs/sqlite/sqliteglobal.h | 4 +- src/libs/ssh/ssh_global.h | 2 + src/libs/tracing/tracing_global.h | 2 + src/libs/utils/filesearch.cpp | 14 +-- src/libs/utils/utils_global.h | 2 +- src/plugins/android/android_global.h | 2 + src/plugins/autotest/CMakeLists.txt | 1 + src/plugins/autotest/autotest_global.h | 2 + .../autotoolsprojectmanager/CMakeLists.txt | 1 + src/plugins/boot2qt/CMakeLists.txt | 1 + .../cmakeprojectmanager/CMakeLists.txt | 1 + .../cmakeprojectmanager/cmake_global.h | 2 + src/plugins/cppeditor/CMakeLists.txt | 1 - src/plugins/cvs/CMakeLists.txt | 1 + src/plugins/designer/CMakeLists.txt | 8 ++ src/plugins/designer/designer_export.h | 2 + src/plugins/diffeditor/CMakeLists.txt | 1 - src/plugins/diffeditor/diffeditor_global.h | 2 + .../genericprojectmanager/CMakeLists.txt | 1 + src/plugins/glsleditor/CMakeLists.txt | 1 + .../languageclient/languageclient_global.h | 2 + .../mesonprojectmanager/CMakeLists.txt | 1 + src/plugins/modeleditor/CMakeLists.txt | 1 - src/plugins/modeleditor/modeleditor_global.h | 2 + .../perfprofiler/perfprofiler_global.h | 2 + .../devicesupport/idevicefactory.h | 2 +- .../qbsprojectmanager_global.h | 2 + .../qmakeprojectmanager_global.h | 2 + src/plugins/qmldesigner/CMakeLists.txt | 13 ++- .../include/qmldesignercorelib_global.h | 4 +- src/plugins/qmldesigner/dynamiclicensecheck.h | 7 +- src/plugins/qmldesigner/qmldesignercore.cmake | 8 +- .../qmlpreviewplugin/qmlpreviewactions.cpp | 14 +-- .../qmlpreviewplugin/qmlpreviewplugin.cpp | 20 ++-- .../qmlpreviewplugin/qmlpreviewplugin.h | 8 +- .../qmldesigner/studioplugin/CMakeLists.txt | 1 + src/plugins/qmljseditor/qmljseditor_global.h | 2 + src/plugins/qmljstools/qmljstools_global.h | 2 +- src/plugins/qmlpreview/qmlpreview_global.h | 2 + src/plugins/qmlprofiler/qmlprofiler_global.h | 2 + src/plugins/qmlprojectmanager/CMakeLists.txt | 1 + .../qmlprojectmanager_global.h | 2 + src/plugins/qtsupport/qtsupport_global.h | 2 + src/plugins/remotelinux/remotelinux_export.h | 2 + src/plugins/resourceeditor/CMakeLists.txt | 1 - src/plugins/resourceeditor/resource_global.h | 4 +- src/plugins/texteditor/texteditor_global.h | 2 + src/plugins/updateinfo/updateinfoplugin.cpp | 22 ++--- src/plugins/updateinfo/updateinfotools.h | 12 +-- src/plugins/vcsbase/CMakeLists.txt | 1 + src/plugins/vcsbase/vcsbase_global.h | 2 + src/shared/help/CMakeLists.txt | 2 +- src/tools/clangbackend/source/CMakeLists.txt | 3 +- src/tools/processlauncher/CMakeLists.txt | 2 +- src/tools/sdktool/CMakeLists.txt | 4 +- .../circularplugins/plugin1/plugin1.h | 2 + .../circularplugins/plugin2/plugin2.h | 2 + .../circularplugins/plugin3/plugin3.h | 2 + .../correctplugins1/plugin1/plugin1.h | 2 + .../correctplugins1/plugin2/plugin2.h | 2 + .../correctplugins1/plugin3/plugin3.h | 2 + tests/auto/updateinfo/tst_updateinfo.cpp | 2 +- tests/unit/unittest/CMakeLists.txt | 4 +- 88 files changed, 330 insertions(+), 132 deletions(-) diff --git a/cmake/FindQt5.cmake b/cmake/FindQt5.cmake index a48e293e416..b64f3bdb178 100644 --- a/cmake/FindQt5.cmake +++ b/cmake/FindQt5.cmake @@ -61,11 +61,15 @@ set(__additional_imported_components ATSPI2_nolink) # Work around QTBUG-97023 foreach(comp IN LISTS Qt5_FIND_COMPONENTS __additional_imported_components) if(TARGET Qt6::${comp}) if (NOT TARGET Qt5::${comp}) - set_property(TARGET Qt6::${comp} PROPERTY IMPORTED_GLOBAL TRUE) + if (QT_BUILD_SHARED_LIBS) + set_property(TARGET Qt6::${comp} PROPERTY IMPORTED_GLOBAL TRUE) + endif() add_library(Qt5::${comp} ALIAS Qt6::${comp}) endif() if (TARGET Qt6::${comp}Private AND NOT TARGET Qt5::${comp}Private) - set_property(TARGET Qt6::${comp}Private PROPERTY IMPORTED_GLOBAL TRUE) + if (QT_BUILD_SHARED_LIBS) + set_property(TARGET Qt6::${comp}Private PROPERTY IMPORTED_GLOBAL TRUE) + endif() add_library(Qt5::${comp}Private ALIAS Qt6::${comp}Private) endif() endif() diff --git a/cmake/Findyaml-cpp.cmake b/cmake/Findyaml-cpp.cmake index 9325e891b70..e6b65053bfe 100644 --- a/cmake/Findyaml-cpp.cmake +++ b/cmake/Findyaml-cpp.cmake @@ -22,9 +22,7 @@ else() endif() set(YAML_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../src/libs/3rdparty/yaml-cpp) add_qtc_library(yaml-cpp - DEFINES YAML_CPP_DLL yaml_cpp_EXPORTS INCLUDES ${YAML_SOURCE_DIR}/include - PUBLIC_DEFINES YAML_CPP_DLL PUBLIC_INCLUDES ${YAML_SOURCE_DIR}/include PROPERTIES AUTOMOC OFF AUTOUIC OFF SOURCES @@ -116,6 +114,12 @@ else() ${YAML_SOURCE_DIR}/src/tag.h ${YAML_SOURCE_DIR}/src/token.h ) + if (NOT QTC_STATIC_BUILD) + extend_qtc_target(yaml-cpp + DEFINES yaml_cpp_EXPORTS + PUBLIC_DEFINES YAML_CPP_DLL) + endif() + if(TARGET yaml-cpp) set(yaml-cpp_FOUND 1) set_package_properties(yaml-cpp PROPERTIES DESCRIPTION "using internal src/libs/3rdparty/yaml-cpp") diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index 63a8717dca7..722cb52a0d1 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -44,6 +44,7 @@ option(BUILD_TESTS_BY_DEFAULT "Build tests by default. This can be used to build option(QTC_SEPARATE_DEBUG_INFO "Extract debug information from binary files." OFF) option(WITH_SCCACHE_SUPPORT "Enables support for building with SCCACHE and separate debug info with MSVC, which SCCACHE normally doesn't support." OFF) option(WITH_CCACHE_SUPPORT "Enables support for building with CCACHE and separate debug info with MSVC, which CCACHE normally doesn't support." OFF) +option(QTC_STATIC_BUILD "Builds libraries and plugins as static libraries" OFF) # If we provide a list of plugins, executables, libraries, then the BUILD__BY_DEFAULT will be set to OFF # and for every element we set BUILD__ to ON @@ -157,7 +158,7 @@ function(add_qtc_library name) endif() set(library_type SHARED) - if (_arg_STATIC) + if (_arg_STATIC OR QTC_STATIC_BUILD) set(library_type STATIC) endif() if (_arg_OBJECT) @@ -168,7 +169,12 @@ function(add_qtc_library name) add_library(QtCreator::${name} ALIAS ${name}) if (${name} MATCHES "^[^0-9-]+$") - string(TOUPPER "${name}_LIBRARY" EXPORT_SYMBOL) + if (QTC_STATIC_BUILD) + set(export_symbol_suffix "STATIC_LIBRARY") + else() + set(export_symbol_suffix "LIBRARY") + endif() + string(TOUPPER "${name}_${export_symbol_suffix}" EXPORT_SYMBOL) endif() if (WITH_TESTS) @@ -185,7 +191,7 @@ function(add_qtc_library name) SOURCES ${_arg_SOURCES} INCLUDES ${_arg_INCLUDES} PUBLIC_INCLUDES ${_arg_PUBLIC_INCLUDES} - DEFINES ${EXPORT_SYMBOL} ${default_defines_copy} ${_arg_DEFINES} ${TEST_DEFINES} + DEFINES ${default_defines_copy} ${_arg_DEFINES} ${TEST_DEFINES} PUBLIC_DEFINES ${_arg_PUBLIC_DEFINES} DEPENDS ${_arg_DEPENDS} ${IMPLICIT_DEPENDS} PUBLIC_DEPENDS ${_arg_PUBLIC_DEPENDS} @@ -194,6 +200,12 @@ function(add_qtc_library name) EXTRA_TRANSLATIONS ${_arg_EXTRA_TRANSLATIONS} ) + if (QTC_STATIC_BUILD) + extend_qtc_target(${name} PUBLIC_DEFINES ${EXPORT_SYMBOL}) + else() + extend_qtc_target(${name} DEFINES ${EXPORT_SYMBOL}) + endif() + # everything is different with SOURCES_PREFIX if (NOT _arg_SOURCES_PREFIX) get_filename_component(public_build_interface_dir "${CMAKE_CURRENT_SOURCE_DIR}/.." ABSOLUTE) @@ -253,25 +265,27 @@ function(add_qtc_library name) set(COMPONENT_OPTION "COMPONENT" "${_arg_COMPONENT}") endif() - install(TARGETS ${name} - EXPORT QtCreator - RUNTIME - DESTINATION "${_DESTINATION}" - ${COMPONENT_OPTION} - OPTIONAL - LIBRARY - DESTINATION "${IDE_LIBRARY_PATH}" - ${NAMELINK_OPTION} - ${COMPONENT_OPTION} - OPTIONAL - OBJECTS - DESTINATION "${IDE_LIBRARY_PATH}" - COMPONENT Devel EXCLUDE_FROM_ALL - ARCHIVE - DESTINATION "${IDE_LIBRARY_ARCHIVE_PATH}" - COMPONENT Devel EXCLUDE_FROM_ALL - OPTIONAL - ) + if (NOT QTC_STATIC_BUILD) + install(TARGETS ${name} + EXPORT QtCreator + RUNTIME + DESTINATION "${_DESTINATION}" + ${COMPONENT_OPTION} + OPTIONAL + LIBRARY + DESTINATION "${IDE_LIBRARY_PATH}" + ${NAMELINK_OPTION} + ${COMPONENT_OPTION} + OPTIONAL + OBJECTS + DESTINATION "${IDE_LIBRARY_PATH}" + COMPONENT Devel EXCLUDE_FROM_ALL + ARCHIVE + DESTINATION "${IDE_LIBRARY_ARCHIVE_PATH}" + COMPONENT Devel EXCLUDE_FROM_ALL + OPTIONAL + ) + endif() qtc_enable_separate_debug_info(${name} "${IDE_LIBRARY_PATH}") @@ -279,7 +293,7 @@ function(add_qtc_library name) qtc_enable_sanitize(${SANITIZE_FLAGS}) endif() - if (NAMELINK_OPTION) + if (NAMELINK_OPTION AND NOT QTC_STATIC_BUILD) install(TARGETS ${name} LIBRARY DESTINATION "${IDE_LIBRARY_PATH}" @@ -298,7 +312,7 @@ endfunction(add_qtc_library) function(add_qtc_plugin target_name) cmake_parse_arguments(_arg "SKIP_INSTALL;INTERNAL_ONLY;SKIP_TRANSLATION;EXPORT;SKIP_PCH" - "VERSION;COMPAT_VERSION;PLUGIN_JSON_IN;PLUGIN_PATH;PLUGIN_NAME;OUTPUT_NAME;BUILD_DEFAULT" + "VERSION;COMPAT_VERSION;PLUGIN_JSON_IN;PLUGIN_PATH;PLUGIN_NAME;OUTPUT_NAME;BUILD_DEFAULT;PLUGIN_CLASS" "CONDITION;DEPENDS;PUBLIC_DEPENDS;DEFINES;PUBLIC_DEFINES;INCLUDES;PUBLIC_INCLUDES;SOURCES;EXPLICIT_MOC;SKIP_AUTOMOC;EXTRA_TRANSLATIONS;PLUGIN_DEPENDS;PLUGIN_RECOMMENDS;PLUGIN_TEST_DEPENDS;PROPERTIES" ${ARGN} ) @@ -421,13 +435,25 @@ function(add_qtc_plugin target_name) CONTENT "${plugin_json}") endif() - add_library(${target_name} SHARED ${_arg_SOURCES}) + if (QTC_STATIC_BUILD) + set(library_type STATIC) + else() + set(library_type SHARED) + endif() + + add_library(${target_name} ${library_type} ${_arg_SOURCES}) add_library(QtCreator::${target_name} ALIAS ${target_name}) set_public_headers(${target_name} "${_arg_SOURCES}") + update_resource_files_list("${_arg_SOURCES}") ### Generate EXPORT_SYMBOL - string(TOUPPER "${name}_LIBRARY" EXPORT_SYMBOL) + if (QTC_STATIC_BUILD) + set(export_symbol_suffix "STATIC_LIBRARY") + else() + set(export_symbol_suffix "LIBRARY") + endif() + string(TOUPPER "${name}_${export_symbol_suffix}" EXPORT_SYMBOL) if (WITH_TESTS) set(TEST_DEFINES WITH_TESTS SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") @@ -440,7 +466,7 @@ function(add_qtc_plugin target_name) extend_qtc_target(${target_name} INCLUDES ${_arg_INCLUDES} PUBLIC_INCLUDES ${_arg_PUBLIC_INCLUDES} - DEFINES ${EXPORT_SYMBOL} ${DEFAULT_DEFINES} ${_arg_DEFINES} ${TEST_DEFINES} + DEFINES ${DEFAULT_DEFINES} ${_arg_DEFINES} ${TEST_DEFINES} PUBLIC_DEFINES ${_arg_PUBLIC_DEFINES} DEPENDS ${_arg_DEPENDS} ${_DEP_PLUGINS} ${IMPLICIT_DEPENDS} PUBLIC_DEPENDS ${_arg_PUBLIC_DEPENDS} @@ -449,6 +475,13 @@ function(add_qtc_plugin target_name) EXTRA_TRANSLATIONS ${_arg_EXTRA_TRANSLATIONS} ) + if (QTC_STATIC_BUILD) + extend_qtc_target(${target_name} PUBLIC_DEFINES ${EXPORT_SYMBOL} + DEFINES QT_STATICPLUGIN) + else() + extend_qtc_target(${target_name} DEFINES ${EXPORT_SYMBOL}) + endif() + get_filename_component(public_build_interface_dir "${CMAKE_CURRENT_SOURCE_DIR}/.." ABSOLUTE) file(RELATIVE_PATH include_dir_relative_path ${PROJECT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(${target_name} @@ -471,6 +504,10 @@ function(add_qtc_plugin target_name) set(skip_translation ON) endif() + if(NOT _arg_PLUGIN_CLASS) + set(_arg_PLUGIN_CLASS ${target_name}Plugin) + endif() + qtc_output_binary_dir(_output_binary_dir) set_target_properties(${target_name} PROPERTIES LINK_DEPENDS_NO_SHARED ON @@ -490,6 +527,7 @@ function(add_qtc_plugin target_name) OUTPUT_NAME "${name}" QT_SKIP_TRANSLATION "${skip_translation}" QT_COMPILE_OPTIONS_DISABLE_WARNINGS OFF + QTC_PLUGIN_CLASS_NAME ${_arg_PLUGIN_CLASS} ${_arg_PROPERTIES} ) @@ -497,7 +535,7 @@ function(add_qtc_plugin target_name) enable_pch(${target_name}) endif() - if (NOT _arg_SKIP_INSTALL) + if (NOT _arg_SKIP_INSTALL AND NOT QTC_STATIC_BUILD) if (_arg_EXPORT) set(export QtCreator${target_name}) else() diff --git a/cmake/QtCreatorAPIInternal.cmake b/cmake/QtCreatorAPIInternal.cmake index 8d370d1b94e..5b422ff09cf 100644 --- a/cmake/QtCreatorAPIInternal.cmake +++ b/cmake/QtCreatorAPIInternal.cmake @@ -109,6 +109,7 @@ set(__QTC_PLUGINS "" CACHE INTERNAL "*** Internal ***") set(__QTC_LIBRARIES "" CACHE INTERNAL "*** Internal ***") set(__QTC_EXECUTABLES "" CACHE INTERNAL "*** Internal ***") set(__QTC_TESTS "" CACHE INTERNAL "*** Internal ***") +set(__QTC_RESOURCE_FILES "" CACHE INTERNAL "*** Internal ***") # handle SCCACHE hack # SCCACHE does not work with the /Zi option, which makes each compilation write debug info @@ -230,6 +231,16 @@ function(set_public_headers target sources) endforeach() endfunction() +function(update_resource_files_list sources) + foreach(source IN LISTS sources) + if (source MATCHES "\.qrc$") + get_filename_component(resource_name ${source} NAME_WE) + string(REPLACE "-" "_" resource_name ${resource_name}) + update_cached_list(__QTC_RESOURCE_FILES "${resource_name}") + endif() + endforeach() +endfunction() + function(set_public_includes target includes) foreach(inc_dir IN LISTS includes) if (NOT IS_ABSOLUTE ${inc_dir}) @@ -510,6 +521,7 @@ function(extend_qtc_target target_name) endif() set_public_headers(${target_name} "${_arg_SOURCES}") + update_resource_files_list("${_arg_SOURCES}") foreach(file IN LISTS _arg_EXPLICIT_MOC) set_explicit_moc(${target_name} "${file}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 70dfa9b5f6e..b567bbe120e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,8 +7,8 @@ install(TARGETS app_version EXPORT QtCreator) add_subdirectory(libs) add_subdirectory(share) add_subdirectory(shared) -add_subdirectory(app) add_subdirectory(plugins) +add_subdirectory(app) add_subdirectory(tools) install( diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index e30d9fe6abd..58fa147c516 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -35,6 +35,39 @@ if (NOT TARGET qtcreator) return() endif() +if (QTC_STATIC_BUILD) + set(plugins_to_import "") + set(source_file_content "#include \n") + foreach(plugin IN LISTS __QTC_PLUGINS) + if(TARGET ${plugin}) + list(APPEND plugins_to_import "${plugin}") + # TODO ${plugin}Plugin is not correct for all plugins as the class name + get_target_property(plugin_class ${plugin} QTC_PLUGIN_CLASS_NAME) + string(APPEND source_file_content "Q_IMPORT_PLUGIN(${plugin_class})\n") + endif() + endforeach() + + string(APPEND source_file_content + "struct ResourcesInitializer {\n" + " ResourcesInitializer() {\n") + foreach(resource_file IN LISTS __QTC_RESOURCE_FILES) + string(APPEND source_file_content " Q_INIT_RESOURCE(${resource_file});\n") + endforeach() + string(APPEND source_file_content + " }\n" + "} g_resources_initializer;\n") + + file(GENERATE + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/plugin_imports.cpp" + CONTENT "${source_file_content}" + ) + extend_qtc_target(qtcreator + DEPENDS ${plugins_to_import} + SOURCES "${CMAKE_CURRENT_BINARY_DIR}/plugin_imports.cpp" + ) + +endif() + if (WIN32) set(RC_APPLICATION_NAME "${IDE_DISPLAY_NAME}") set(RC_VERSION "${IDE_VERSION}.0") diff --git a/src/libs/3rdparty/cplusplus/CMakeLists.txt b/src/libs/3rdparty/cplusplus/CMakeLists.txt index f2515c9c3a0..41c653aa48e 100644 --- a/src/libs/3rdparty/cplusplus/CMakeLists.txt +++ b/src/libs/3rdparty/cplusplus/CMakeLists.txt @@ -1,6 +1,5 @@ add_qtc_library(3rd_cplusplus OBJECT PUBLIC_DEPENDS Qt5::Core Utils - DEFINES CPLUSPLUS_BUILD_LIB SOURCES AST.cpp AST.h ASTClone.cpp @@ -45,6 +44,12 @@ add_qtc_library(3rd_cplusplus OBJECT PROPERTIES POSITION_INDEPENDENT_CODE ON ) +set(export_symbol_declaration DEFINES CPLUSPLUS_BUILD_LIB) +if (QTC_STATIC_BUILD) + set(export_symbol_declaration PUBLIC_DEFINES CPLUSPLUS_BUILD_STATIC_LIB) +endif() +extend_qtc_target(3rd_cplusplus ${export_symbol_declaration}) + if(TARGET 3rd_cplusplus) qtc_enable_release_for_debug_configuration() if (BUILD_WITH_PCH) diff --git a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt index 4d352af3d65..34c371c168e 100644 --- a/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt +++ b/src/libs/3rdparty/syntax-highlighting/CMakeLists.txt @@ -4,13 +4,12 @@ else() set(HIGHLIGHTING_BUILD_DEFAULT ON) endif() -add_qtc_library(KSyntaxHighlighting SHARED +add_qtc_library(KSyntaxHighlighting BUILD_DEFAULT ${HIGHLIGHTING_BUILD_DEFAULT} INCLUDES autogenerated/ PUBLIC_INCLUDES src/lib autogenerated/src/lib - DEFINES KF5SyntaxHighlighting_EXPORTS DEPENDS Qt5::Network Qt5::Widgets SOURCES autogenerated/src/lib/ksyntaxhighlighting_logging.cpp autogenerated/src/lib/ksyntaxhighlighting_logging.h @@ -43,6 +42,13 @@ add_qtc_library(KSyntaxHighlighting SHARED src/lib/worddelimiters.cpp src/lib/worddelimiters_p.h src/lib/xml_p.h ) + +set(export_symbol_declaration DEFINES KF5SyntaxHighlighting_EXPORTS) +if (QTC_STATIC_BUILD) + set(export_symbol_declaration PUBLIC_DEFINES KSYNTAXHIGHLIGHTING_STATIC_DEFINE) +endif() +extend_qtc_target(KSyntaxHighlighting ${export_symbol_declaration}) + qtc_add_public_header(autogenerated/src/lib/State) if(TARGET KSyntaxHighlighting) diff --git a/src/libs/CMakeLists.txt b/src/libs/CMakeLists.txt index b4ef8af90cd..f8d02ba1f9b 100644 --- a/src/libs/CMakeLists.txt +++ b/src/libs/CMakeLists.txt @@ -24,13 +24,17 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/qlitehtml/src/CMakeLists.txt) option(BUILD_LIBRARY_QLITEHTML "Build library qlitehtml." ${BUILD_LIBRARIES_BY_DEFAULT}) set(QLITEHTML_VERSION_COMPAT ${IDE_VERSION_COMPAT} CACHE STRING "") if(BUILD_LIBRARY_QLITEHTML) - set(QLITEHTML_BIN_PATH ${IDE_BIN_PATH}) - set(QLITEHTML_LIBRARY_PATH ${IDE_LIBRARY_PATH}) set(QLITEHTML_LIBRARY_ARCHIVE_PATH ${IDE_LIBRARY_ARCHIVE_PATH}) set(QLITEHTML_EXPORT QtCreator) set(QLITEHTML_DEVEL_COMPONENT Devel) set(QLITEHTML_DEVEL_EXCLUDE_FROM_ALL ON) set(QLITEHTML_HEADER_PATH "${IDE_HEADER_INSTALL_PATH}/src/lib/qlitehtml") + if (QTC_STATIC_BUILD) + set(QLITEHTML_LIBRARY_TYPE STATIC) + else() + set(QLITEHTML_BIN_PATH ${IDE_BIN_PATH}) + set(QLITEHTML_LIBRARY_PATH ${IDE_LIBRARY_PATH}) + endif() set(QT_VERSION_MAJOR ${Qt5_VERSION_MAJOR}) option(BUILD_TESTING "Build litehtml tests" OFF) # otherwise litehtml downloads googletest add_subdirectory(qlitehtml/src) diff --git a/src/libs/advanceddockingsystem/ads_globals.h b/src/libs/advanceddockingsystem/ads_globals.h index 0de0b4c20c9..19b89155568 100644 --- a/src/libs/advanceddockingsystem/ads_globals.h +++ b/src/libs/advanceddockingsystem/ads_globals.h @@ -47,14 +47,12 @@ class QAbstractButton; class QSplitter; QT_END_NAMESPACE -#ifndef ADS_STATIC -#ifdef ADVANCEDDOCKINGSYSTEM_LIBRARY -#define ADS_EXPORT Q_DECL_EXPORT +#if defined(ADVANCEDDOCKINGSYSTEM_LIBRARY) +# define ADS_EXPORT Q_DECL_EXPORT +#elif defined(ADVANCEDDOCKINGSYSTEM_STATIC_LIBRARY) +# define ADS_EXPORT #else -#define ADS_EXPORT Q_DECL_IMPORT -#endif -#else -#define ADS_EXPORT +# define ADS_EXPORT Q_DECL_IMPORT #endif //#define ADS_DEBUG_PRINT diff --git a/src/libs/aggregation/aggregation_global.h b/src/libs/aggregation/aggregation_global.h index e91129202ab..c8eca8e71cb 100644 --- a/src/libs/aggregation/aggregation_global.h +++ b/src/libs/aggregation/aggregation_global.h @@ -29,6 +29,8 @@ #if defined(AGGREGATION_LIBRARY) # define AGGREGATION_EXPORT Q_DECL_EXPORT +#elif defined(AGGREGATION_STATIC_LIBRARY) +# define AGGREGATION_EXPORT #else # define AGGREGATION_EXPORT Q_DECL_IMPORT #endif diff --git a/src/libs/clangsupport/CMakeLists.txt b/src/libs/clangsupport/CMakeLists.txt index aa3c0ec3da2..41b42ca2d03 100644 --- a/src/libs/clangsupport/CMakeLists.txt +++ b/src/libs/clangsupport/CMakeLists.txt @@ -7,7 +7,6 @@ add_qtc_library(ClangSupport CLANG_VERSION="${CLANG_VERSION}" CLANG_INCLUDE_DIR="${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}/include" CLANG_BINDIR="${LLVM_TOOLS_BINARY_DIR}" - DEFINES CLANGSUPPORT_BUILD_LIB PUBLIC_INCLUDES "${CMAKE_CURRENT_LIST_DIR}" SOURCES diff --git a/src/libs/clangsupport/clangsupport_global.h b/src/libs/clangsupport/clangsupport_global.h index f8428e8ecf1..db94b896133 100644 --- a/src/libs/clangsupport/clangsupport_global.h +++ b/src/libs/clangsupport/clangsupport_global.h @@ -31,9 +31,9 @@ #include -#if defined(CLANGSUPPORT_BUILD_LIB) +#if defined(CLANGSUPPORT_LIBRARY) # define CLANGSUPPORT_EXPORT Q_DECL_EXPORT -#elif defined(CLANGSUPPORT_BUILD_STATIC_LIB) +#elif defined(CLANGSUPPORT_STATIC_LIBRARY) # define CLANGSUPPORT_EXPORT #else # define CLANGSUPPORT_EXPORT Q_DECL_IMPORT diff --git a/src/libs/cplusplus/CMakeLists.txt b/src/libs/cplusplus/CMakeLists.txt index aa650c11b34..76cbcbde141 100644 --- a/src/libs/cplusplus/CMakeLists.txt +++ b/src/libs/cplusplus/CMakeLists.txt @@ -1,10 +1,7 @@ -# TODO: Support static build, currently being done with CPLUSPLUS_BUILD_STATIC_LIB -# -- if really needed that is. # TODO: Make Qt5::Gui optional -- if really needed that is. add_qtc_library(CPlusPlus DEPENDS Utils Qt5::Concurrent - DEFINES CPLUSPLUS_BUILD_LIB PUBLIC_DEPENDS 3rd_cplusplus Qt5::Gui SOURCES ASTParent.cpp ASTParent.h @@ -43,6 +40,12 @@ add_qtc_library(CPlusPlus SKIP_PCH ) +set(export_symbol_declaration DEFINES CPLUSPLUS_BUILD_LIB) +if (QTC_STATIC_BUILD) + set(export_symbol_declaration PUBLIC_DEFINES CPLUSPLUS_BUILD_STATIC_LIB) +endif() +extend_qtc_target(CPlusPlus ${export_symbol_declaration}) + if(TARGET CPlusPlus) qtc_enable_release_for_debug_configuration() if (BUILD_WITH_PCH) diff --git a/src/libs/extensionsystem/extensionsystem_global.h b/src/libs/extensionsystem/extensionsystem_global.h index 2cc8add8c59..59dbe629875 100644 --- a/src/libs/extensionsystem/extensionsystem_global.h +++ b/src/libs/extensionsystem/extensionsystem_global.h @@ -30,6 +30,8 @@ #if defined(EXTENSIONSYSTEM_LIBRARY) # define EXTENSIONSYSTEM_EXPORT Q_DECL_EXPORT +#elif defined(EXTENSIONSYSTEM_STATIC_LIBRARY) +# define EXTENSIONSYSTEM_EXPORT #else # define EXTENSIONSYSTEM_EXPORT Q_DECL_IMPORT #endif diff --git a/src/libs/glsl/glsl.h b/src/libs/glsl/glsl.h index fec9a10a83f..895ccc96b49 100644 --- a/src/libs/glsl/glsl.h +++ b/src/libs/glsl/glsl.h @@ -31,7 +31,7 @@ #if defined(GLSL_LIBRARY) # define GLSL_EXPORT Q_DECL_EXPORT -#elif defined(GLSL_BUILD_STATIC_LIB) +#elif defined(GLSL_STATIC_LIBRARY) # define GLSL_EXPORT #else # define GLSL_EXPORT Q_DECL_IMPORT diff --git a/src/libs/languageserverprotocol/languageserverprotocol_global.h b/src/libs/languageserverprotocol/languageserverprotocol_global.h index 83e070f8c28..77f22570403 100644 --- a/src/libs/languageserverprotocol/languageserverprotocol_global.h +++ b/src/libs/languageserverprotocol/languageserverprotocol_global.h @@ -29,6 +29,8 @@ #if defined(LANGUAGESERVERPROTOCOL_LIBRARY) # define LANGUAGESERVERPROTOCOL_EXPORT Q_DECL_EXPORT +#elif defined(LANGUAGESERVERPROTOCOL_STATIC_LIBRARY) +# define LANGUAGESERVERPROTOCOL_EXPORT #else # define LANGUAGESERVERPROTOCOL_EXPORT Q_DECL_IMPORT #endif diff --git a/src/libs/languageutils/languageutils_global.h b/src/libs/languageutils/languageutils_global.h index ddcf53d4941..b2d65f80d42 100644 --- a/src/libs/languageutils/languageutils_global.h +++ b/src/libs/languageutils/languageutils_global.h @@ -29,7 +29,7 @@ #if defined(LANGUAGEUTILS_LIBRARY) # define LANGUAGEUTILS_EXPORT Q_DECL_EXPORT -#elif defined(LANGUAGEUTILS_BUILD_STATIC_LIB) +#elif defined(LANGUAGEUTILS_STATIC_LIBRARY) # define LANGUAGEUTILS_EXPORT #else # define LANGUAGEUTILS_EXPORT Q_DECL_IMPORT diff --git a/src/libs/modelinglib/CMakeLists.txt b/src/libs/modelinglib/CMakeLists.txt index db79b99ee33..fcead64fd01 100644 --- a/src/libs/modelinglib/CMakeLists.txt +++ b/src/libs/modelinglib/CMakeLists.txt @@ -1,5 +1,4 @@ add_qtc_library(Modeling - DEFINES MODELING_LIBRARY DEPENDS Qt5::Widgets Utils PUBLIC_DEPENDS OptionalSvg INCLUDES qtserialization/inc diff --git a/src/libs/modelinglib/qmt/infrastructure/qmt_global.h b/src/libs/modelinglib/qmt/infrastructure/qmt_global.h index e01c0b87c63..670deaeac57 100644 --- a/src/libs/modelinglib/qmt/infrastructure/qmt_global.h +++ b/src/libs/modelinglib/qmt/infrastructure/qmt_global.h @@ -29,6 +29,8 @@ #if defined(MODELING_LIBRARY) # define QMT_EXPORT Q_DECL_EXPORT +#elif defined(MODELING_STATIC_LIBRARY) +# define QMT_EXPORT #else # define QMT_EXPORT Q_DECL_IMPORT #endif diff --git a/src/libs/qmldebug/qmldebug_global.h b/src/libs/qmldebug/qmldebug_global.h index 16199d9f685..d69cd337929 100644 --- a/src/libs/qmldebug/qmldebug_global.h +++ b/src/libs/qmldebug/qmldebug_global.h @@ -27,7 +27,7 @@ #if defined(QMLDEBUG_LIBRARY) # define QMLDEBUG_EXPORT Q_DECL_EXPORT -#elif defined(QMLDEBUG_STATIC_LIB) +#elif defined(QMLDEBUG_STATIC_LIBRARY) # define QMLDEBUG_EXPORT #else # define QMLDEBUG_EXPORT Q_DECL_IMPORT diff --git a/src/libs/qmleditorwidgets/qmleditorwidgets_global.h b/src/libs/qmleditorwidgets/qmleditorwidgets_global.h index 9c2320afc74..613d582499c 100644 --- a/src/libs/qmleditorwidgets/qmleditorwidgets_global.h +++ b/src/libs/qmleditorwidgets/qmleditorwidgets_global.h @@ -29,7 +29,7 @@ # if defined(QMLEDITORWIDGETS_LIBRARY) # define QMLEDITORWIDGETS_EXPORT Q_DECL_EXPORT -# elif defined(BUILD_QMLJSDEBUGGER_STATIC_LIB) +# elif defined(QMLEDITORWIDGETS_STATIC_LIBRARY) # define QMLEDITORWIDGETS_EXPORT # else # define QMLEDITORWIDGETS_EXPORT Q_DECL_IMPORT diff --git a/src/libs/qmljs/parser/qmljsglobal_p.h b/src/libs/qmljs/parser/qmljsglobal_p.h index f2b0da9d74a..1b6e7181a90 100644 --- a/src/libs/qmljs/parser/qmljsglobal_p.h +++ b/src/libs/qmljs/parser/qmljsglobal_p.h @@ -44,7 +44,7 @@ # ifdef QMLJS_LIBRARY # define QML_PARSER_EXPORT Q_DECL_EXPORT -# elif QML_BUILD_STATIC_LIB +# elif QMLJS_STATIC_LIBRARY # define QML_PARSER_EXPORT # else # define QML_PARSER_EXPORT Q_DECL_IMPORT diff --git a/src/libs/qmljs/qmljs_global.h b/src/libs/qmljs/qmljs_global.h index 3e5b3617ab1..cf23791649b 100644 --- a/src/libs/qmljs/qmljs_global.h +++ b/src/libs/qmljs/qmljs_global.h @@ -29,7 +29,7 @@ #if defined(QMLJS_LIBRARY) # define QMLJS_EXPORT Q_DECL_EXPORT -#elif defined(QML_BUILD_STATIC_LIB) +#elif defined(QMLJS_STATIC_LIBRARY) # define QMLJS_EXPORT #else # define QMLJS_EXPORT Q_DECL_IMPORT diff --git a/src/libs/sqlite/CMakeLists.txt b/src/libs/sqlite/CMakeLists.txt index 236d35b4c96..07d8aa3299b 100644 --- a/src/libs/sqlite/CMakeLists.txt +++ b/src/libs/sqlite/CMakeLists.txt @@ -1,7 +1,6 @@ add_qtc_library(Sqlite PROPERTIES AUTOMOC OFF AUTOUIC OFF PUBLIC_DEFINES - BUILD_SQLITE_LIBRARY SQLITE_CORE DEPENDS Qt5::Core Threads::Threads ${CMAKE_DL_LIBS} PUBLIC_INCLUDES @@ -45,7 +44,7 @@ add_qtc_library(Sqlite extend_qtc_library(Sqlite DEFINES SQLITE_CUSTOM_INCLUDE=config.h) if (APPLE) -extend_qtc_library(Sqlite DEFINES _BSD_SOURCE) + extend_qtc_library(Sqlite DEFINES _BSD_SOURCE) elseif (UNIX) -extend_qtc_library(Sqlite DEFINES _POSIX_C_SOURCE=200809L _GNU_SOURCE _DEFAULT_SOURCE) + extend_qtc_library(Sqlite DEFINES _POSIX_C_SOURCE=200809L _GNU_SOURCE _DEFAULT_SOURCE) endif() diff --git a/src/libs/sqlite/sqliteglobal.h b/src/libs/sqlite/sqliteglobal.h index f8a13e0a972..a2586d671eb 100644 --- a/src/libs/sqlite/sqliteglobal.h +++ b/src/libs/sqlite/sqliteglobal.h @@ -29,9 +29,9 @@ #include -#if defined(BUILD_SQLITE_LIBRARY) +#if defined(SQLITE_LIBRARY) # define SQLITE_EXPORT Q_DECL_EXPORT -#elif defined(BUILD_SQLITE_STATIC_LIBRARY) +#elif defined(SQLITE_STATIC_LIBRARY) # define SQLITE_EXPORT #else # define SQLITE_EXPORT Q_DECL_IMPORT diff --git a/src/libs/ssh/ssh_global.h b/src/libs/ssh/ssh_global.h index 437fb67f148..0449e664e7e 100644 --- a/src/libs/ssh/ssh_global.h +++ b/src/libs/ssh/ssh_global.h @@ -29,6 +29,8 @@ #if defined(QTCSSH_LIBRARY) # define QSSH_EXPORT Q_DECL_EXPORT +#elif defined(QTCSSH_STATIC_LIBRARY) +# define QSSH_EXPORT #else # define QSSH_EXPORT Q_DECL_IMPORT #endif diff --git a/src/libs/tracing/tracing_global.h b/src/libs/tracing/tracing_global.h index 4ec75d81ee9..e1fb3472ed7 100644 --- a/src/libs/tracing/tracing_global.h +++ b/src/libs/tracing/tracing_global.h @@ -29,6 +29,8 @@ #if defined(TRACING_LIBRARY) # define TRACING_EXPORT Q_DECL_EXPORT +#elif defined(TRACING_STATIC_LIBRARY) +# define TRACING_EXPORT #else # define TRACING_EXPORT Q_DECL_IMPORT #endif diff --git a/src/libs/utils/filesearch.cpp b/src/libs/utils/filesearch.cpp index 4be8ef209f2..b686105ec8f 100644 --- a/src/libs/utils/filesearch.cpp +++ b/src/libs/utils/filesearch.cpp @@ -39,7 +39,7 @@ #include -Q_LOGGING_CATEGORY(log, "qtc.utils.filesearch", QtWarningMsg) +Q_LOGGING_CATEGORY(searchLog, "qtc.utils.filesearch", QtWarningMsg) using namespace Utils; @@ -143,13 +143,13 @@ void FileSearch::operator()(QFutureInterface &futureInterf { if (futureInterface.isCanceled()) return; - qCDebug(log) << "Searching in" << item.filePath; + qCDebug(searchLog) << "Searching in" << item.filePath; futureInterface.setProgressRange(0, 1); futureInterface.setProgressValue(0); FileSearchResultList results; QString tempString; if (!getFileContent(item.filePath, item.encoding, &tempString, fileToContentsMap)) { - qCDebug(log) << "- failed to get content for" << item.filePath; + qCDebug(searchLog) << "- failed to get content for" << item.filePath; futureInterface.cancel(); // failure return; } @@ -227,7 +227,7 @@ void FileSearch::operator()(QFutureInterface &futureInterf futureInterface.reportResult(results); futureInterface.setProgressValue(1); } - qCDebug(log) << "- finished searching in" << item.filePath; + qCDebug(searchLog) << "- finished searching in" << item.filePath; } FileSearchRegExp::FileSearchRegExp(const QString &searchTerm, QTextDocument::FindFlags flags, @@ -263,13 +263,13 @@ void FileSearchRegExp::operator()(QFutureInterface &future } if (futureInterface.isCanceled()) return; - qCDebug(log) << "Searching in" << item.filePath; + qCDebug(searchLog) << "Searching in" << item.filePath; futureInterface.setProgressRange(0, 1); futureInterface.setProgressValue(0); FileSearchResultList results; QString tempString; if (!getFileContent(item.filePath, item.encoding, &tempString, fileToContentsMap)) { - qCDebug(log) << "- failed to get content for" << item.filePath; + qCDebug(searchLog) << "- failed to get content for" << item.filePath; futureInterface.cancel(); // failure return; } @@ -304,7 +304,7 @@ void FileSearchRegExp::operator()(QFutureInterface &future futureInterface.reportResult(results); futureInterface.setProgressValue(1); } - qCDebug(log) << "- finished searching in" << item.filePath; + qCDebug(searchLog) << "- finished searching in" << item.filePath; } struct SearchState diff --git a/src/libs/utils/utils_global.h b/src/libs/utils/utils_global.h index ae30640217d..4bd21326568 100644 --- a/src/libs/utils/utils_global.h +++ b/src/libs/utils/utils_global.h @@ -29,7 +29,7 @@ #if defined(UTILS_LIBRARY) # define QTCREATOR_UTILS_EXPORT Q_DECL_EXPORT -#elif defined(QTCREATOR_UTILS_STATIC_LIB) // Abuse single files for manual tests +#elif defined(UTILS_STATIC_LIBRARY) // Abuse single files for manual tests # define QTCREATOR_UTILS_EXPORT #else # define QTCREATOR_UTILS_EXPORT Q_DECL_IMPORT diff --git a/src/plugins/android/android_global.h b/src/plugins/android/android_global.h index 1f79d86ebc1..eaf24f88076 100644 --- a/src/plugins/android/android_global.h +++ b/src/plugins/android/android_global.h @@ -29,6 +29,8 @@ #if defined(ANDROID_LIBRARY) # define ANDROID_EXPORT Q_DECL_EXPORT +#elif defined(ANDROID_STATIC_LIBRARY) +# define ANDROID_EXPORT #else # define ANDROID_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/autotest/CMakeLists.txt b/src/plugins/autotest/CMakeLists.txt index 881b5d2bc85..f2e468f177c 100644 --- a/src/plugins/autotest/CMakeLists.txt +++ b/src/plugins/autotest/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(AutoTest + PLUGIN_CLASS AutotestPlugin PLUGIN_DEPENDS Core CppEditor Debugger ProjectExplorer QmlJSTools TextEditor PLUGIN_TEST_DEPENDS QmakeProjectManager QtSupport QbsProjectManager SOURCES diff --git a/src/plugins/autotest/autotest_global.h b/src/plugins/autotest/autotest_global.h index c485ad21851..dfa0e6292d4 100644 --- a/src/plugins/autotest/autotest_global.h +++ b/src/plugins/autotest/autotest_global.h @@ -29,6 +29,8 @@ #if defined(AUTOTEST_LIBRARY) # define AUTOTESTSHARED_EXPORT Q_DECL_EXPORT +#elif defined(AUTOTEST_STATIC_LIBRARY) +# define AUTOTESTSHARED_EXPORT #else # define AUTOTESTSHARED_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/autotoolsprojectmanager/CMakeLists.txt b/src/plugins/autotoolsprojectmanager/CMakeLists.txt index 9567ec861a0..64446adc3a2 100644 --- a/src/plugins/autotoolsprojectmanager/CMakeLists.txt +++ b/src/plugins/autotoolsprojectmanager/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(AutotoolsProjectManager + PLUGIN_CLASS AutotoolsProjectPlugin PLUGIN_DEPENDS Core CppEditor ProjectExplorer QtSupport SOURCES autogenstep.cpp autogenstep.h diff --git a/src/plugins/boot2qt/CMakeLists.txt b/src/plugins/boot2qt/CMakeLists.txt index d11cd580f9e..e7915322fd2 100644 --- a/src/plugins/boot2qt/CMakeLists.txt +++ b/src/plugins/boot2qt/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(Boot2Qt + PLUGIN_CLASS QdbPlugin DEPENDS Qt5::Network QtcSsh PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport RemoteLinux SOURCES diff --git a/src/plugins/cmakeprojectmanager/CMakeLists.txt b/src/plugins/cmakeprojectmanager/CMakeLists.txt index ce6b8f8ce1e..848411a761f 100644 --- a/src/plugins/cmakeprojectmanager/CMakeLists.txt +++ b/src/plugins/cmakeprojectmanager/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(CMakeProjectManager + PLUGIN_CLASS CMakeProjectPlugin DEPENDS QmlJS PLUGIN_DEPENDS Core CppEditor ProjectExplorer TextEditor QtSupport SOURCES diff --git a/src/plugins/cmakeprojectmanager/cmake_global.h b/src/plugins/cmakeprojectmanager/cmake_global.h index 59945a2977d..0406e4d07a2 100644 --- a/src/plugins/cmakeprojectmanager/cmake_global.h +++ b/src/plugins/cmakeprojectmanager/cmake_global.h @@ -29,6 +29,8 @@ #if defined(CMAKEPROJECTMANAGER_LIBRARY) # define CMAKE_EXPORT Q_DECL_EXPORT +#elif defined(CMAKEPROJECTMANAGER_STATIC_LIBRARY) +# define CMAKE_EXPORT #else # define CMAKE_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/cppeditor/CMakeLists.txt b/src/plugins/cppeditor/CMakeLists.txt index a5b0f7ff534..7a4d9d68038 100644 --- a/src/plugins/cppeditor/CMakeLists.txt +++ b/src/plugins/cppeditor/CMakeLists.txt @@ -1,5 +1,4 @@ add_qtc_plugin(CppEditor - DEFINES CPPEDITOR_LIBRARY DEPENDS Qt5::Network Qt5::Xml PUBLIC_DEPENDS CPlusPlus ClangSupport Qt5::Widgets PLUGIN_DEPENDS Core ProjectExplorer TextEditor diff --git a/src/plugins/cvs/CMakeLists.txt b/src/plugins/cvs/CMakeLists.txt index 2612f9a795a..47c91f8a720 100644 --- a/src/plugins/cvs/CMakeLists.txt +++ b/src/plugins/cvs/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(CVS + PLUGIN_CLASS CvsPlugin PLUGIN_DEPENDS Core TextEditor VcsBase SOURCES annotationhighlighter.cpp annotationhighlighter.h diff --git a/src/plugins/designer/CMakeLists.txt b/src/plugins/designer/CMakeLists.txt index 39c0c1d59ff..39f72105f3e 100644 --- a/src/plugins/designer/CMakeLists.txt +++ b/src/plugins/designer/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(Designer + PLUGIN_CLASS FormEditorPlugin CONDITION TARGET Qt5::DesignerComponents AND TARGET Qt5::Designer DEPENDS designerintegrationv2 Qt5::Designer Qt5::PrintSupport Qt5::DesignerComponents @@ -35,3 +36,10 @@ extend_qtc_plugin(Designer CONDITION WITH_TESTS AND TARGET Qt5::DesignerComponents AND TARGET Qt5::Designer SOURCES gotoslot_test.cpp ) + +if (QTC_STATIC_BUILD) + get_target_property(_designerType Qt5::Designer TYPE) + if (${_designerType} STREQUAL "STATIC_LIBRARY") + extend_qtc_target(Designer PUBLIC_DEFINES QT_DESIGNER_STATIC) + endif() +endif() diff --git a/src/plugins/designer/designer_export.h b/src/plugins/designer/designer_export.h index 000e6c6130c..a601f557abc 100644 --- a/src/plugins/designer/designer_export.h +++ b/src/plugins/designer/designer_export.h @@ -29,6 +29,8 @@ #if defined(DESIGNER_LIBRARY) # define DESIGNER_EXPORT Q_DECL_EXPORT +#elif defined(DESIGNER_STATIC_LIBRARY) +# define DESIGNER_EXPORT #else # define DESIGNER_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/diffeditor/CMakeLists.txt b/src/plugins/diffeditor/CMakeLists.txt index f5fbb9630cc..695d7d1555d 100644 --- a/src/plugins/diffeditor/CMakeLists.txt +++ b/src/plugins/diffeditor/CMakeLists.txt @@ -1,6 +1,5 @@ add_qtc_plugin(DiffEditor PLUGIN_DEPENDS Core TextEditor - DEFINES DIFFEDITOR_LIBRARY SOURCES descriptionwidgetwatcher.cpp descriptionwidgetwatcher.h diffeditor.cpp diffeditor.h diff --git a/src/plugins/diffeditor/diffeditor_global.h b/src/plugins/diffeditor/diffeditor_global.h index 763096abbf5..626762629b3 100644 --- a/src/plugins/diffeditor/diffeditor_global.h +++ b/src/plugins/diffeditor/diffeditor_global.h @@ -29,6 +29,8 @@ #if defined(DIFFEDITOR_LIBRARY) # define DIFFEDITOR_EXPORT Q_DECL_EXPORT +#elif defined(DIFFEDITOR_STATIC_LIBRARY) +# define DIFFEDITOR_EXPORT #else # define DIFFEDITOR_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/genericprojectmanager/CMakeLists.txt b/src/plugins/genericprojectmanager/CMakeLists.txt index 9aafbb82fdb..5b1ef6f84e4 100644 --- a/src/plugins/genericprojectmanager/CMakeLists.txt +++ b/src/plugins/genericprojectmanager/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(GenericProjectManager + PLUGIN_CLASS GenericProjectPlugin PLUGIN_DEPENDS Core ProjectExplorer QtSupport TextEditor PLUGIN_TEST_DEPENDS CppEditor PLUGIN_RECOMMENDS CppEditor diff --git a/src/plugins/glsleditor/CMakeLists.txt b/src/plugins/glsleditor/CMakeLists.txt index a688988295d..85cbe99986f 100644 --- a/src/plugins/glsleditor/CMakeLists.txt +++ b/src/plugins/glsleditor/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(GLSLEditor + PLUGIN_CLASS GlslEditorPlugin DEPENDS GLSL PLUGIN_DEPENDS Core CppEditor TextEditor SOURCES diff --git a/src/plugins/languageclient/languageclient_global.h b/src/plugins/languageclient/languageclient_global.h index 37556715372..343ed48185e 100644 --- a/src/plugins/languageclient/languageclient_global.h +++ b/src/plugins/languageclient/languageclient_global.h @@ -29,6 +29,8 @@ #if defined(LANGUAGECLIENT_LIBRARY) # define LANGUAGECLIENT_EXPORT Q_DECL_EXPORT +#elif defined(LANGUAGECLIENT_STATIC_LIBRARY) +# define LANGUAGECLIENT_EXPORT #else # define LANGUAGECLIENT_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/mesonprojectmanager/CMakeLists.txt b/src/plugins/mesonprojectmanager/CMakeLists.txt index 5486bd44773..4fd43d672af 100644 --- a/src/plugins/mesonprojectmanager/CMakeLists.txt +++ b/src/plugins/mesonprojectmanager/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(MesonProjectManager + PLUGIN_CLASS MesonProjectPlugin DEPENDS QmlJS PLUGIN_DEPENDS Core CppEditor ProjectExplorer TextEditor QtSupport SOURCES diff --git a/src/plugins/modeleditor/CMakeLists.txt b/src/plugins/modeleditor/CMakeLists.txt index df35e771464..2667c790430 100644 --- a/src/plugins/modeleditor/CMakeLists.txt +++ b/src/plugins/modeleditor/CMakeLists.txt @@ -1,5 +1,4 @@ add_qtc_plugin(ModelEditor - DEFINES MODELEDITOR_LIBRARY DEPENDS Modeling Qt5::Core Qt5::Gui Qt5::Widgets PLUGIN_DEPENDS Core CppEditor ProjectExplorer SOURCES diff --git a/src/plugins/modeleditor/modeleditor_global.h b/src/plugins/modeleditor/modeleditor_global.h index 0327c570e36..5fdca6f4040 100644 --- a/src/plugins/modeleditor/modeleditor_global.h +++ b/src/plugins/modeleditor/modeleditor_global.h @@ -29,6 +29,8 @@ #if defined(MODELEDITOR_LIBRARY) # define MODELEDITOR_EXPORT Q_DECL_EXPORT +#elif defined(MODELEDITOR_STATIC_LIBRARY) +# define MODELEDITOR_EXPORT #else # define MODELEDITOR_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/perfprofiler/perfprofiler_global.h b/src/plugins/perfprofiler/perfprofiler_global.h index 9f12da9189a..74f3557449d 100644 --- a/src/plugins/perfprofiler/perfprofiler_global.h +++ b/src/plugins/perfprofiler/perfprofiler_global.h @@ -29,6 +29,8 @@ #if defined(PERFPROFILER_LIBRARY) # define PERFPROFILER_EXPORT Q_DECL_EXPORT +#elif defined(PERFPROFILER_STATIC_LIBRARY) +# define PERFPROFILER_EXPORT #else # define PERFPROFILER_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/projectexplorer/devicesupport/idevicefactory.h b/src/plugins/projectexplorer/devicesupport/idevicefactory.h index f0265074e70..1d2e07e8480 100644 --- a/src/plugins/projectexplorer/devicesupport/idevicefactory.h +++ b/src/plugins/projectexplorer/devicesupport/idevicefactory.h @@ -60,7 +60,7 @@ protected: void setDisplayName(const QString &displayName); void setIcon(const QIcon &icon); - void setCombinedIcon(const Utils::FilePath &small, const Utils::FilePath &large); + void setCombinedIcon(const Utils::FilePath &smallIcon, const Utils::FilePath &largeIcon); void setConstructionFunction(const std::function &constructor); void setCreator(const std::function &creator); diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager_global.h b/src/plugins/qbsprojectmanager/qbsprojectmanager_global.h index 7b53f201e3d..607a1ef255c 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager_global.h +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager_global.h @@ -29,6 +29,8 @@ #if defined(QBSPROJECTMANAGER_LIBRARY) # define QBSPROJECTMANAGER_EXPORT Q_DECL_EXPORT +#elif defined(QBSPROJECTMANAGER_STATIC_LIBRARY) +# define QBSPROJECTMANAGER_EXPORT #else # define QBSPROJECTMANAGER_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager_global.h b/src/plugins/qmakeprojectmanager/qmakeprojectmanager_global.h index 7dee97cb25f..d5d64f69f71 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager_global.h +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager_global.h @@ -29,6 +29,8 @@ #if defined(QMAKEPROJECTMANAGER_LIBRARY) # define QMAKEPROJECTMANAGER_EXPORT Q_DECL_EXPORT +#elif defined(QMAKEPROJECTMANAGER_STATIC_LIBRARY) +# define QMAKEPROJECTMANAGER_EXPORT #else # define QMAKEPROJECTMANAGER_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 2a2c2314ba8..e208c7a3d9e 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -9,7 +9,6 @@ add_qtc_plugin(QmlDesigner QmlJS LanguageUtils QmlEditorWidgets AdvancedDockingSystem Qt5::QuickWidgets Qt5::CorePrivate Sqlite Qt5::Xml Qt5::Svg DEFINES - DESIGNER_CORE_LIBRARY IDE_LIBRARY_BASENAME=\"${IDE_LIBRARY_BASE_PATH}\" SHARE_QML_PATH="${CMAKE_CURRENT_SOURCE_DIR}/../../../share/qtcreator/qmldesigner" PUBLIC_INCLUDES @@ -59,7 +58,16 @@ add_qtc_plugin(QmlDesigner include(qmldesignercore.cmake) extend_with_qmldesigner_core(QmlDesigner) +if (QTC_STATIC_BUILD) + get_target_property(_designerType Qt5::Designer TYPE) + if (${_designerType} STREQUAL "STATIC_LIBRARY") + extend_qtc_target(QmlDesigner PUBLIC_DEFINES QT_DESIGNER_STATIC) + endif() + extend_qtc_target(QmlDesigner PUBLIC_DEPENDS TextEditor) +endif() + add_qtc_plugin(assetexporterplugin + PLUGIN_CLASS AssetExporterPlugin CONDITION TARGET QmlDesigner DEPENDS Core ProjectExplorer QmlDesigner Utils Qt5::Qml Qt5::QuickPrivate PUBLIC_INCLUDES assetexporterplugin @@ -81,6 +89,7 @@ add_qtc_plugin(assetexporterplugin ) add_qtc_plugin(componentsplugin + PLUGIN_CLASS ComponentsPlugin CONDITION TARGET QmlDesigner DEPENDS Core QmlDesigner Utils Qt5::Qml DEFINES COMPONENTS_LIBRARY @@ -96,6 +105,7 @@ add_qtc_plugin(componentsplugin ) add_qtc_plugin(qmlpreviewplugin + PLUGIN_CLASS QmlPreviewWidgetPlugin CONDITION TARGET QmlDesigner DEPENDS Core ProjectExplorer QmlDesigner Utils Qt5::Qml SOURCES @@ -106,6 +116,7 @@ add_qtc_plugin(qmlpreviewplugin ) add_qtc_plugin(qtquickplugin + PLUGIN_CLASS QtQuickPlugin CONDITION TARGET QmlDesigner DEPENDS Core QmlDesigner Utils Qt5::Qml DEFINES QTQUICK_LIBRARY diff --git a/src/plugins/qmldesigner/designercore/include/qmldesignercorelib_global.h b/src/plugins/qmldesigner/designercore/include/qmldesignercorelib_global.h index 552095a8d6d..d46e099b98c 100644 --- a/src/plugins/qmldesigner/designercore/include/qmldesignercorelib_global.h +++ b/src/plugins/qmldesigner/designercore/include/qmldesignercorelib_global.h @@ -30,9 +30,9 @@ // Unnecessary since core isn't a dll any more. -#if defined(DESIGNER_CORE_LIBRARY) +#if defined(QMLDESIGNER_LIBRARY) #define QMLDESIGNERCORE_EXPORT Q_DECL_EXPORT -#elif defined(DESIGNER_STATIC_CORE_LIBRARY) +#elif defined(QMLDESIGNER_STATIC_LIBRARY) #define QMLDESIGNERCORE_EXPORT #else #define QMLDESIGNERCORE_EXPORT Q_DECL_IMPORT diff --git a/src/plugins/qmldesigner/dynamiclicensecheck.h b/src/plugins/qmldesigner/dynamiclicensecheck.h index fb1e3661b85..f8362cec946 100644 --- a/src/plugins/qmldesigner/dynamiclicensecheck.h +++ b/src/plugins/qmldesigner/dynamiclicensecheck.h @@ -43,7 +43,7 @@ enum FoundLicense { }; namespace Internal { -ExtensionSystem::IPlugin *licenseCheckerPlugin() +inline ExtensionSystem::IPlugin *licenseCheckerPlugin() { const ExtensionSystem::PluginSpec *pluginSpec = Utils::findOrDefault( ExtensionSystem::PluginManager::plugins(), @@ -55,8 +55,7 @@ ExtensionSystem::IPlugin *licenseCheckerPlugin() } } // namespace Internal - -FoundLicense checkLicense() +inline FoundLicense checkLicense() { if (auto plugin = Internal::licenseCheckerPlugin()) { bool retVal = false; @@ -72,7 +71,7 @@ FoundLicense checkLicense() return community; } -QString licensee() +inline QString licensee() { if (auto plugin = Internal::licenseCheckerPlugin()) { QString retVal; diff --git a/src/plugins/qmldesigner/qmldesignercore.cmake b/src/plugins/qmldesigner/qmldesignercore.cmake index 83870a36fee..b904057da2b 100644 --- a/src/plugins/qmldesigner/qmldesignercore.cmake +++ b/src/plugins/qmldesigner/qmldesignercore.cmake @@ -28,7 +28,6 @@ function(extend_with_qmldesigner_core target_name) QtSupport TextEditor DEFINES - DESIGNER_CORE_LIBRARY TEST_EXPORTS INCLUDES ${CMAKE_CURRENT_FUNCTION_LIST_DIR} @@ -420,4 +419,11 @@ function(extend_with_qmldesigner_core target_name) SOURCES_PREFIX ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../../../share/qtcreator/qml/qmlpuppet/container SOURCES sharedmemory_qt.cpp ) + + set(export_symbol_declaration DEFINES QMLDESIGNER_LIBRARY) + if (QTC_STATIC_BUILD) + set(export_symbol_declaration PUBLIC_DEFINES QMLDESIGNER_STATIC_LIBRARY) + endif() + extend_qtc_target(${target_name} ${export_symbol_declaration}) + endfunction() diff --git a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp index 09375ba69ff..8d33feaf5cc 100644 --- a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp +++ b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp @@ -73,7 +73,7 @@ static void handleAction(const SelectionContext &context) } ProjectExplorerPlugin::runStartupProject(Constants::QML_PREVIEW_RUN_MODE, skipDeploy); } else { - QmlPreviewPlugin::stopAllRunControls(); + QmlPreviewWidgetPlugin::stopAllRunControls(); } } } @@ -81,14 +81,14 @@ static void handleAction(const SelectionContext &context) QmlPreviewAction::QmlPreviewAction() : ModelNodeAction(livePreviewId, "Live Preview", previewIcon.icon(), - QmlPreviewPlugin::tr("Show Live Preview"), + QmlPreviewWidgetPlugin::tr("Show Live Preview"), ComponentCoreConstants::qmlPreviewCategory, QKeySequence("Alt+p"), 20, &handleAction, &SelectionContextFunctors::always) { - if (!QmlPreviewPlugin::getPreviewPlugin()) + if (!QmlPreviewWidgetPlugin::getPreviewPlugin()) defaultAction()->setVisible(false); defaultAction()->setCheckable(true); @@ -97,7 +97,7 @@ QmlPreviewAction::QmlPreviewAction() : ModelNodeAction(livePreviewId, void QmlPreviewAction::updateContext() { if (selectionContext().view()->isAttached()) - QmlPreviewPlugin::setQmlFile(); + QmlPreviewWidgetPlugin::setQmlFile(); defaultAction()->setSelectionContext(selectionContext()); } @@ -111,9 +111,9 @@ ZoomPreviewAction::ZoomPreviewAction() : m_zoomAction(new ZoomAction(nullptr)) { QObject::connect(m_zoomAction.get(), &ZoomAction::zoomLevelChanged, [=](float d) { - QmlPreviewPlugin::setZoomFactor(d); + QmlPreviewWidgetPlugin::setZoomFactor(d); }); - if (!QmlPreviewPlugin::getPreviewPlugin()) + if (!QmlPreviewWidgetPlugin::getPreviewPlugin()) m_zoomAction->setVisible(false); } @@ -281,7 +281,7 @@ SwitchLanguageAction::SwitchLanguageAction() : m_switchLanguageAction(new SwitchLanguageComboboxAction(nullptr)) { QObject::connect(m_switchLanguageAction.get(), &SwitchLanguageComboboxAction::currentLocaleChanged, - &QmlPreviewPlugin::setLanguageLocale); + &QmlPreviewWidgetPlugin::setLanguageLocale); } QAction *SwitchLanguageAction::action() const diff --git a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.cpp b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.cpp index 0975acfde30..701ed349030 100644 --- a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.cpp +++ b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.cpp @@ -53,7 +53,7 @@ Q_DECLARE_METATYPE(QmlPreview::QmlPreviewRunControlList) namespace QmlDesigner { static QObject *s_previewPlugin = nullptr; -QmlPreviewPlugin::QmlPreviewPlugin() +QmlPreviewWidgetPlugin::QmlPreviewWidgetPlugin() { DesignerActionManager &designerActionManager = QmlDesignerPlugin::instance()->designerActionManager(); @@ -92,12 +92,12 @@ QmlPreviewPlugin::QmlPreviewPlugin() } } -QString QmlPreviewPlugin::pluginName() const +QString QmlPreviewWidgetPlugin::pluginName() const { return QLatin1String("QmlPreviewPlugin"); } -void QmlPreviewPlugin::stopAllRunControls() +void QmlPreviewWidgetPlugin::stopAllRunControls() { QTC_ASSERT(s_previewPlugin, return); @@ -109,7 +109,7 @@ void QmlPreviewPlugin::stopAllRunControls() } -void QmlPreviewPlugin::handleRunningPreviews() +void QmlPreviewWidgetPlugin::handleRunningPreviews() { QTC_ASSERT(s_previewPlugin, return); @@ -124,12 +124,12 @@ void QmlPreviewPlugin::handleRunningPreviews() } } -QString QmlPreviewPlugin::metaInfo() const +QString QmlPreviewWidgetPlugin::metaInfo() const { return QLatin1String(":/qmlpreviewplugin/qmlpreview.metainfo"); } -void QmlPreviewPlugin::setQmlFile() +void QmlPreviewWidgetPlugin::setQmlFile() { if (s_previewPlugin) { const Utils::FilePath qmlFileName = @@ -140,7 +140,7 @@ void QmlPreviewPlugin::setQmlFile() } } -float QmlPreviewPlugin::zoomFactor() +float QmlPreviewWidgetPlugin::zoomFactor() { QVariant zoomFactorVariant = 1.0; if (s_previewPlugin && !s_previewPlugin->property("zoomFactor").isNull()) @@ -148,7 +148,7 @@ float QmlPreviewPlugin::zoomFactor() return zoomFactorVariant.toFloat(); } -void QmlPreviewPlugin::setZoomFactor(float zoomFactor) +void QmlPreviewWidgetPlugin::setZoomFactor(float zoomFactor) { if (auto s_previewPlugin = getPreviewPlugin()) { bool hasZoomFactor = s_previewPlugin->setProperty("zoomFactor", zoomFactor); @@ -156,7 +156,7 @@ void QmlPreviewPlugin::setZoomFactor(float zoomFactor) } } -void QmlPreviewPlugin::setLanguageLocale(const QString &locale) +void QmlPreviewWidgetPlugin::setLanguageLocale(const QString &locale) { if (auto s_previewPlugin = getPreviewPlugin()) { bool hasLocaleIsoCode = s_previewPlugin->setProperty("localeIsoCode", locale); @@ -164,7 +164,7 @@ void QmlPreviewPlugin::setLanguageLocale(const QString &locale) } } -QObject *QmlPreviewPlugin::getPreviewPlugin() +QObject *QmlPreviewWidgetPlugin::getPreviewPlugin() { const QVector &specs = ExtensionSystem::PluginManager::plugins(); const auto pluginIt = std::find_if(specs.cbegin(), specs.cend(), diff --git a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.h b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.h index 7f50d76696d..858bce6afba 100644 --- a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.h +++ b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.h @@ -33,18 +33,18 @@ QT_FORWARD_DECLARE_CLASS(QAction) namespace QmlDesigner { -class QmlPreviewPlugin : public QObject, QmlDesigner::IWidgetPlugin +class QmlPreviewWidgetPlugin : public QObject, QmlDesigner::IWidgetPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QmlDesignerPlugin" FILE "qmlpreviewplugin.json") - Q_DISABLE_COPY(QmlPreviewPlugin) + Q_DISABLE_COPY(QmlPreviewWidgetPlugin) Q_INTERFACES(QmlDesigner::IWidgetPlugin) public: - QmlPreviewPlugin(); - ~QmlPreviewPlugin() override = default; + QmlPreviewWidgetPlugin(); + ~QmlPreviewWidgetPlugin() override = default; QString metaInfo() const override; QString pluginName() const override; diff --git a/src/plugins/qmldesigner/studioplugin/CMakeLists.txt b/src/plugins/qmldesigner/studioplugin/CMakeLists.txt index be48a6eab5c..3c04dfd6243 100644 --- a/src/plugins/qmldesigner/studioplugin/CMakeLists.txt +++ b/src/plugins/qmldesigner/studioplugin/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(StudioPlugin + PLUGIN_CLASS StudioPlugin CONDITION TARGET QmlDesigner DEPENDS Core QmlDesigner Utils ProjectExplorer SOURCES diff --git a/src/plugins/qmljseditor/qmljseditor_global.h b/src/plugins/qmljseditor/qmljseditor_global.h index bd4a5139dcd..126b5119ffa 100644 --- a/src/plugins/qmljseditor/qmljseditor_global.h +++ b/src/plugins/qmljseditor/qmljseditor_global.h @@ -29,6 +29,8 @@ #if defined(QMLJSEDITOR_LIBRARY) # define QMLJSEDITOR_EXPORT Q_DECL_EXPORT +#elif defined(QMLJSEDITOR_STATIC_LIBRARY) +# define QMLJSEDITOR_EXPORT #else # define QMLJSEDITOR_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/qmljstools/qmljstools_global.h b/src/plugins/qmljstools/qmljstools_global.h index 4ea360e5fee..bdbf9136c21 100644 --- a/src/plugins/qmljstools/qmljstools_global.h +++ b/src/plugins/qmljstools/qmljstools_global.h @@ -29,7 +29,7 @@ #if defined(QMLJSTOOLS_LIBRARY) # define QMLJSTOOLS_EXPORT Q_DECL_EXPORT -#elif defined(QMLJSTOOLS_STATIC) +#elif defined(QMLJSTOOLS_STATIC_LIBRARY) # define QMLJSTOOLS_EXPORT #else # define QMLJSTOOLS_EXPORT Q_DECL_IMPORT diff --git a/src/plugins/qmlpreview/qmlpreview_global.h b/src/plugins/qmlpreview/qmlpreview_global.h index 372847578f3..0419c6bff2b 100644 --- a/src/plugins/qmlpreview/qmlpreview_global.h +++ b/src/plugins/qmlpreview/qmlpreview_global.h @@ -29,6 +29,8 @@ #if defined(QMLPREVIEW_LIBRARY) # define QMLPREVIEW_EXPORT Q_DECL_EXPORT +#elif defined(QMLPREVIEW_STATIC_LIBRARY) +# define QMLPREVIEW_EXPORT #else # define QMLPREVIEW_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/qmlprofiler/qmlprofiler_global.h b/src/plugins/qmlprofiler/qmlprofiler_global.h index 2da08c05674..0a3384ad197 100644 --- a/src/plugins/qmlprofiler/qmlprofiler_global.h +++ b/src/plugins/qmlprofiler/qmlprofiler_global.h @@ -29,6 +29,8 @@ #if defined(QMLPROFILER_LIBRARY) # define QMLPROFILER_EXPORT Q_DECL_EXPORT +#elif defined(QMLPROFILER_STATIC_LIBRARY) +# define QMLPROFILER_EXPORT #else # define QMLPROFILER_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/qmlprojectmanager/CMakeLists.txt b/src/plugins/qmlprojectmanager/CMakeLists.txt index fa037362a50..8b9fa9f2828 100644 --- a/src/plugins/qmlprojectmanager/CMakeLists.txt +++ b/src/plugins/qmlprojectmanager/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(QmlProjectManager + PLUGIN_CLASS QmlProjectPlugin DEPENDS QmlJS PLUGIN_DEPENDS Core ProjectExplorer QtSupport SOURCES diff --git a/src/plugins/qmlprojectmanager/qmlprojectmanager_global.h b/src/plugins/qmlprojectmanager/qmlprojectmanager_global.h index 0d30f82da9b..ac73b0b5873 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectmanager_global.h +++ b/src/plugins/qmlprojectmanager/qmlprojectmanager_global.h @@ -29,6 +29,8 @@ #if defined(QMLPROJECTMANAGER_LIBRARY) # define QMLPROJECTMANAGER_EXPORT Q_DECL_EXPORT +#elif defined(QMLPROJECTMANAGER_STATIC_LIBRARY) +# define QMLPROJECTMANAGER_EXPORT #else # define QMLPROJECTMANAGER_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/qtsupport/qtsupport_global.h b/src/plugins/qtsupport/qtsupport_global.h index 993bfcdb089..a6e4f7311c4 100644 --- a/src/plugins/qtsupport/qtsupport_global.h +++ b/src/plugins/qtsupport/qtsupport_global.h @@ -29,6 +29,8 @@ #if defined(QTSUPPORT_LIBRARY) # define QTSUPPORT_EXPORT Q_DECL_EXPORT +#elif defined(QTSUPPORT_STATIC_LIBRARY) +# define QTSUPPORT_EXPORT #else # define QTSUPPORT_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/remotelinux/remotelinux_export.h b/src/plugins/remotelinux/remotelinux_export.h index e9df11a1f03..7b681a4d54b 100644 --- a/src/plugins/remotelinux/remotelinux_export.h +++ b/src/plugins/remotelinux/remotelinux_export.h @@ -29,6 +29,8 @@ #if defined(REMOTELINUX_LIBRARY) # define REMOTELINUX_EXPORT Q_DECL_EXPORT +#elif defined(REMOTELINUX_STATIC_LIBRARY) +# define REMOTELINUX_EXPORT #else # define REMOTELINUX_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/resourceeditor/CMakeLists.txt b/src/plugins/resourceeditor/CMakeLists.txt index e6d4003bf30..8efebaae292 100644 --- a/src/plugins/resourceeditor/CMakeLists.txt +++ b/src/plugins/resourceeditor/CMakeLists.txt @@ -1,6 +1,5 @@ add_qtc_plugin(ResourceEditor DEPENDS Qt5::Xml - DEFINES RESOURCE_LIBRARY PLUGIN_DEPENDS Core ProjectExplorer SOURCES qrceditor/qrceditor.cpp qrceditor/qrceditor.h qrceditor/qrceditor.ui diff --git a/src/plugins/resourceeditor/resource_global.h b/src/plugins/resourceeditor/resource_global.h index 7fffa85432d..2fd743ef384 100644 --- a/src/plugins/resourceeditor/resource_global.h +++ b/src/plugins/resourceeditor/resource_global.h @@ -27,8 +27,10 @@ #include -#if defined(RESOURCE_LIBRARY) +#if defined(RESOURCEEDITOR_LIBRARY) # define RESOURCE_EXPORT Q_DECL_EXPORT +#elif defined(RESOURCEEDITOR_STATIC_LIBRARY) +# define RESOURCE_EXPORT #else # define RESOURCE_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/texteditor/texteditor_global.h b/src/plugins/texteditor/texteditor_global.h index 08f7adc5eb2..88ac76b3978 100644 --- a/src/plugins/texteditor/texteditor_global.h +++ b/src/plugins/texteditor/texteditor_global.h @@ -29,6 +29,8 @@ #if defined(TEXTEDITOR_LIBRARY) # define TEXTEDITOR_EXPORT Q_DECL_EXPORT +#elif defined(TEXTEDITOR_STATIC_LIBRARY) +# define TEXTEDITOR_EXPORT #else # define TEXTEDITOR_EXPORT Q_DECL_IMPORT #endif diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index 6ad611d2e71..c895d3c65a5 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -56,7 +56,7 @@ #include -Q_LOGGING_CATEGORY(log, "qtc.updateinfo", QtWarningMsg) +Q_LOGGING_CATEGORY(updateLog, "qtc.updateinfo", QtWarningMsg) const char UpdaterGroup[] = "Updater"; const char MaintenanceToolKey[] = "MaintenanceTool"; @@ -274,23 +274,23 @@ void UpdateInfoPlugin::checkForUpdatesFinished() { setLastCheckDate(QDate::currentDate()); - qCDebug(log) << "--- MaintenanceTool output (updates):"; - qCDebug(log) << qPrintable(d->m_updateOutput); - qCDebug(log) << "--- MaintenanceTool output (packages):"; - qCDebug(log) << qPrintable(d->m_packagesOutput); + qCDebug(updateLog) << "--- MaintenanceTool output (updates):"; + qCDebug(updateLog) << qPrintable(d->m_updateOutput); + qCDebug(updateLog) << "--- MaintenanceTool output (packages):"; + qCDebug(updateLog) << qPrintable(d->m_packagesOutput); stopCheckForUpdates(); const QList updates = availableUpdates(d->m_updateOutput); const QList qtPackages = availableQtPackages(d->m_packagesOutput); - if (log().isDebugEnabled()) { - qCDebug(log) << "--- Available updates:"; + if (updateLog().isDebugEnabled()) { + qCDebug(updateLog) << "--- Available updates:"; for (const Update &u : updates) - qCDebug(log) << u.name << u.version; - qCDebug(log) << "--- Available Qt packages:"; + qCDebug(updateLog) << u.name << u.version; + qCDebug(updateLog) << "--- Available Qt packages:"; for (const QtPackage &p : qtPackages) { - qCDebug(log) << p.displayName << p.version << "installed:" << p.installed - << "prerelease:" << p.isPrerelease; + qCDebug(updateLog) << p.displayName << p.version << "installed:" << p.installed + << "prerelease:" << p.isPrerelease; } } Utils::optional qtToNag = qtToNagAbout(qtPackages, &d->m_lastMaxQtVersion); diff --git a/src/plugins/updateinfo/updateinfotools.h b/src/plugins/updateinfo/updateinfotools.h index 0a977d344e2..f664628966c 100644 --- a/src/plugins/updateinfo/updateinfotools.h +++ b/src/plugins/updateinfo/updateinfotools.h @@ -34,7 +34,7 @@ #include #include -Q_DECLARE_LOGGING_CATEGORY(log) +Q_DECLARE_LOGGING_CATEGORY(updateLog) struct Update { @@ -133,8 +133,8 @@ Utils::optional qtToNagAbout(const QList &allPackages, if (packages.isEmpty()) return {}; const QtPackage highest = packages.constFirst(); - qCDebug(log) << "Highest available (non-prerelease) Qt:" << highest.version; - qCDebug(log) << "Highest previously seen (non-prerelease) Qt:" << *highestSeen; + qCDebug(updateLog) << "Highest available (non-prerelease) Qt:" << highest.version; + qCDebug(updateLog) << "Highest previously seen (non-prerelease) Qt:" << *highestSeen; // if the highestSeen version is null, we don't know if the Qt version is new, and better don't nag const bool isNew = !highestSeen->isNull() && highest.version > *highestSeen; if (highestSeen->isNull() || isNew) @@ -142,9 +142,9 @@ Utils::optional qtToNagAbout(const QList &allPackages, if (!isNew) return {}; const Utils::optional highestInstalled = highestInstalledQt(packages); - qCDebug(log) << "Highest installed Qt:" - << qPrintable(highestInstalled ? highestInstalled->version.toString() - : QString("none")); + qCDebug(updateLog) << "Highest installed Qt:" + << qPrintable(highestInstalled ? highestInstalled->version.toString() + : QString("none")); if (!highestInstalled) // don't nag if no Qt is installed at all return {}; if (highestInstalled->version == highest.version) diff --git a/src/plugins/vcsbase/CMakeLists.txt b/src/plugins/vcsbase/CMakeLists.txt index 0f7a6fc9efc..d5623d73533 100644 --- a/src/plugins/vcsbase/CMakeLists.txt +++ b/src/plugins/vcsbase/CMakeLists.txt @@ -1,4 +1,5 @@ add_qtc_plugin(VcsBase + PLUGIN_CLASS VcsPlugin PLUGIN_DEPENDS Core DiffEditor ProjectExplorer TextEditor PLUGIN_RECOMMENDS CodePaster CppEditor SOURCES diff --git a/src/plugins/vcsbase/vcsbase_global.h b/src/plugins/vcsbase/vcsbase_global.h index 2bf2f78e202..fd08e4e70b1 100644 --- a/src/plugins/vcsbase/vcsbase_global.h +++ b/src/plugins/vcsbase/vcsbase_global.h @@ -29,6 +29,8 @@ #if defined(VCSBASE_LIBRARY) # define VCSBASE_EXPORT Q_DECL_EXPORT +#elif defined(VCSBASE_STATIC_LIBRARY) +# define VCSBASE_EXPORT #else # define VCSBASE_EXPORT Q_DECL_IMPORT #endif diff --git a/src/shared/help/CMakeLists.txt b/src/shared/help/CMakeLists.txt index b02b82f6105..c3a864da6e9 100644 --- a/src/shared/help/CMakeLists.txt +++ b/src/shared/help/CMakeLists.txt @@ -12,7 +12,7 @@ if (isMultiConfig) endif() add_qtc_library(shared_help STATIC - DEPENDS Utils PUBLIC Qt5::Help Qt5::PrintSupport Qt5::Widgets + DEPENDS Utils Core PUBLIC Qt5::Help Qt5::PrintSupport Qt5::Widgets PUBLIC_INCLUDES "${PLUGIN_SOURCE_DIR}/help" "${PLUGIN_SOURCE_DIR}" diff --git a/src/tools/clangbackend/source/CMakeLists.txt b/src/tools/clangbackend/source/CMakeLists.txt index 4311e570534..4a3c115a5cc 100644 --- a/src/tools/clangbackend/source/CMakeLists.txt +++ b/src/tools/clangbackend/source/CMakeLists.txt @@ -2,7 +2,8 @@ add_qtc_library(clangbackend_lib STATIC DEPENDS libclang PUBLIC_DEPENDS Qt5::Widgets # FIXME: change the way to get the gui pch to linkto - DEFINES + PUBLIC_DEFINES + $ $ INCLUDES $ diff --git a/src/tools/processlauncher/CMakeLists.txt b/src/tools/processlauncher/CMakeLists.txt index 47acf9c1e68..3777b7d2dda 100644 --- a/src/tools/processlauncher/CMakeLists.txt +++ b/src/tools/processlauncher/CMakeLists.txt @@ -3,7 +3,7 @@ set(UTILSDIR "${PROJECT_SOURCE_DIR}/src/libs/utils") add_qtc_executable(qtcreator_processlauncher INCLUDES "${UTILSDIR}" DEPENDS Qt5::Core Qt5::Network - DEFINES QTCREATOR_UTILS_STATIC_LIB + DEFINES UTILS_STATIC_LIBRARY SOURCES launcherlogging.cpp launcherlogging.h diff --git a/src/tools/sdktool/CMakeLists.txt b/src/tools/sdktool/CMakeLists.txt index 4a2ad55e7df..e25a8c0b2c4 100644 --- a/src/tools/sdktool/CMakeLists.txt +++ b/src/tools/sdktool/CMakeLists.txt @@ -66,7 +66,7 @@ add_qtc_library(sdktoolLib extend_qtc_library(sdktoolLib SOURCES_PREFIX "${UtilsSourcesDir}" - PUBLIC_DEFINES QTCREATOR_UTILS_STATIC_LIB + PUBLIC_DEFINES UTILS_STATIC_LIBRARY SOURCES commandline.cpp commandline.h environment.cpp environment.h @@ -109,7 +109,7 @@ add_qtc_executable(sdktool main.cpp ) -if (MSVC AND TARGET sdktool) +if (MSVC AND TARGET sdktool AND Qt5_VERSION VERSION_LESS 6.0.0) # find out if Qt is static and set /MT if so get_target_property(_input_type Qt5::Core TYPE) if (${_input_type} STREQUAL "STATIC_LIBRARY") diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/plugin1.h b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/plugin1.h index 4b19bf1edfb..7ef8965f46e 100644 --- a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/plugin1.h +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin1/plugin1.h @@ -29,6 +29,8 @@ #if defined(PLUGIN1_LIBRARY) # define PLUGIN1_EXPORT Q_DECL_EXPORT +#elif defined(PLUGIN1_STATIC_LIBRARY) +# define PLUGIN1_EXPORT #else # define PLUGIN1_EXPORT Q_DECL_IMPORT #endif diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/plugin2.h b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/plugin2.h index dcb6e88e9ea..3bf5b22c3ad 100644 --- a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/plugin2.h +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin2/plugin2.h @@ -29,6 +29,8 @@ #if defined(PLUGIN2_LIBRARY) # define PLUGIN2_EXPORT Q_DECL_EXPORT +#elif defined(PLUGIN2_STATIC_LIBRARY) +# define PLUGIN2_EXPORT #else # define PLUGIN2_EXPORT Q_DECL_IMPORT #endif diff --git a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/plugin3.h b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/plugin3.h index 39acae592ab..8c9a2e7ce0c 100644 --- a/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/plugin3.h +++ b/tests/auto/extensionsystem/pluginmanager/circularplugins/plugin3/plugin3.h @@ -32,6 +32,8 @@ #if defined(PLUGIN3_LIBRARY) # define PLUGIN3_EXPORT Q_DECL_EXPORT +#elif defined(PLUGIN3_STATIC_LIBRARY) +# define PLUGIN3_EXPORT #else # define PLUGIN3_EXPORT Q_DECL_IMPORT #endif diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.h b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.h index eaec46856f0..397d262e6c8 100644 --- a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.h +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin1/plugin1.h @@ -29,6 +29,8 @@ #if defined(PLUGIN1_LIBRARY) # define PLUGIN1_EXPORT Q_DECL_EXPORT +#elif defined(PLUGIN1_STATIC_LIBRARY) +# define PLUGIN1_EXPORT #else # define PLUGIN1_EXPORT Q_DECL_IMPORT #endif diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/plugin2.h b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/plugin2.h index 8d99fce4f6d..747626a4944 100644 --- a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/plugin2.h +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin2/plugin2.h @@ -29,6 +29,8 @@ #if defined(PLUGIN2_LIBRARY) # define PLUGIN2_EXPORT Q_DECL_EXPORT +#elif defined(PLUGIN2_STATIC_LIBRARY) +# define PLUGIN2_EXPORT #else # define PLUGIN2_EXPORT Q_DECL_IMPORT #endif diff --git a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.h b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.h index 3d5d21d44cb..f71ba5ef733 100644 --- a/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.h +++ b/tests/auto/extensionsystem/pluginmanager/correctplugins1/plugin3/plugin3.h @@ -29,6 +29,8 @@ #if defined(PLUGIN3_LIBRARY) # define PLUGIN3_EXPORT Q_DECL_EXPORT +#elif defined(PLUGIN3_STATIC_LIBRARY) +# define PLUGIN3_EXPORT #else # define PLUGIN3_EXPORT Q_DECL_IMPORT #endif diff --git a/tests/auto/updateinfo/tst_updateinfo.cpp b/tests/auto/updateinfo/tst_updateinfo.cpp index 13cf71aa582..e15c42cb141 100644 --- a/tests/auto/updateinfo/tst_updateinfo.cpp +++ b/tests/auto/updateinfo/tst_updateinfo.cpp @@ -27,7 +27,7 @@ #include -Q_LOGGING_CATEGORY(log, "qtc.updateinfo", QtWarningMsg) +Q_LOGGING_CATEGORY(updateLog, "qtc.updateinfo", QtWarningMsg) class tst_UpdateInfo : public QObject { diff --git a/tests/unit/unittest/CMakeLists.txt b/tests/unit/unittest/CMakeLists.txt index 3451bd7116e..5fa1eafe146 100644 --- a/tests/unit/unittest/CMakeLists.txt +++ b/tests/unit/unittest/CMakeLists.txt @@ -152,7 +152,7 @@ if (NOT TARGET Sqlite) add_subdirectory(../../../src/libs/sqlite ${CMAKE_CURRENT_BINARY_DIR}/sqlite) endif() extend_qtc_test_with_target_sources(Sqlite - DEFINES SQLITE_CUSTOM_INCLUDE=config.h + DEFINES SQLITE_CUSTOM_INCLUDE=config.h SQLITE_STATIC_LIBRARY ) if (APPLE) @@ -258,7 +258,7 @@ extend_qtc_test(unittest "${QmlDesignerDir}/../../../share/qtcreator/qml/qmlpuppet/interfaces" "${QmlDesignerDir}/../../../share/qtcreator/qml/qmlpuppet/types" DEFINES - QMLDESIGNER_TEST DESIGNER_STATIC_CORE_LIBRARY + QMLDESIGNER_TEST QMLDESIGNER_STATIC_LIBRARY SOURCES_PREFIX "${QmlDesignerDir}" SOURCES