diff options
52 files changed, 1620 insertions, 61 deletions
diff --git a/.travis.yml b/.travis.yml index 2a438ee04..f67bb0208 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,6 +42,11 @@ jobs: - docker-compose run bionic scripts/build-qbs-with-qbs.sh - <<: *build-on-bionic + name: With CMake on Ubuntu bionic (linux_gcc64) + script: + - docker-compose run bionic scripts/build-qbs-with-cmake.sh + + - <<: *build-on-bionic name: With QMake on Ubuntu bionic (linux_gcc64) env: BUILD_OPTIONS="CONFIG+=ccache" diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..2d3376b15 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 3.10) + +## Add paths to check for cmake modules: +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +include(FeatureSummary) +include(QbsAPI) + +file(STRINGS VERSION QBS_VERSION) +project(Qbs VERSION ${QBS_VERSION}) + +# Force C++ standard, do not fall back, do not use compiler extensions +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +# Set up Qt stuff: +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +option(WITH_TESTS "Build Tests" ON) +option(WITH_UNIT_TESTS "Build Unit Tests" OFF) +option(WITH_PROJECT_FILE_UPDATES "Enable project file updates support" OFF) +option(INSTALL_PUBLIC_HEADERS "Whether to install public headers" ON) + +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) # Less useful to do it for linking, see edit2 +endif(CCACHE_FOUND) + +if(WITH_TESTS) + enable_testing() + set(QT_TEST_COMPONENT Test) + set(IMPLICIT_DEPENDS Qt5::Test) +endif() + +find_package(Qt5 + COMPONENTS Concurrent Core Gui Network Script Widgets Xml ${QT_TEST_COMPONENT} + REQUIRED + ) + +add_subdirectory(src) +add_subdirectory(share) +if(WITH_TESTS) + add_subdirectory(tests) +endif() diff --git a/cmake/QbsAPI.cmake b/cmake/QbsAPI.cmake new file mode 100644 index 000000000..02cabdaf4 --- /dev/null +++ b/cmake/QbsAPI.cmake @@ -0,0 +1,207 @@ +set(QBS_APP_INSTALL_DIR "bin") +set(QBS_LIBDIR_NAME "lib") + +if(APPLE) + set(QBS_LIB_RPATH "@loader_path") + set(QBS_LIBEXEC_RPATH "@loader_path/../../${QBS_LIBDIR_NAME}") + set(QBS_APP_RPATH "@loader_path/../${QBS_LIBDIR_NAME}") + set(QBS_PLUGINS_RPATH "@loader_path/../../../${QBS_LIBDIR_NAME}") +elseif(WIN32) + set(QBS_LIB_RPATH "") + set(QBS_LIBEXEC_RPATH "") + set(QBS_APP_RPATH "") + set(QBS_PLUGINS_RPATH "") +else() + set(QBS_LIB_RPATH "\$ORIGIN") + set(QBS_LIBEXEC_RPATH "\$ORIGIN/../../${QBS_LIBDIR_NAME}") + set(QBS_APP_RPATH "\$ORIGIN/../${QBS_LIBDIR_NAME}") + set(QBS_PLUGINS_RPATH "\$ORIGIN/../../../${QBS_LIBDIR_NAME}") +endif() + +if(WIN32) + set(QBS_LIB_INSTALL_DIR ${QBS_APP_INSTALL_DIR}) + set(QBS_LIBEXEC_PATH ${QBS_APP_INSTALL_DIR}) +else() + set(QBS_LIB_INSTALL_DIR ${QBS_LIBDIR_NAME}) + set(QBS_LIBEXEC_PATH "libexec/qbs") +endif() + +if(WITH_UNIT_TESTS) + set(QBS_UNIT_TESTS_DEFINES "QBS_ENABLE_UNIT_TESTS") +else() + set(QBS_UNIT_TESTS_DEFINES "") +endif() + +if(WITH_PROJECT_FILE_UPDATES) + set(QBS_PROJECT_FILE_UPDATES_DEFINES "QBS_ENABLE_PROJECT_FILE_UPDATES") +else() + set(QBS_PROJECT_FILE_UPDATES_DEFINES "") +endif() + +set(QBS_PLUGINS_INSTALL_DIR "${QBS_LIBDIR_NAME}/qbs/plugins") +set(QBS_RELATIVE_LIBEXEC_PATH "../${QBS_LIBEXEC_PATH}") +set(QBS_RELATIVE_SEARCH_PATH "..") +set(QBS_RELATIVE_PLUGINS_PATH "../${QBS_LIBDIR_NAME}") +set(QBS_RESOURCES_INSTALL_DIR "") +set(QBS_HEADERS_INSTALL_DIR "include/qbs") + +set(DEFAULT_DEFINES "") +if(WIN32) + list(APPEND DEFAULT_DEFINES UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS) +endif() + +# CMake 3.10 doesn't have list(TRANSFORM) +function(list_transform_prepend var prefix) + set(temp "") + foreach(f ${${var}}) + list(APPEND temp "${prefix}${f}") + endforeach() + set(${var} "${temp}" PARENT_SCOPE) +endfunction() + +function(add_qbs_app target_name) + cmake_parse_arguments(_arg + "" + "DESTINATION" + "DEFINES;PUBLIC_DEFINES;DEPENDS;PUBLIC_DEPENDS;INCLUDES;PUBLIC_INCLUDES;SOURCES;" + ${ARGN} + ) + + if (${_arg_UNPARSED_ARGUMENTS}) + message(FATAL_ERROR "add_qbs_app had unparsed arguments") + endif() + + set(_DESTINATION "${QBS_APP_INSTALL_DIR}") + if(_arg_DESTINATION) + set(_DESTINATION "${_arg_DESTINATION}") + endif() + + add_executable(${target_name} ${_arg_SOURCES}) + target_compile_definitions( + ${target_name} PRIVATE ${_arg_DEFINES} ${DEFAULT_DEFINES} PUBLIC ${_arg_PUBLIC_DEFINES}) + target_include_directories( + ${target_name} PRIVATE ${_arg_INCLUDES} PUBLIC ${_arg_PUBLIC_INCLUDES}) + target_link_libraries(${target_name} PRIVATE ${_arg_DEPENDS} PUBLIC ${_arg_PUBLIC_DEPENDS}) + + set_target_properties(${target_name} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${_DESTINATION} + BUILD_RPATH "${QBS_APP_RPATH}" + INSTALL_RPATH "${QBS_APP_RPATH}" + ) + install(TARGETS ${target_name} RUNTIME DESTINATION ${_DESTINATION}) +endfunction() + +function(add_qbs_library target_name) + cmake_parse_arguments(_arg + "STATIC" + "" + "DEFINES;PUBLIC_DEFINES;DEPENDS;PUBLIC_DEPENDS;INCLUDES;PUBLIC_INCLUDES;SOURCES;" + ${ARGN} + ) + + if (${_arg_UNPARSED_ARGUMENTS}) + message(FATAL_ERROR "add_qbs_library had unparsed arguments") + endif() + + set(library_type SHARED) + set(library_define "QBS_LIBRARY") + if (_arg_STATIC) + set(library_type STATIC) + set(library_define "QBS_STATIC_LIB") + endif() + + string(REGEX REPLACE "\\.[0..9]+$" "" _SOVERSION ${QBS_VERSION}) + + add_library(${target_name} ${library_type} ${_arg_SOURCES}) + target_compile_definitions( + ${target_name} + PRIVATE ${_arg_DEFINES} ${library_define} ${DEFAULT_DEFINES} + PUBLIC ${_arg_PUBLIC_DEFINES}) + target_include_directories( + ${target_name} + PRIVATE ${_arg_INCLUDES} + PUBLIC ${_arg_PUBLIC_INCLUDES} + INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>) + target_link_libraries(${target_name} PRIVATE ${_arg_DEPENDS} PUBLIC ${_arg_PUBLIC_DEPENDS}) + + set_target_properties(${target_name} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${QBS_LIB_INSTALL_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${QBS_LIB_INSTALL_DIR} + BUILD_RPATH "${QBS_LIB_RPATH}" + INSTALL_RPATH "${QBS_LIB_RPATH}" + SOVERSION ${_SOVERSION} + VERSION ${QBS_VERSION} + ) + if (NOT _arg_STATIC) + install(TARGETS ${target_name} LIBRARY DESTINATION ${QBS_LIB_INSTALL_DIR}) + endif() +endfunction() + +function(add_qbs_plugin target_name) + cmake_parse_arguments(_arg + "" + "" + "DEFINES;PUBLIC_DEFINES;DEPENDS;PUBLIC_DEPENDS;INCLUDES;PUBLIC_INCLUDES;SOURCES;" + ${ARGN} + ) + + if (${_arg_UNPARSED_ARGUMENTS}) + message(FATAL_ERROR "add_qbs_plugin had unparsed arguments") + endif() + + add_library(${target_name} SHARED ${_arg_SOURCES}) + target_compile_definitions( + ${target_name} PRIVATE ${_arg_DEFINES} ${DEFAULT_DEFINES} PUBLIC ${_arg_PUBLIC_DEFINES}) + target_include_directories( + ${target_name} PRIVATE ${_arg_INCLUDES} PUBLIC ${_arg_PUBLIC_INCLUDES}) + target_link_libraries(${target_name} PRIVATE ${_arg_DEPENDS} PUBLIC ${_arg_PUBLIC_DEPENDS}) + + set_target_properties(${target_name} PROPERTIES + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${QBS_PLUGINS_INSTALL_DIR} + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${QBS_PLUGINS_INSTALL_DIR} + BUILD_RPATH "${QBS_PLUGINS_RPATH}" + INSTALL_RPATH "${QBS_PLUGINS_RPATH}" + ) + install(TARGETS ${target_name} LIBRARY DESTINATION ${QBS_PLUGINS_INSTALL_DIR}) +endfunction() + +function(add_qbs_test test_name) + cmake_parse_arguments(_arg + "" + "" + "DEFINES;PUBLIC_DEFINES;DEPENDS;PUBLIC_DEPENDS;INCLUDES;PUBLIC_INCLUDES;SOURCES;" + ${ARGN} + ) + + if (${_arg_UNPARSED_ARGUMENTS}) + message(FATAL_ERROR "add_qbs_test had unparsed arguments") + endif() + + set(target_name "tst_${test_name}") + + string(TOUPPER ${test_name} suite_name) # cmake is beatiful, here we have <input, output> + string(REPLACE - _ suite_name ${suite_name}) # and here we have <output, input> + + add_executable(${target_name} ${_arg_SOURCES}) + target_compile_definitions(${target_name} PRIVATE + "QBS_TEST_SUITE_NAME=\"${suite_name}\"" + "SRCDIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"" + ) + target_compile_definitions( + ${target_name} PRIVATE ${_arg_DEFINES} ${DEFAULT_DEFINES} PUBLIC ${_arg_PUBLIC_DEFINES}) + target_include_directories( + ${target_name} PRIVATE ${_arg_INCLUDES} PUBLIC ${_arg_PUBLIC_INCLUDES}) + target_link_libraries( + ${target_name} + PRIVATE ${_arg_DEPENDS} corelib logginglib Qt5::Test + PUBLIC ${_arg_PUBLIC_DEPENDS} + ) + + set_target_properties(${target_name} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${QBS_APP_INSTALL_DIR} + BUILD_RPATH "${QBS_APP_RPATH}" + INSTALL_RPATH "${QBS_APP_RPATH}" + ) + install(TARGETS ${target_name} RUNTIME DESTINATION ${QBS_APP_INSTALL_DIR}) + add_test(NAME ${target_name} COMMAND ${target_name}) +endfunction() diff --git a/docker-compose.yml b/docker-compose.yml index 901d28b93..21bb6d0bf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: bionic: << : *linux hostname: bionic - image: ${DOCKER_USER:-qbsbuild}/qbsdev:bionic-5.15.0_1.15.1-1 + image: ${DOCKER_USER:-qbsbuild}/qbsdev:bionic-5.15.0_1.15.1-2 build: dockerfile: docker/bionic/Dockerfile context: . diff --git a/docker/bionic/Dockerfile b/docker/bionic/Dockerfile index ab05c90a7..9fee903dd 100644 --- a/docker/bionic/Dockerfile +++ b/docker/bionic/Dockerfile @@ -42,6 +42,7 @@ RUN apt-get update -qq && \ ccache \ clang-8 \ clang-tidy-8 \ + cmake \ curl \ flex \ git \ @@ -55,6 +56,7 @@ RUN apt-get update -qq && \ libgl1-mesa-glx \ libprotobuf-dev \ libgrpc++-dev \ + ninja-build \ nsis \ pkg-config \ protobuf-compiler \ @@ -55,6 +55,11 @@ Project { } Product { + name: "cmake project files for qbs" + files: ["**/CMakeLists.txt"] + } + + Product { name: "continuous integration files" files: [ ".travis.yml", diff --git a/scripts/build-qbs-with-cmake.sh b/scripts/build-qbs-with-cmake.sh new file mode 100755 index 000000000..96a3a207a --- /dev/null +++ b/scripts/build-qbs-with-cmake.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +############################################################################# +## +## Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com). +## Contact: https://www.qt.io/licensing/ +## +## This file is part of Qbs. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# +set -e + +# +# It might be desired to keep settings for Qbs testing +# in a separate folder. +# +export QBS_AUTOTEST_SETTINGS_DIR="${QBS_AUTOTEST_SETTINGS_DIR:-/tmp/qbs-settings}" + +BUILD_OPTIONS="-DWITH_UNIT_TESTS=1 -DWITH_PROJECT_FILE_UPDATES=1 ${BUILD_OPTIONS}" + +QMAKE_PATH="${QMAKE_PATH:-$(which qmake)}" +QT_DIR=$(dirname ${QMAKE_PATH})/../ + +# Use shadow build +mkdir -p build +pushd build + +# +# Build all default products of Qbs +# +cmake -GNinja -DQt5_DIR=${QT_DIR}/lib/cmake/Qt5/ ${BUILD_OPTIONS} .. +ninja + +# +# Set up profiles for the freshly built Qbs if not +# explicitly specified otherwise +# +if [ -z "${QBS_AUTOTEST_PROFILE}" ]; then + + export QBS_AUTOTEST_PROFILE=autotestprofile + RUN_OPTIONS="\ + --settings-dir ${QBS_AUTOTEST_SETTINGS_DIR} \ + " + + ./bin/qbs setup-toolchains \ + ${RUN_OPTIONS} \ + --detect + + ./bin/qbs setup-qt \ + ${RUN_OPTIONS} \ + "${QMAKE_PATH}" ${QBS_AUTOTEST_PROFILE} + + ./bin/qbs config \ + ${RUN_OPTIONS} \ + ${QBS_AUTOTEST_PROFILE}.baseProfile gcc + +fi + +# +# Run all autotests with QBS_AUTOTEST_PROFILE. Some test cases might run for +# over 10 minutes. Output an empty line every 9:50 minutes to prevent a 10min +# timeout on Travis CI. +# +(while true; do echo "" && sleep 590; done) & +trap "kill $!; wait $! 2>/dev/null || true; killall sleep || true" EXIT +ctest -j $(nproc --all) + +popd diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt new file mode 100644 index 000000000..66b030542 --- /dev/null +++ b/share/CMakeLists.txt @@ -0,0 +1,65 @@ +if(WIN32) + install( + FILES ../bin/ibmsvc.xml ../bin/ibqbs.bat + DESTINATION "${CMAKE_INSTALL_PREFIX}/${QBS_APP_INSTALL_DIR}" + ) +endif() +install( + PROGRAMS ../src/3rdparty/python/bin/dmgbuild + DESTINATION "${CMAKE_INSTALL_PREFIX}/${QBS_LIBEXEC_PATH}" + ) +add_custom_target(copy-runtime-files-dmgbuild ALL + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/../src/3rdparty/python/bin/dmgbuild + ${CMAKE_BINARY_DIR}/${QBS_LIBEXEC_PATH} + ) +install( + # trailing slash avoid copying the 'site-packages' dir and only copies its content + DIRECTORY ../src/3rdparty/python/lib/python2.7/site-packages/ + DESTINATION "${CMAKE_INSTALL_PREFIX}/${QBS_RESOURCES_INSTALL_DIR}/share/qbs/python" + FILES_MATCHING PATTERN "*.py" + ) +install( + DIRECTORY qbs + DESTINATION "${CMAKE_INSTALL_PREFIX}/${QBS_RESOURCES_INSTALL_DIR}/share") +add_custom_target(copy-runtime-files-qbs ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/qbs + ${CMAKE_BINARY_DIR}/share/qbs + ) +install( + DIRECTORY ../examples + DESTINATION "${CMAKE_INSTALL_PREFIX}/${QBS_RESOURCES_INSTALL_DIR}/share/qbs" + ) + +if(WIN32) + set(UPDATE_PATH_COMMAND set "PATH=${QT_QMAKE_EXECUTABLE}/..\;%PATH%") +else() + set(UPDATE_PATH_COMMAND "") +endif() + +add_custom_target( + BuildQbsResources ALL + COMMAND ${UPDATE_PATH_COMMAND} + COMMAND ${CMAKE_BINARY_DIR}/${QBS_APP_INSTALL_DIR}/qbs + build + --settings-dir ${CMAKE_BINARY_DIR}/settings + -f ${CMAKE_SOURCE_DIR}/qbs.qbs + -d ${CMAKE_BINARY_DIR}/ + -p "qbs resources" + qbs.installPrefix:undefined + project.withCode:false + project.withDocumentation:false + profile:none + DEPENDS qbs + ) + +install( + DIRECTORY ${CMAKE_BINARY_DIR}/default/install-root/share/qbs/qml-type-descriptions + DESTINATION "${CMAKE_INSTALL_PREFIX}/${QBS_RESOURCES_INSTALL_DIR}/share/qbs" + ) + +install( + DIRECTORY ${CMAKE_BINARY_DIR}/default/install-root/share/qbs/qml-type-descriptions + DESTINATION "${CMAKE_INSTALL_PREFIX}/${QBS_RESOURCES_INSTALL_DIR}/share/qbs" + ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..278b86ad1 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(app) +add_subdirectory(lib) +add_subdirectory(libexec) +add_subdirectory(plugins) +add_subdirectory(shared) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt new file mode 100644 index 000000000..3a4ab38e0 --- /dev/null +++ b/src/app/CMakeLists.txt @@ -0,0 +1,8 @@ +add_subdirectory(config) +add_subdirectory(config-ui) +add_subdirectory(qbs) +add_subdirectory(qbs-create-project) +add_subdirectory(qbs-setup-android) +add_subdirectory(qbs-setup-qt) +add_subdirectory(qbs-setup-toolchains) +add_subdirectory(shared) diff --git a/src/app/config-ui/CMakeLists.txt b/src/app/config-ui/CMakeLists.txt new file mode 100644 index 000000000..bced804c2 --- /dev/null +++ b/src/app/config-ui/CMakeLists.txt @@ -0,0 +1,19 @@ +set(SOURCES + commandlineparser.cpp + commandlineparser.h + main.cpp + mainwindow.cpp + mainwindow.h + mainwindow.ui + ) + +# TODO: support Info.plist +if(APPLE) + set(MACOS_SOURCES fgapp.mm) + set(MACOS_FRAMEWORKS "-framework ApplicationServices" "-framework Cocoa") +endif() + +add_qbs_app(qbs-config-ui + DEPENDS corelib logginglib Qt5::Widgets ${MACOS_FRAMEWORKS} + SOURCES ${SOURCES} ${MACOS_SOURCES} + ) diff --git a/src/app/config/CMakeLists.txt b/src/app/config/CMakeLists.txt new file mode 100644 index 000000000..67dd78483 --- /dev/null +++ b/src/app/config/CMakeLists.txt @@ -0,0 +1,13 @@ +set(SOURCES + configcommand.h + configcommandexecutor.cpp + configcommandexecutor.h + configcommandlineparser.cpp + configcommandlineparser.h + configmain.cpp + ) + +add_qbs_app(qbs-config + DEPENDS corelib logginglib + SOURCES ${SOURCES} + ) diff --git a/src/app/qbs-create-project/CMakeLists.txt b/src/app/qbs-create-project/CMakeLists.txt new file mode 100644 index 000000000..b3c1f75f5 --- /dev/null +++ b/src/app/qbs-create-project/CMakeLists.txt @@ -0,0 +1,10 @@ +set(SOURCES + createproject.cpp + createproject.h + create-project-main.cpp + ) + +add_qbs_app(qbs-create-project + DEPENDS corelib logginglib + SOURCES ${SOURCES} + ) diff --git a/src/app/qbs-setup-android/CMakeLists.txt b/src/app/qbs-setup-android/CMakeLists.txt new file mode 100644 index 000000000..97d0c8a60 --- /dev/null +++ b/src/app/qbs-setup-android/CMakeLists.txt @@ -0,0 +1,12 @@ +set(SOURCES + android-setup.cpp + android-setup.h + commandlineparser.cpp + commandlineparser.h + main.cpp + ) + +add_qbs_app(qbs-setup-android + DEPENDS corelib logginglib + SOURCES ${SOURCES} + ) diff --git a/src/app/qbs-setup-qt/CMakeLists.txt b/src/app/qbs-setup-qt/CMakeLists.txt new file mode 100644 index 000000000..55b86e3a2 --- /dev/null +++ b/src/app/qbs-setup-qt/CMakeLists.txt @@ -0,0 +1,12 @@ +set(SOURCES + commandlineparser.cpp + commandlineparser.h + main.cpp + setupqt.cpp + setupqt.h + ) + +add_qbs_app(qbs-setup-qt + DEPENDS corelib logginglib + SOURCES ${SOURCES} + ) diff --git a/src/app/qbs-setup-toolchains/CMakeLists.txt b/src/app/qbs-setup-toolchains/CMakeLists.txt new file mode 100644 index 000000000..9dc610bd3 --- /dev/null +++ b/src/app/qbs-setup-toolchains/CMakeLists.txt @@ -0,0 +1,26 @@ +set(SOURCES + clangclprobe.cpp + clangclprobe.h + commandlineparser.cpp + commandlineparser.h + gccprobe.cpp + gccprobe.h + iarewprobe.cpp + iarewprobe.h + keilprobe.cpp + keilprobe.h + main.cpp + msvcprobe.cpp + msvcprobe.h + probe.cpp + probe.h + sdccprobe.cpp + sdccprobe.h + xcodeprobe.cpp + xcodeprobe.h + ) + +add_qbs_app(qbs-setup-toolchains + DEPENDS corelib logginglib + SOURCES ${SOURCES} + ) diff --git a/src/app/qbs/CMakeLists.txt b/src/app/qbs/CMakeLists.txt new file mode 100644 index 000000000..009130426 --- /dev/null +++ b/src/app/qbs/CMakeLists.txt @@ -0,0 +1,50 @@ +set(SOURCES + application.cpp + application.h + commandlinefrontend.cpp + commandlinefrontend.h + consoleprogressobserver.cpp + consoleprogressobserver.h + ctrlchandler.cpp + ctrlchandler.h + main.cpp + qbstool.cpp + qbstool.h + session.cpp + session.h + sessionpacket.cpp + sessionpacket.h + sessionpacketreader.cpp + sessionpacketreader.h + status.cpp + status.h + stdinreader.cpp + stdinreader.h + ) + +set(PARSER_SOURCES + commandlineoption.cpp + commandlineoption.h + commandlineoptionpool.cpp + commandlineoptionpool.h + commandlineparser.cpp + commandlineparser.h + commandpool.cpp + commandpool.h + commandtype.h + parsercommand.cpp + parsercommand.h + ) +list_transform_prepend(PARSER_SOURCES parser/) + +add_qbs_app(qbs + DEFINES + "QBS_VERSION=\"${QBS_VERSION}\"" + "QBS_RELATIVE_LIBEXEC_PATH=\"${QBS_RELATIVE_LIBEXEC_PATH}\"" + "QBS_RELATIVE_SEARCH_PATH=\"${QBS_RELATIVE_SEARCH_PATH}\"" + "QBS_RELATIVE_PLUGINS_PATH=\"${QBS_RELATIVE_PLUGINS_PATH}\"" + DEPENDS corelib logginglib + SOURCES ${SOURCES} ${PARSER_SOURCES} + ) + +add_dependencies(qbs qbs_cpp_scanner qbs_qt_scanner) diff --git a/src/app/shared/CMakeLists.txt b/src/app/shared/CMakeLists.txt new file mode 100644 index 000000000..504db2b5b --- /dev/null +++ b/src/app/shared/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(logging) diff --git a/src/app/shared/logging/CMakeLists.txt b/src/app/shared/logging/CMakeLists.txt new file mode 100644 index 000000000..8fbeed184 --- /dev/null +++ b/src/app/shared/logging/CMakeLists.txt @@ -0,0 +1,13 @@ +set(SOURCES + coloredoutput.cpp + coloredoutput.h + consolelogger.cpp + consolelogger.h + ) + +add_qbs_library(logginglib + STATIC + DEPENDS corelib + PUBLIC_INCLUDES $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../> + SOURCES ${SOURCES} + ) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt new file mode 100644 index 000000000..f029edd1f --- /dev/null +++ b/src/lib/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(corelib) +add_subdirectory(msbuild) diff --git a/src/lib/corelib/CMakeLists.txt b/src/lib/corelib/CMakeLists.txt new file mode 100644 index 000000000..2dfaf225c --- /dev/null +++ b/src/lib/corelib/CMakeLists.txt @@ -0,0 +1,460 @@ +set(QBS_HEADERS qbs.h) + +set(FILE_UPDATE_SOURCES + changeset.cpp + changeset.h + projectfileupdater.cpp + projectfileupdater.h + qmljsrewriter.cpp + qmljsrewriter.h + ) +list_transform_prepend(FILE_UPDATE_SOURCES api/) + +set(API_SOURCES + internaljobs.cpp + internaljobs.h + jobs.cpp + languageinfo.cpp + project.cpp + project_p.h + projectdata.cpp + projectdata_p.h + propertymap_p.h + rulecommand.cpp + rulecommand_p.h + runenvironment.cpp + transformerdata.cpp + transformerdata_p.h + ) +list_transform_prepend(API_SOURCES api/) + +set(API_HEADERS + jobs.h + languageinfo.h + project.h + projectdata.h + rulecommand.h + runenvironment.h + transformerdata.h + ) +list_transform_prepend(API_HEADERS api/) + +set(BUILD_GRAPH_SOURCES + abstractcommandexecutor.cpp + abstractcommandexecutor.h + artifact.cpp + artifact.h + artifactcleaner.cpp + artifactcleaner.h + artifactsscriptvalue.cpp + artifactsscriptvalue.h + artifactvisitor.cpp + artifactvisitor.h + buildgraph.cpp + buildgraph.h + buildgraphnode.cpp + buildgraphnode.h + buildgraphloader.cpp + buildgraphloader.h + buildgraphvisitor.h + cycledetector.cpp + cycledetector.h + dependencyparametersscriptvalue.cpp + dependencyparametersscriptvalue.h + depscanner.cpp + depscanner.h + emptydirectoriesremover.cpp + emptydirectoriesremover.h + environmentscriptrunner.cpp + environmentscriptrunner.h + executor.cpp + executor.h + executorjob.cpp + executorjob.h + filedependency.cpp + filedependency.h + inputartifactscanner.cpp + inputartifactscanner.h + jscommandexecutor.cpp + jscommandexecutor.h + nodeset.cpp + nodeset.h + nodetreedumper.cpp + nodetreedumper.h + processcommandexecutor.cpp + processcommandexecutor.h + productbuilddata.cpp + productbuilddata.h + productinstaller.cpp + productinstaller.h + projectbuilddata.cpp + projectbuilddata.h + qtmocscanner.cpp + qtmocscanner.h + rawscanneddependency.cpp + rawscanneddependency.h + rawscanresults.cpp + rawscanresults.h + requestedartifacts.cpp + requestedartifacts.h + requesteddependencies.cpp + requesteddependencies.h + rescuableartifactdata.h + rulecommands.cpp + rulecommands.h + rulegraph.cpp + rulegraph.h + rulenode.cpp + rulenode.h + rulesapplicator.cpp + rulesapplicator.h + rulesevaluationcontext.cpp + rulesevaluationcontext.h + scriptclasspropertyiterator.h + timestampsupdater.cpp + timestampsupdater.h + transformer.cpp + transformer.h + transformerchangetracking.cpp + transformerchangetracking.h + ) +list_transform_prepend(BUILD_GRAPH_SOURCES buildgraph/) + +set(BUILD_GRAPH_HEADERS buildgraph/forward_decls.h) + +set(GENERATORS_SOURCES + generatableprojectiterator.cpp + generatableprojectiterator.h + generator.cpp + generatordata.cpp + generatorutils.cpp + generatorutils.h + generatorversioninfo.cpp + generatorversioninfo.h + igeneratableprojectvisitor.h + ixmlnodevisitor.h + xmlproject.cpp + xmlproject.h + xmlprojectwriter.cpp + xmlprojectwriter.h + xmlproperty.cpp + xmlproperty.h + xmlpropertygroup.cpp + xmlpropertygroup.h + xmlworkspace.cpp + xmlworkspace.h + xmlworkspacewriter.cpp + xmlworkspacewriter.h + ) +list_transform_prepend(GENERATORS_SOURCES generators/) + +set(GENERATORS_HEADERS generators/generator.h generators/generatordata.h) + +set(JS_EXTENSIONS_SOURCES + environmentextension.cpp + file.cpp + fileinfoextension.cpp + jsextensions.cpp + jsextensions.h + moduleproperties.cpp + moduleproperties.h + process.cpp + temporarydir.cpp + textfile.cpp + binaryfile.cpp + utilitiesextension.cpp + domxml.cpp + ) +list_transform_prepend(JS_EXTENSIONS_SOURCES jsextensions/) + +if(APPLE) + set(JS_EXTENSIONS_MACOS_SOURCES + propertylist_darwin.h + propertylist_darwin.mm + propertylistutils.h + propertylistutils.mm + ) +else() + set(JS_EXTENSIONS_MACOS_SOURCES propertylist.cpp) +endif() +list_transform_prepend(JS_EXTENSIONS_MACOS_SOURCES jsextensions/) + +set(LANGUAGE_SOURCES + artifactproperties.cpp + artifactproperties.h + astimportshandler.cpp + astimportshandler.h + astpropertiesitemhandler.cpp + astpropertiesitemhandler.h + asttools.cpp + asttools.h + builtindeclarations.cpp + builtindeclarations.h + deprecationinfo.h + evaluationdata.h + evaluator.cpp + evaluator.h + evaluatorscriptclass.cpp + evaluatorscriptclass.h + filecontext.cpp + filecontext.h + filecontextbase.cpp + filecontextbase.h + filetags.cpp + filetags.h + identifiersearch.cpp + identifiersearch.h + item.cpp + item.h + itemdeclaration.cpp + itemdeclaration.h + itemobserver.h + itempool.cpp + itempool.h + itemreader.cpp + itemreader.h + itemreaderastvisitor.cpp + itemreaderastvisitor.h + itemreadervisitorstate.cpp + itemreadervisitorstate.h + itemtype.h + jsimports.h + language.cpp + language.h + loader.cpp + loader.h + moduleloader.cpp + moduleloader.h + modulemerger.cpp + modulemerger.h + moduleproviderinfo.h + preparescriptobserver.cpp + preparescriptobserver.h + projectresolver.cpp + projectresolver.h + property.cpp + property.h + propertydeclaration.cpp + propertydeclaration.h + propertymapinternal.cpp + propertymapinternal.h + qualifiedid.cpp + qualifiedid.h + resolvedfilecontext.cpp + resolvedfilecontext.h + scriptengine.cpp + scriptengine.h + scriptimporter.cpp + scriptimporter.h + scriptpropertyobserver.cpp + scriptpropertyobserver.h + value.cpp + value.h + ) +list_transform_prepend(LANGUAGE_SOURCES language/) + +set(LANGUAGE_HEADERS language/forward_decls.h) + +set(LOGGING_SOURCES + categories.cpp + categories.h + ilogsink.cpp + logger.cpp + logger.h + translator.h + ) +list_transform_prepend(LOGGING_SOURCES logging/) + +set(LOGGING_HEADERS logging/ilogsink.h) + +set(PARSER_SOURCES + qmlerror.cpp + qmlerror.h + qmljsast.cpp + qmljsast_p.h + qmljsastfwd_p.h + qmljsastvisitor.cpp + qmljsastvisitor_p.h + qmljsengine_p.cpp + qmljsengine_p.h + qmljsglobal_p.h + qmljsgrammar.cpp + qmljsgrammar_p.h + qmljskeywords_p.h + qmljslexer.cpp + qmljslexer_p.h + qmljsmemorypool_p.h + qmljsparser.cpp + qmljsparser_p.h + ) +list_transform_prepend(PARSER_SOURCES parser/) + +set(TOOLS_SOURCES + architectures.cpp + buildgraphlocker.cpp + buildgraphlocker.h + buildoptions.cpp + clangclinfo.cpp + clangclinfo.h + cleanoptions.cpp + codelocation.cpp + commandechomode.cpp + dynamictypecheck.h + error.cpp + executablefinder.cpp + executablefinder.h + fileinfo.cpp + fileinfo.h + filesaver.cpp + filesaver.h + filetime.cpp + filetime.h + generateoptions.cpp + hostosinfo.h + id.cpp + id.h + iosutils.h + joblimits.cpp + jsliterals.cpp + jsliterals.h + jsonhelper.h + installoptions.cpp + launcherinterface.cpp + launcherinterface.h + launcherpackets.cpp + launcherpackets.h + launchersocket.cpp + launchersocket.h + msvcinfo.cpp + msvcinfo.h + pathutils.h + persistence.cpp + persistence.h + preferences.cpp + processresult.cpp + processresult_p.h + processutils.cpp + processutils.h + profile.cpp + profiling.cpp + profiling.h + progressobserver.cpp + progressobserver.h + projectgeneratormanager.cpp + qbsassert.cpp + qbsassert.h + qbspluginmanager.cpp + qbspluginmanager.h + qbsprocess.cpp + qbsprocess.h + qttools.cpp + qttools.h + scannerpluginmanager.cpp + scannerpluginmanager.h + scripttools.cpp + scripttools.h + set.h + settings.cpp + settingscreator.cpp + settingscreator.h + settingsmodel.cpp + settingsrepresentation.cpp + setupprojectparameters.cpp + shellutils.cpp + shellutils.h + stlutils.h + stringconstants.h + stringutils.h + toolchains.cpp + version.cpp + visualstudioversioninfo.cpp + visualstudioversioninfo.h + vsenvironmentdetector.cpp + vsenvironmentdetector.h + weakpointer.h + ) +list_transform_prepend(TOOLS_SOURCES tools/) + +set(TOOLS_HEADERS + architectures.h + buildoptions.h + cleanoptions.h + codelocation.h + commandechomode.h + error.h + generateoptions.h + installoptions.h + joblimits.h + preferences.h + processresult.h + profile.h + projectgeneratormanager.h + qbs_export.h + settings.h + settingsmodel.h + settingsrepresentation.h + setupprojectparameters.h + toolchains.h + version.h + ) +list_transform_prepend(TOOLS_HEADERS tools/) + +set(EXTERNAL_DEPENDS "") +if(APPLE) + set(TOOLS_MACOS_SOURCES + applecodesignutils.cpp + applecodesignutils.h + ) + list_transform_prepend(TOOLS_MACOS_SOURCES tools/) + set(EXTERNAL_DEPENDS "-framework Foundation" "-framework Security") +endif() + +if(WIN32) + set(EXTERNAL_DEPENDS "psapi" "shell32") +endif() + +add_qbs_library(corelib + DEFINES + "QBS_VERSION=\"${QBS_VERSION}\"" + "QBS_RELATIVE_LIBEXEC_PATH=\"${QBS_RELATIVE_LIBEXEC_PATH}\"" + ${QBS_UNIT_TESTS_DEFINES} + ${QBS_PROJECT_FILE_UPDATES_DEFINES} + DEPENDS + Qt5::CorePrivate Qt5::Gui Qt5::Network Qt5::Script Qt5::Xml ${EXTERNAL_DEPENDS} + PUBLIC_DEPENDS + Qt5::Core + INCLUDES + "${CMAKE_CURRENT_SOURCE_DIR}/../.." + SOURCES + ${QBS_HEADERS} + ${FILE_UPDATE_SOURCES} + ${API_SOURCES} + ${API_HEADERS} + ${BUILD_GRAPH_SOURCES} + ${BUILD_GRAPH_HEADERS} + ${GENERATORS_SOURCES} + ${GENERATORS_HEADERS} + ${JS_EXTENSIONS_SOURCES} + ${JS_EXTENSIONS_MACOS_SOURCES} + ${LANGUAGE_SOURCES} + ${LANGUAGE_HEADERS} + ${LOGGING_SOURCES} + ${LOGGING_HEADERS} + ${PARSER_SOURCES} + ${TOOLS_SOURCES} + ${TOOLS_HEADERS} + ${TOOLS_MACOS_SOURCES} + ) + +# not sure if there's a better way to do this +if(INSTALL_PUBLIC_HEADERS) + install(FILES ${QBS_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}) + install(FILES ${API_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/api) + install(FILES ${BUILD_GRAPH_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/buildgraph) + install(FILES ${GENERATORS_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/generators) + install(FILES ${LOGGING_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/logging) + install(FILES ${LANGUAGE_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/language) + install(FILES ${TOOLS_HEADERS} DESTINATION ${QBS_HEADERS_INSTALL_DIR}/tools) + set(QMAKE_PRI_FILES use_installed_corelib.pri ../../../qbs_version.pri) + install(FILES ${QMAKE_PRI_FILES} DESTINATION ${QBS_HEADERS_INSTALL_DIR}) +endif() diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs index 619c0f0e3..9f95f417f 100644 --- a/src/lib/corelib/corelib.qbs +++ b/src/lib/corelib/corelib.qbs @@ -258,7 +258,10 @@ QbsLibrary { prefix: "jsextensions/" condition: qbs.targetOS.contains("darwin") files: [ - "propertylist.mm", + // This is ugly, but because of QBS-1592 we cannot check the platform in the header + // using Q_OS_DARWIN + "propertylist_darwin.h", + "propertylist_darwin.mm", "propertylistutils.h", "propertylistutils.mm", ] diff --git a/src/lib/corelib/jsextensions/jsextensions.pri b/src/lib/corelib/jsextensions/jsextensions.pri index 2bffc9914..004a3e42a 100644 --- a/src/lib/corelib/jsextensions/jsextensions.pri +++ b/src/lib/corelib/jsextensions/jsextensions.pri @@ -18,8 +18,8 @@ SOURCES += \ $$PWD/utilitiesextension.cpp darwin { - HEADERS += $$PWD/propertylistutils.h - SOURCES += $$PWD/propertylist.mm $$PWD/propertylistutils.mm + HEADERS += $$PWD/propertylistutils.h $$PWD/propertylist_darwin.h + SOURCES += $$PWD/propertylist_darwin.mm $$PWD/propertylistutils.mm LIBS += -framework Foundation } else { SOURCES += $$PWD/propertylist.cpp diff --git a/src/lib/corelib/jsextensions/propertylist.h b/src/lib/corelib/jsextensions/propertylist_darwin.h index adb90f786..75900b144 100644 --- a/src/lib/corelib/jsextensions/propertylist.h +++ b/src/lib/corelib/jsextensions/propertylist_darwin.h @@ -43,31 +43,6 @@ #include <QtCore/qglobal.h> -// ### remove when qbs requires qbs 1.6 to build itself -#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) && defined(__APPLE__) && !defined(Q_OS_MAC) -#define Q_OS_MAC -#endif - -#ifndef Q_OS_MAC - -#include <QtScript/qscriptengine.h> - -namespace qbs { -namespace Internal { - -// provide a fake initializer for other platforms -void initializeJsExtensionPropertyList(QScriptValue extensionObject) -{ - // provide a fake object - QScriptEngine *engine = extensionObject.engine(); - extensionObject.setProperty(QLatin1String("PropertyList"), engine->newObject()); -} - -} // namespace Internal -} // namespace qbs - -#else // Q_OS_MAC - #include <QtCore/qobject.h> #include <QtCore/qstring.h> #include <QtCore/qvariant.h> @@ -82,13 +57,14 @@ void initializeJsExtensionPropertyList(QScriptValue extensionObject); class PropertyListPrivate; +// We need to have this class in the header since CMake's automoc doesn't handle .mm files class PropertyList : public QObject, public QScriptable { Q_OBJECT public: static QScriptValue ctor(QScriptContext *context, QScriptEngine *engine); PropertyList(QScriptContext *context); - ~PropertyList(); + ~PropertyList() override; Q_INVOKABLE bool isEmpty() const; Q_INVOKABLE void clear(); Q_INVOKABLE void readFromObject(const QScriptValue &value); @@ -110,6 +86,4 @@ private: Q_DECLARE_METATYPE(qbs::Internal::PropertyList *) -#endif // Q_OS_MAC - #endif // QBS_PROPERTYLIST_H diff --git a/src/lib/corelib/jsextensions/propertylist.mm b/src/lib/corelib/jsextensions/propertylist_darwin.mm index 2ae422c41..7a08b5e9f 100644 --- a/src/lib/corelib/jsextensions/propertylist.mm +++ b/src/lib/corelib/jsextensions/propertylist_darwin.mm @@ -38,6 +38,8 @@ ** ****************************************************************************/ +#include "propertylist_darwin.h" + #include <language/scriptengine.h> #include <tools/hostosinfo.h> @@ -62,31 +64,6 @@ enum { namespace qbs { namespace Internal { -class PropertyListPrivate; - -class PropertyList : public QObject, public QScriptable -{ - Q_OBJECT -public: - static QScriptValue ctor(QScriptContext *context, QScriptEngine *engine); - PropertyList(QScriptContext *context); - ~PropertyList() override; - Q_INVOKABLE bool isEmpty() const; - Q_INVOKABLE void clear(); - Q_INVOKABLE void readFromObject(const QScriptValue &value); - Q_INVOKABLE void readFromString(const QString &input); - Q_INVOKABLE void readFromFile(const QString &filePath); - Q_INVOKABLE void readFromData(const QByteArray &data); - Q_INVOKABLE void writeToFile(const QString &filePath, const QString &plistFormat); - Q_INVOKABLE QScriptValue format() const; - Q_INVOKABLE QScriptValue toObject() const; - Q_INVOKABLE QString toString(const QString &plistFormat) const; - Q_INVOKABLE QString toXMLString() const; - Q_INVOKABLE QString toJSON(const QString &style = QString()) const; -private: - PropertyListPrivate *d; -}; - class PropertyListPrivate { public: @@ -367,7 +344,3 @@ void initializeJsExtensionPropertyList(QScriptValue extensionObject) engine->newFunction(&PropertyList::ctor)); extensionObject.setProperty(QStringLiteral("PropertyList"), obj); } - -Q_DECLARE_METATYPE(qbs::Internal::PropertyList *) - -#include "propertylist.moc" diff --git a/src/lib/corelib/tools/preferences.cpp b/src/lib/corelib/tools/preferences.cpp index 4db271758..42fb5002a 100644 --- a/src/lib/corelib/tools/preferences.cpp +++ b/src/lib/corelib/tools/preferences.cpp @@ -63,6 +63,7 @@ Preferences::Preferences(Settings *settings, QVariantMap profileContents) { } +Preferences::~Preferences() = default; /*! * \brief Returns true <=> colored output should be used for printing messages. diff --git a/src/lib/corelib/tools/preferences.h b/src/lib/corelib/tools/preferences.h index 2824ebf2c..517bd442b 100644 --- a/src/lib/corelib/tools/preferences.h +++ b/src/lib/corelib/tools/preferences.h @@ -56,6 +56,7 @@ class QBS_EXPORT Preferences public: explicit Preferences(Settings *settings, QString profileName = QString()); Preferences(Settings *settings, QVariantMap profileContents); + ~Preferences(); bool useColoredOutput() const; int jobs() const; diff --git a/src/lib/msbuild/CMakeLists.txt b/src/lib/msbuild/CMakeLists.txt new file mode 100644 index 000000000..bce7a1dcf --- /dev/null +++ b/src/lib/msbuild/CMakeLists.txt @@ -0,0 +1,72 @@ +set(SOLUTION_SOURCES + ivisualstudiosolutionproject.cpp + ivisualstudiosolutionproject.h + visualstudiosolutionfileproject.cpp + visualstudiosolutionfileproject.h + visualstudiosolutionfolderproject.cpp + visualstudiosolutionfolderproject.h + visualstudiosolution.cpp + visualstudiosolution.h + visualstudiosolutionglobalsection.cpp + visualstudiosolutionglobalsection.h + ) +list_transform_prepend(SOLUTION_SOURCES solution/) + +set(MSBUILD_SOURCES + imsbuildgroup.cpp + imsbuildgroup.h + imsbuildnode.cpp + imsbuildnode.h + imsbuildnodevisitor.h + msbuildimport.cpp + msbuildimport.h + msbuildimportgroup.cpp + msbuildimportgroup.h + msbuilditem.cpp + msbuilditem.h + msbuilditemdefinitiongroup.cpp + msbuilditemdefinitiongroup.h + msbuilditemgroup.cpp + msbuilditemgroup.h + msbuilditemmetadata.cpp + msbuilditemmetadata.h + msbuildproject.cpp + msbuildproject.h + msbuildproperty.cpp + msbuildproperty.h + msbuildpropertybase.cpp + msbuildpropertybase.h + msbuildpropertygroup.cpp + msbuildpropertygroup.h + ) +list_transform_prepend(MSBUILD_SOURCES msbuild/) + +set(MSBUILD_ITEMS_SOURCES + msbuildclcompile.cpp + msbuildclcompile.h + msbuildclinclude.cpp + msbuildclinclude.h + msbuildfileitem.cpp + msbuildfileitem.h + msbuildfilter.cpp + msbuildfilter.h + msbuildlink.cpp + msbuildlink.h + msbuildnone.cpp + msbuildnone.h + ) +list_transform_prepend(MSBUILD_ITEMS_SOURCES msbuild/items/) + +set(IO_SOURCES + msbuildprojectwriter.cpp + msbuildprojectwriter.h + visualstudiosolutionwriter.cpp + visualstudiosolutionwriter.h + ) +list_transform_prepend(IO_SOURCES io/) + +add_qbs_library(qbsmsbuild + STATIC + DEPENDS corelib + SOURCES ${SOLUTION_SOURCES} ${MSBUILD_SOURCES} ${MSBUILD_ITEMS_SOURCES} ${IO_SOURCES} + ) diff --git a/src/libexec/CMakeLists.txt b/src/libexec/CMakeLists.txt new file mode 100644 index 000000000..dcf87ae88 --- /dev/null +++ b/src/libexec/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(qbs_processlauncher) diff --git a/src/libexec/qbs_processlauncher/CMakeLists.txt b/src/libexec/qbs_processlauncher/CMakeLists.txt new file mode 100644 index 000000000..f9a8c1b4c --- /dev/null +++ b/src/libexec/qbs_processlauncher/CMakeLists.txt @@ -0,0 +1,25 @@ +set(SOURCES + launcherlogging.cpp + launcherlogging.h + launchersockethandler.cpp + launchersockethandler.h + processlauncher-main.cpp + ) + +set(PATH_TO_PROTOCOL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../lib/corelib/tools") +set(PROTOCOL_SOURCES + launcherpackets.cpp + launcherpackets.h + ) +list_transform_prepend(PROTOCOL_SOURCES ${PATH_TO_PROTOCOL_SOURCES}/) + +add_qbs_app(qbs_processlauncher + DESTINATION ${QBS_LIBEXEC_PATH} + DEPENDS Qt5::Core Qt5::Network + INCLUDES ${PATH_TO_PROTOCOL_SOURCES} + SOURCES ${SOURCES} ${PROTOCOL_SOURCES} + ) +set_target_properties(qbs_processlauncher PROPERTIES + BUILD_RPATH "${QBS_LIBEXEC_RPATH}" + INSTALL_RPATH "${QBS_LIBEXEC_RPATH}" + ) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt new file mode 100644 index 000000000..659468aa4 --- /dev/null +++ b/src/plugins/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(generator) +add_subdirectory(scanner) diff --git a/src/plugins/generator/CMakeLists.txt b/src/plugins/generator/CMakeLists.txt new file mode 100644 index 000000000..738e428bc --- /dev/null +++ b/src/plugins/generator/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(clangcompilationdb) +add_subdirectory(iarew) +add_subdirectory(keiluv) +add_subdirectory(makefilegenerator) +add_subdirectory(visualstudio) diff --git a/src/plugins/generator/clangcompilationdb/CMakeLists.txt b/src/plugins/generator/clangcompilationdb/CMakeLists.txt new file mode 100644 index 000000000..b7c50b746 --- /dev/null +++ b/src/plugins/generator/clangcompilationdb/CMakeLists.txt @@ -0,0 +1,10 @@ +set(SOURCES + clangcompilationdbgenerator.cpp + clangcompilationdbgenerator.h + clangcompilationdbgeneratorplugin.cpp + ) + +add_qbs_plugin(clangcompilationdbgenerator + DEPENDS corelib + SOURCES ${SOURCES} + ) diff --git a/src/plugins/generator/iarew/CMakeLists.txt b/src/plugins/generator/iarew/CMakeLists.txt new file mode 100644 index 000000000..e08f3ff9d --- /dev/null +++ b/src/plugins/generator/iarew/CMakeLists.txt @@ -0,0 +1,119 @@ +set(COMMON_SOURCES + iarewfileversionproperty.cpp + iarewfileversionproperty.h + iarewgenerator.cpp + iarewgenerator.h + iarewgeneratorplugin.cpp + iarewoptionpropertygroup.cpp + iarewoptionpropertygroup.h + iarewproject.cpp + iarewproject.h + iarewprojectwriter.cpp + iarewprojectwriter.h + iarewsettingspropertygroup.cpp + iarewsettingspropertygroup.h + iarewsourcefilepropertygroup.cpp + iarewsourcefilepropertygroup.h + iarewsourcefilespropertygroup.cpp + iarewsourcefilespropertygroup.h + iarewtoolchainpropertygroup.cpp + iarewtoolchainpropertygroup.h + iarewutils.cpp + iarewutils.h + iarewversioninfo.h + iarewworkspace.cpp + iarewworkspace.h + iarewworkspacewriter.cpp + iarewworkspacewriter.h + ) + +set(ARCHS_ARM_SOURCES + armarchiversettingsgroup_v8.cpp + armarchiversettingsgroup_v8.h + armassemblersettingsgroup_v8.cpp + armassemblersettingsgroup_v8.h + armbuildconfigurationgroup_v8.cpp + armbuildconfigurationgroup_v8.h + armcompilersettingsgroup_v8.cpp + armcompilersettingsgroup_v8.h + armgeneralsettingsgroup_v8.cpp + armgeneralsettingsgroup_v8.h + armlinkersettingsgroup_v8.cpp + armlinkersettingsgroup_v8.h + ) +list_transform_prepend(ARCHS_ARM_SOURCES archs/arm/) + +set(ARCHS_AVR_SOURCES + avrarchiversettingsgroup_v7.cpp + avrarchiversettingsgroup_v7.h + avrassemblersettingsgroup_v7.cpp + avrassemblersettingsgroup_v7.h + avrbuildconfigurationgroup_v7.cpp + avrbuildconfigurationgroup_v7.h + avrcompilersettingsgroup_v7.cpp + avrcompilersettingsgroup_v7.h + avrgeneralsettingsgroup_v7.cpp + avrgeneralsettingsgroup_v7.h + avrlinkersettingsgroup_v7.cpp + avrlinkersettingsgroup_v7.h + ) +list_transform_prepend(ARCHS_AVR_SOURCES archs/avr/) + +set(ARCHS_MCS51_SOURCES + mcs51archiversettingsgroup_v10.cpp + mcs51archiversettingsgroup_v10.h + mcs51assemblersettingsgroup_v10.cpp + mcs51assemblersettingsgroup_v10.h + mcs51buildconfigurationgroup_v10.cpp + mcs51buildconfigurationgroup_v10.h + mcs51compilersettingsgroup_v10.cpp + mcs51compilersettingsgroup_v10.h + mcs51generalsettingsgroup_v10.cpp + mcs51generalsettingsgroup_v10.h + mcs51linkersettingsgroup_v10.cpp + mcs51linkersettingsgroup_v10.h + ) +list_transform_prepend(ARCHS_MCS51_SOURCES archs/mcs51/) + +set(ARCHS_STM8_SOURCES + stm8archiversettingsgroup_v3.cpp + stm8archiversettingsgroup_v3.h + stm8assemblersettingsgroup_v3.cpp + stm8assemblersettingsgroup_v3.h + stm8buildconfigurationgroup_v3.cpp + stm8buildconfigurationgroup_v3.h + stm8compilersettingsgroup_v3.cpp + stm8compilersettingsgroup_v3.h + stm8generalsettingsgroup_v3.cpp + stm8generalsettingsgroup_v3.h + stm8linkersettingsgroup_v3.cpp + stm8linkersettingsgroup_v3.h + ) +list_transform_prepend(ARCHS_STM8_SOURCES archs/stm8/) + +set(ARCHS_MSP430_SOURCES + msp430archiversettingsgroup_v7.cpp + msp430archiversettingsgroup_v7.h + msp430assemblersettingsgroup_v7.cpp + msp430assemblersettingsgroup_v7.h + msp430buildconfigurationgroup_v7.cpp + msp430buildconfigurationgroup_v7.h + msp430compilersettingsgroup_v7.cpp + msp430compilersettingsgroup_v7.h + msp430generalsettingsgroup_v7.cpp + msp430generalsettingsgroup_v7.h + msp430linkersettingsgroup_v7.cpp + msp430linkersettingsgroup_v7.h + ) +list_transform_prepend(ARCHS_MSP430_SOURCES archs/msp430/) + +add_qbs_plugin(iarewgenerator + DEPENDS corelib qbsjson + SOURCES + ${COMMON_SOURCES} + ${ARCHS_ARM_SOURCES} + ${ARCHS_AVR_SOURCES} + ${ARCHS_MCS51_SOURCES} + ${ARCHS_STM8_SOURCES} + ${ARCHS_MSP430_SOURCES} + ) diff --git a/src/plugins/generator/keiluv/CMakeLists.txt b/src/plugins/generator/keiluv/CMakeLists.txt new file mode 100644 index 000000000..68229a2bc --- /dev/null +++ b/src/plugins/generator/keiluv/CMakeLists.txt @@ -0,0 +1,80 @@ +set(COMMON_SOURCES + keiluvfilesgroupspropertygroup.cpp + keiluvfilesgroupspropertygroup.h + keiluvgenerator.cpp + keiluvgenerator.h + keiluvgeneratorplugin.cpp + keiluvproject.cpp + keiluvproject.h + keiluvprojectwriter.cpp + keiluvprojectwriter.h + keiluvutils.cpp + keiluvutils.h + keiluvversioninfo.h + keiluvworkspace.cpp + keiluvworkspace.h + keiluvworkspacewriter.cpp + keiluvworkspacewriter.h + ) + +set(ARCHS_ARM_SOURCES + armbuildtargetgroup_v5.cpp + armbuildtargetgroup_v5.h + armcommonpropertygroup_v5.cpp + armcommonpropertygroup_v5.h + armdebugoptiongroup_v5.cpp + armdebugoptiongroup_v5.h + armdlloptiongroup_v5.cpp + armdlloptiongroup_v5.h + armtargetassemblergroup_v5.cpp + armtargetassemblergroup_v5.h + armtargetcommonoptionsgroup_v5.cpp + armtargetcommonoptionsgroup_v5.h + armtargetcompilergroup_v5.cpp + armtargetcompilergroup_v5.h + armtargetgroup_v5.cpp + armtargetgroup_v5.h + armtargetlinkergroup_v5.cpp + armtargetlinkergroup_v5.h + armtargetmiscgroup_v5.cpp + armtargetmiscgroup_v5.h + armutilitiesgroup_v5.cpp + armutilitiesgroup_v5.h + ) +list_transform_prepend(ARCHS_ARM_SOURCES archs/arm/) + +set(ARCHS_MCS51_SOURCES + mcs51buildtargetgroup_v5.cpp + mcs51buildtargetgroup_v5.h + mcs51commonpropertygroup_v5.cpp + mcs51commonpropertygroup_v5.h + mcs51debugoptiongroup_v5.cpp + mcs51debugoptiongroup_v5.h + mcs51dlloptiongroup_v5.cpp + mcs51dlloptiongroup_v5.h + mcs51targetassemblergroup_v5.cpp + mcs51targetassemblergroup_v5.h + mcs51targetcommonoptionsgroup_v5.cpp + mcs51targetcommonoptionsgroup_v5.h + mcs51targetcompilergroup_v5.cpp + mcs51targetcompilergroup_v5.h + mcs51targetgroup_v5.cpp + mcs51targetgroup_v5.h + mcs51targetlinkergroup_v5.cpp + mcs51targetlinkergroup_v5.h + mcs51targetmiscgroup_v5.cpp + mcs51targetmiscgroup_v5.h + mcs51utilitiesgroup_v5.cpp + mcs51utilitiesgroup_v5.h + mcs51utils.cpp + mcs51utils.h + ) +list_transform_prepend(ARCHS_MCS51_SOURCES archs/mcs51/) + +add_qbs_plugin(keiluvgenerator + DEPENDS corelib qbsjson + SOURCES + ${COMMON_SOURCES} + ${ARCHS_ARM_SOURCES} + ${ARCHS_MCS51_SOURCES} + ) diff --git a/src/plugins/generator/makefilegenerator/CMakeLists.txt b/src/plugins/generator/makefilegenerator/CMakeLists.txt new file mode 100644 index 000000000..bf6abae73 --- /dev/null +++ b/src/plugins/generator/makefilegenerator/CMakeLists.txt @@ -0,0 +1,10 @@ +set(SOURCES + makefilegenerator.cpp + makefilegenerator.h + makefilegeneratorplugin.cpp + ) + +add_qbs_plugin(makefilegenerator + DEPENDS corelib + SOURCES ${SOURCES} + ) diff --git a/src/plugins/generator/visualstudio/CMakeLists.txt b/src/plugins/generator/visualstudio/CMakeLists.txt new file mode 100644 index 000000000..cd83e0b66 --- /dev/null +++ b/src/plugins/generator/visualstudio/CMakeLists.txt @@ -0,0 +1,25 @@ +set(SOURCES + msbuildfiltersproject.cpp + msbuildfiltersproject.h + msbuildqbsgenerateproject.cpp + msbuildqbsgenerateproject.h + msbuildqbsproductproject.cpp + msbuildqbsproductproject.h + msbuildsharedsolutionpropertiesproject.cpp + msbuildsharedsolutionpropertiesproject.h + msbuildsolutionpropertiesproject.cpp + msbuildsolutionpropertiesproject.h + msbuildtargetproject.cpp + msbuildtargetproject.h + msbuildutils.h + visualstudiogenerator.cpp + visualstudiogenerator.h + visualstudioguidpool.cpp + visualstudioguidpool.h + visualstudiogeneratorplugin.cpp + ) + +add_qbs_plugin(visualstudiogenerator + DEPENDS corelib qbsmsbuild qbsjson + SOURCES ${SOURCES} + ) diff --git a/src/plugins/scanner/CMakeLists.txt b/src/plugins/scanner/CMakeLists.txt new file mode 100644 index 000000000..e4cbfb9e7 --- /dev/null +++ b/src/plugins/scanner/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(cpp) +add_subdirectory(qt) diff --git a/src/plugins/scanner/cpp/CMakeLists.txt b/src/plugins/scanner/cpp/CMakeLists.txt new file mode 100644 index 000000000..b394dd74d --- /dev/null +++ b/src/plugins/scanner/cpp/CMakeLists.txt @@ -0,0 +1,16 @@ +set(SOURCES + ../scanner.h + CPlusPlusForwardDeclarations.h + Lexer.cpp + Lexer.h + Token.cpp + Token.h + cpp_global.h + cppscanner.cpp + ) + +add_qbs_plugin(qbs_cpp_scanner + DEFINES "CPLUSPLUS_NO_PARSER" + DEPENDS corelib + SOURCES ${SOURCES} + ) diff --git a/src/plugins/scanner/qt/CMakeLists.txt b/src/plugins/scanner/qt/CMakeLists.txt new file mode 100644 index 000000000..69771fa3a --- /dev/null +++ b/src/plugins/scanner/qt/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qbs_plugin(qbs_qt_scanner + DEPENDS corelib + SOURCES ../scanner.h qtscanner.cpp + ) diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt new file mode 100644 index 000000000..7a340d53d --- /dev/null +++ b/src/shared/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(json) diff --git a/src/shared/json/CMakeLists.txt b/src/shared/json/CMakeLists.txt new file mode 100644 index 000000000..a25124cd9 --- /dev/null +++ b/src/shared/json/CMakeLists.txt @@ -0,0 +1,4 @@ +add_qbs_library(qbsjson + STATIC + SOURCES json.cpp json.h + ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 000000000..3a868fbac --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(auto) +add_subdirectory(benchmarker) +add_subdirectory(fuzzy-test) diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt new file mode 100644 index 000000000..6f6097787 --- /dev/null +++ b/tests/auto/CMakeLists.txt @@ -0,0 +1,9 @@ +add_subdirectory(api) +add_subdirectory(cmdlineparser) +add_subdirectory(blackbox) + +if(WITH_UNIT_TESTS) + add_subdirectory(buildgraph) + add_subdirectory(language) + add_subdirectory(tools) +endif() diff --git a/tests/auto/api/CMakeLists.txt b/tests/auto/api/CMakeLists.txt new file mode 100644 index 000000000..67384d9ac --- /dev/null +++ b/tests/auto/api/CMakeLists.txt @@ -0,0 +1,10 @@ +add_qbs_test(api + DEFINES + "QBS_RELATIVE_LIBEXEC_PATH=\"${QBS_RELATIVE_LIBEXEC_PATH}\"" + "QBS_RELATIVE_SEARCH_PATH=\"${QBS_RELATIVE_SEARCH_PATH}\"" + "QBS_RELATIVE_PLUGINS_PATH=\"${QBS_RELATIVE_PLUGINS_PATH}\"" + ${QBS_PROJECT_FILE_UPDATES_DEFINES} + SOURCES + tst_api.cpp + tst_api.h + ) diff --git a/tests/auto/blackbox/CMakeLists.txt b/tests/auto/blackbox/CMakeLists.txt new file mode 100644 index 000000000..88eed4b42 --- /dev/null +++ b/tests/auto/blackbox/CMakeLists.txt @@ -0,0 +1,72 @@ +add_qbs_test(blackbox + DEFINES + ${QBS_UNIT_TESTS_DEFINES} + SOURCES + ../shared.h + tst_blackboxbase.cpp + tst_blackboxbase.h + tst_blackbox.cpp + tst_blackbox.h + ) + +add_qbs_test(blackbox-android + SOURCES + ../shared.h + tst_blackboxbase.cpp + tst_blackboxbase.h + tst_blackboxandroid.cpp + tst_blackboxandroid.h + ) + +add_qbs_test(blackbox-apple + SOURCES + ../shared.h + tst_blackboxbase.cpp + tst_blackboxbase.h + tst_blackboxapple.cpp + tst_blackboxapple.h + ) + +add_qbs_test(blackbox-baremetal + SOURCES + ../shared.h + tst_blackboxbase.cpp + tst_blackboxbase.h + tst_blackboxbaremetal.cpp + tst_blackboxbaremetal.h + ) + +add_qbs_test(blackbox-clangdb + SOURCES + ../shared.h + tst_blackboxbase.cpp + tst_blackboxbase.h + tst_clangdb.cpp + tst_clangdb.h + ) + +add_qbs_test(blackbox-java + SOURCES + ../shared.h + tst_blackboxbase.cpp + tst_blackboxbase.h + tst_blackboxjava.cpp + tst_blackboxjava.h + ) + +add_qbs_test(blackbox-joblimits + SOURCES + ../shared.h + tst_blackboxbase.cpp + tst_blackboxbase.h + tst_blackboxjoblimits.cpp + ) + +add_qbs_test(blackbox-qt + SOURCES + ../shared.h + tst_blackboxbase.cpp + tst_blackboxbase.h + tst_blackboxqt.cpp + tst_blackboxqt.h + ) diff --git a/tests/auto/buildgraph/CMakeLists.txt b/tests/auto/buildgraph/CMakeLists.txt new file mode 100644 index 000000000..a3019295e --- /dev/null +++ b/tests/auto/buildgraph/CMakeLists.txt @@ -0,0 +1,5 @@ +add_qbs_test(buildgraph + SOURCES + tst_buildgraph.cpp + tst_buildgraph.h + ) diff --git a/tests/auto/cmdlineparser/CMakeLists.txt b/tests/auto/cmdlineparser/CMakeLists.txt new file mode 100644 index 000000000..bf072e24d --- /dev/null +++ b/tests/auto/cmdlineparser/CMakeLists.txt @@ -0,0 +1,23 @@ +set(PARSER_SOURCES + commandlineoption.cpp + commandlineoption.h + commandlineoptionpool.cpp + commandlineoptionpool.h + commandlineparser.cpp + commandlineparser.h + commandpool.cpp + commandpool.h + commandtype.h + parsercommand.cpp + parsercommand.h + ) +list_transform_prepend(PARSER_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/app/qbs/parser/") + +add_qbs_test(cmdlineparser + DEFINES + "QBS_VERSION=\"${QBS_VERSION}\"" + INCLUDES + "${CMAKE_CURRENT_SOURCE_DIR}/../../../src" + SOURCES + tst_cmdlineparser.cpp ../../../src/app/qbs/qbstool.cpp ${PARSER_SOURCES} + ) diff --git a/tests/auto/language/CMakeLists.txt b/tests/auto/language/CMakeLists.txt new file mode 100644 index 000000000..008a66fe0 --- /dev/null +++ b/tests/auto/language/CMakeLists.txt @@ -0,0 +1,9 @@ +add_qbs_test(language + DEFINES + "QBS_VERSION=\"${QBS_VERSION}\"" + DEPENDS + Qt5::Script + SOURCES + tst_language.cpp + tst_language.h + ) diff --git a/tests/auto/tools/CMakeLists.txt b/tests/auto/tools/CMakeLists.txt new file mode 100644 index 000000000..a75d998a3 --- /dev/null +++ b/tests/auto/tools/CMakeLists.txt @@ -0,0 +1,7 @@ +add_qbs_test(tools + DEFINES + "QBS_VERSION=\"${QBS_VERSION}\"" + SOURCES + tst_tools.cpp + tst_tools.h + ) diff --git a/tests/benchmarker/CMakeLists.txt b/tests/benchmarker/CMakeLists.txt new file mode 100644 index 000000000..d77d6d9c4 --- /dev/null +++ b/tests/benchmarker/CMakeLists.txt @@ -0,0 +1,18 @@ +set(SOURCES + activities.h + benchmarker-main.cpp + benchmarker.cpp + benchmarker.h + commandlineparser.cpp + commandlineparser.h + exception.h + runsupport.cpp + runsupport.h + valgrindrunner.cpp + valgrindrunner.h + ) + +add_qbs_app(qbs_benchmarker + DEPENDS Qt5::Core Qt5::Concurrent + SOURCES ${SOURCES} + ) diff --git a/tests/fuzzy-test/CMakeLists.txt b/tests/fuzzy-test/CMakeLists.txt new file mode 100644 index 000000000..fe3a1a54e --- /dev/null +++ b/tests/fuzzy-test/CMakeLists.txt @@ -0,0 +1,12 @@ +set(SOURCES + commandlineparser.cpp + commandlineparser.h + fuzzytester.cpp + fuzzytester.h + main.cpp + ) + +add_qbs_app(qbs_fuzzy-test + DEPENDS Qt5::Core + SOURCES ${SOURCES} + ) |