Merge topic 'ninja-autogen'
e8fdd5f1 QtAutogen: Workaround rcc CRCRLF newlines on Windows (#15459) 15f1a6b4 Tests/QtAutogen: Avoid touching files in the source tree 3f7c7c65 Tests/QtAutogen: Help Qt5Autogen test find Qt5 on Windows 26b5cc5e Tests/QtAutogen: Enable per-config source tests when possible 45566408 Tests/QtAutogen: Require CMake 3.1 to set policies everywhere
This commit is contained in:
commit
9efee16a7a
@ -202,6 +202,13 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
|
|||||||
std::string oline;
|
std::string oline;
|
||||||
while(std::getline(ostr, oline))
|
while(std::getline(ostr, oline))
|
||||||
{
|
{
|
||||||
|
// Strip CR characters rcc may have printed (possibly more than one!).
|
||||||
|
std::string::size_type cr = oline.find('\r');
|
||||||
|
if (cr != oline.npos)
|
||||||
|
{
|
||||||
|
oline = oline.substr(0, cr);
|
||||||
|
}
|
||||||
|
|
||||||
if (oline.empty())
|
if (oline.empty())
|
||||||
{
|
{
|
||||||
// The output of rcc --list contains many empty lines.
|
// The output of rcc --list contains many empty lines.
|
||||||
|
@ -1186,10 +1186,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
|||||||
set(run_autogen_test QtAutogen)
|
set(run_autogen_test QtAutogen)
|
||||||
set(run_autouic_test QtAutoUicInterface)
|
set(run_autouic_test QtAutoUicInterface)
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
|
set(QtAutogen_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$<CONFIGURATION>)
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(Qt5Widgets QUIET NO_MODULE)
|
find_package(Qt5Widgets QUIET NO_MODULE)
|
||||||
if(Qt5Widgets_FOUND)
|
if(Qt5Widgets_FOUND)
|
||||||
add_test(Qt5Autogen ${CMAKE_CTEST_COMMAND}
|
add_test(NAME Qt5Autogen COMMAND ${CMAKE_CTEST_COMMAND}
|
||||||
--build-and-test
|
--build-and-test
|
||||||
"${CMake_SOURCE_DIR}/Tests/QtAutogen"
|
"${CMake_SOURCE_DIR}/Tests/QtAutogen"
|
||||||
"${CMake_BINARY_DIR}/Tests/Qt5Autogen"
|
"${CMake_BINARY_DIR}/Tests/Qt5Autogen"
|
||||||
@ -1199,6 +1202,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
|||||||
--force-new-ctest-process
|
--force-new-ctest-process
|
||||||
--build-options ${build_options}
|
--build-options ${build_options}
|
||||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
|
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5
|
||||||
|
${QtAutogen_BUILD_OPTIONS}
|
||||||
--test-command ${run_autogen_test}
|
--test-command ${run_autogen_test}
|
||||||
)
|
)
|
||||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen")
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen")
|
||||||
@ -1218,7 +1222,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
|||||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface")
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface")
|
||||||
endif()
|
endif()
|
||||||
if(QT4_WORKS AND QT_QTGUI_FOUND)
|
if(QT4_WORKS AND QT_QTGUI_FOUND)
|
||||||
add_test(Qt4Autogen ${CMAKE_CTEST_COMMAND}
|
add_test(NAME Qt4Autogen COMMAND ${CMAKE_CTEST_COMMAND}
|
||||||
--build-and-test
|
--build-and-test
|
||||||
"${CMake_SOURCE_DIR}/Tests/QtAutogen"
|
"${CMake_SOURCE_DIR}/Tests/QtAutogen"
|
||||||
"${CMake_BINARY_DIR}/Tests/Qt4Autogen"
|
"${CMake_BINARY_DIR}/Tests/Qt4Autogen"
|
||||||
@ -1228,6 +1232,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
|||||||
--force-new-ctest-process
|
--force-new-ctest-process
|
||||||
--build-options ${build_options}
|
--build-options ${build_options}
|
||||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
|
-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=4
|
||||||
|
${QtAutogen_BUILD_OPTIONS}
|
||||||
--test-command ${run_autogen_test}
|
--test-command ${run_autogen_test}
|
||||||
)
|
)
|
||||||
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen")
|
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen")
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.11)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
|
|
||||||
project(QtAutogen)
|
project(QtAutogen)
|
||||||
|
|
||||||
|
# Tell find_package(Qt5) where to find Qt.
|
||||||
|
if(QT_QMAKE_EXECUTABLE)
|
||||||
|
get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH)
|
||||||
|
get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH)
|
||||||
|
set(CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
if (QT_TEST_VERSION STREQUAL 4)
|
if (QT_TEST_VERSION STREQUAL 4)
|
||||||
find_package(Qt4 REQUIRED)
|
find_package(Qt4 REQUIRED)
|
||||||
|
|
||||||
@ -67,10 +74,9 @@ add_custom_command(
|
|||||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in"
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in"
|
||||||
)
|
)
|
||||||
|
|
||||||
message("CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
|
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_GENERATOR STREQUAL Ninja)
|
||||||
if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]" AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
||||||
set(debug_srcs "$<$<CONFIG:Debug>:debug_class.cpp>" $<$<CONFIG:Debug>:debug_resource.qrc>)
|
set(debug_srcs "$<$<CONFIG:Debug>:debug_class.cpp>" $<$<CONFIG:Debug>:debug_resource.qrc>)
|
||||||
add_definitions(-DTEST_DEBUG_CLASS)
|
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:TEST_DEBUG_CLASS>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# The -no-protection option disables the generation of include guards. Verify
|
# The -no-protection option disables the generation of include guards. Verify
|
||||||
@ -125,6 +131,7 @@ try_compile(RCC_DEPENDS
|
|||||||
"${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends"
|
"${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends"
|
||||||
autorcc_depends
|
autorcc_depends
|
||||||
CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
|
CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
|
||||||
|
"-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}"
|
||||||
OUTPUT_VARIABLE output
|
OUTPUT_VARIABLE output
|
||||||
)
|
)
|
||||||
if (NOT RCC_DEPENDS)
|
if (NOT RCC_DEPENDS)
|
||||||
@ -140,7 +147,7 @@ set(timeformat "%Y%j%H%M%S")
|
|||||||
file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}")
|
file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}")
|
||||||
|
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends/res1_input.txt")
|
execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/res1/input.txt")
|
||||||
|
|
||||||
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 2.8)
|
cmake_minimum_required(VERSION 3.1)
|
||||||
project(autorcc_depends)
|
project(autorcc_depends)
|
||||||
|
|
||||||
set(CMAKE_AUTORCC ON)
|
set(CMAKE_AUTORCC ON)
|
||||||
@ -15,9 +15,12 @@ else()
|
|||||||
set(QT_CORE_TARGET Qt5::Core)
|
set(QT_CORE_TARGET Qt5::Core)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
configure_file(res1.qrc.in res1.qrc @ONLY)
|
||||||
|
configure_file(res1/input.txt.in res1/input.txt @ONLY)
|
||||||
|
|
||||||
add_executable(test_res1
|
add_executable(test_res1
|
||||||
test_res1.cpp
|
test_res1.cpp
|
||||||
res1.qrc
|
${CMAKE_CURRENT_BINARY_DIR}/res1.qrc
|
||||||
)
|
)
|
||||||
target_link_libraries(test_res1 ${QT_CORE_TARGET})
|
target_link_libraries(test_res1 ${QT_CORE_TARGET})
|
||||||
add_custom_command(TARGET test_res1 POST_BUILD COMMAND
|
add_custom_command(TARGET test_res1 POST_BUILD COMMAND
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>res1_input.txt</file>
|
<file>res1/input.txt</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
Loading…
x
Reference in New Issue
Block a user