diff options
34 files changed, 195 insertions, 143 deletions
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index ba858bd..a0aacb4 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -54,6 +54,9 @@ if(${CPACK_SYSTEM_NAME} MATCHES Windows) endif() endif() +# Command for configure IFW script templates +include(${CMake_SOURCE_DIR}/Modules/CPackIFWConfigureFile.cmake) + # Advanced IFW configuration set(_cpifwrc CPACK_IFW_COMPONENT_GROUP_CMAKE_) set(_cpifwrcconf _CPACK_IFW_COMPONENT_GROUP_CMAKE) @@ -85,8 +88,6 @@ _cmifwarg("Package <Default> tag (values: TRUE, FALSE, SCRIPT)" _cmifwarg("Package <Version> tag" STRING VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") -_cmifwarg("Package <Script> tag" - FILEPATH SCRIPT "${CMake_BINARY_DIR}/installscript.qs") _cmifwarg("Package <SortingPriority> tag" STRING PRIORITY "100") _cmifwarg("Package <ForsedInstallation> tag" @@ -148,33 +149,22 @@ if(CMake_INSTALL_COMPONENTS) set(CPACK_COMPONENTS_ALL \"${_CPACK_IFW_COMPONENTS_ALL}\") set(CPACK_COMPONENTS_GROUPING IGNORE) ") + _cmifwarg("Package <Script> template" + FILEPATH SCRIPT_TEMPLATE "${CMake_SOURCE_DIR}/Source/QtIFW/CMake.qs.in") else() if(BUILD_QtDialog AND USE_LGPL) set(${_cpifwrc}LICENSES_DEFAULT "${${_cpifwrc}LICENSES_DEFAULT};LGPLv${USE_LGPL};${CMake_SOURCE_DIR}/Licenses/LGPLv${USE_LGPL}.txt") endif() + _cmifwarg("Package <Script> template" + FILEPATH SCRIPT_TEMPLATE "${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in") endif() +_cmifwarg("Package <Script> generated" + FILEPATH SCRIPT_GENERATED "${CMake_BINARY_DIR}/CMake.qs") _cmifwarg("Package <Licenses> tag (pairs of <display_name> <file_path>)" STRING LICENSES "${${_cpifwrc}LICENSES_DEFAULT}") -# Components scripts configuration -if(CMake_INSTALL_COMPONENTS) - configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/CMake.qs.in" - "${CMake_BINARY_DIR}/installscript.qs" @ONLY - ) -else() - configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in" - "${CMake_BINARY_DIR}/installscript.qs" @ONLY - ) -endif() -foreach(_script - CMake.Documentation.SphinxHTML - CMake.DeveloperReference.HTML) - configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in" - "${CMake_BINARY_DIR}/${_script}.qs" @ONLY) -endforeach() - if(${CMAKE_SYSTEM_NAME} MATCHES Windows) set(_CPACK_IFW_PACKAGE_ICON "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")") @@ -199,6 +189,23 @@ if(${CMAKE_SYSTEM_NAME} MATCHES Linux) set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}") endif() +# Components scripts configuration +if((EXISTS "${CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE}") + AND (NOT "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}" STREQUAL "") + AND (NOT "${CMake_IFW_ROOT_COMPONENT_SCRIPT}")) + cpack_ifw_configure_file("${CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE}" + "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}") + _cmifwarg("Package <Script> tag" + FILEPATH SCRIPT "${CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED}") +endif() +foreach(_script + CMake.Dialogs.QtGUI + CMake.Documentation.SphinxHTML + CMake.DeveloperReference.HTML) + cpack_ifw_configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/${_script}.qs.in" + "${CMake_BINARY_DIR}/${_script}.qs") +endforeach() + if(NOT DEFINED CPACK_PACKAGE_FILE_NAME) # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache # default to source package - system, on cygwin system is not diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 99746b0..ad0c245 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -132,7 +132,7 @@ if(CPACK_GENERATOR MATCHES "IFW") set(CPACK_COMPONENT_CMAKE-GUI_GROUP Dialogs) set(CPACK_IFW_COMPONENT_CMAKE-GUI_NAME "QtGUI") set(CPACK_IFW_COMPONENT_CMAKE-GUI_SCRIPT - "@CMake_SOURCE_DIR@/Source/QtIFW/CMake.Dialogs.QtGUI.qs") + "@CMake_BINARY_DIR@/CMake.Dialogs.QtGUI.qs") set(CPACK_IFW_COMPONENT_CMAKE-GUI_VERSION "@CMake_IFW_ROOT_COMPONENT_VERSION@") @_CPACK_IFW_COMPONENT_CMAKE-GUI_LICENSES@ diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in index 1ba42d9..7e8efa7 100644 --- a/Modules/CMakeCUDACompiler.cmake.in +++ b/Modules/CMakeCUDACompiler.cmake.in @@ -13,6 +13,8 @@ set(CMAKE_CUDA_HOST_COMPILER_ENV_VAR "CUDAHOSTCXX") set(CMAKE_CUDA_COMPILER_ID_RUN 1) set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu) +set(CMAKE_CUDA_LINKER_PREFERENCE 10) +set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1) set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES@") set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES@") diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake index abc4b66..13b1789 100644 --- a/Modules/CMakeCUDAInformation.cmake +++ b/Modules/CMakeCUDAInformation.cmake @@ -187,7 +187,7 @@ if(NOT CMAKE_CUDA_DEVICE_LINK_LIBRARY) endif() if(NOT CMAKE_CUDA_DEVICE_LINK_EXECUTABLE) set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") + "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> ${CMAKE_CUDA_COMPILE_OPTIONS_PIC} -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") endif() mark_as_advanced( diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake index 5f049e7..ef08062 100644 --- a/Modules/CheckFunctionExists.cmake +++ b/Modules/CheckFunctionExists.cmake @@ -5,18 +5,16 @@ # CheckFunctionExists # ------------------- # -# Check if a C function can be linked +# Check if a C function can be linked:: # -# CHECK_FUNCTION_EXISTS(<function> <variable>) +# check_function_exists(<function> <variable>) # -# Check that the <function> is provided by libraries on the system and -# store the result in a <variable>. This does not verify that any -# system header file declares the function, only that it can be found at -# link time (consider using CheckSymbolExists). -# <variable> will be created as an internal cache variable. +# Check that the ``<function>`` is provided by libraries on the system and store +# the result in a ``<variable>``. ``<variable>`` will be created as an internal +# cache variable. # -# The following variables may be set before calling this macro to modify -# the way the check is run: +# The following variables may be set before calling this macro to modify the +# way the check is run: # # :: # @@ -25,6 +23,20 @@ # CMAKE_REQUIRED_INCLUDES = list of include directories # CMAKE_REQUIRED_LIBRARIES = list of libraries to link # CMAKE_REQUIRED_QUIET = execute quietly without messages +# +# .. note:: +# +# Prefer using :Module:`CheckSymbolExists` instead of this module, +# for the following reasons: +# +# * ``check_function_exists()`` can't detect functions that are inlined +# in headers or specified as a macro. +# +# * ``check_function_exists()`` can't detect anything in the 32-bit +# versions of the Win32 API, because of a mismatch in calling conventions. +# +# * ``check_function_exists()`` only verifies linking, it does not verify +# that the function is declared in system headers. macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE) if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") diff --git a/Modules/Compiler/Clang-CXX-FeatureTests.cmake b/Modules/Compiler/Clang-CXX-FeatureTests.cmake index df2e1a8..cd04190 100644 --- a/Modules/Compiler/Clang-CXX-FeatureTests.cmake +++ b/Modules/Compiler/Clang-CXX-FeatureTests.cmake @@ -2,7 +2,7 @@ # Reference: http://clang.llvm.org/cxx_status.html # http://clang.llvm.org/docs/LanguageExtensions.html -set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 304") +set(_cmake_oldestSupported "((__clang_major__ * 100) + __clang_minor__) >= 301") include("${CMAKE_CURRENT_LIST_DIR}/Clang-CXX-TestableFeatures.cmake") @@ -15,7 +15,6 @@ set(_cmake_feature_test_cxx_digit_separators "${Clang34_CXX14}") # http://llvm.org/bugs/show_bug.cgi?id=19674 set(_cmake_feature_test_cxx_generic_lambdas "${Clang34_CXX14}") -# TODO: Should be supported by Clang 3.1 set(Clang31_CXX11 "${_cmake_oldestSupported} && __cplusplus >= 201103L") set(_cmake_feature_test_cxx_enum_forward_declarations "${Clang31_CXX11}") set(_cmake_feature_test_cxx_sizeof_member "${Clang31_CXX11}") diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index d0e2521..8ed3695 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -36,7 +36,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z") endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1) if (NOT CMAKE_CXX_COMPILER_FORCED) if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") @@ -50,14 +50,14 @@ endif() macro(cmake_record_cxx_compile_features) set(_result 0) - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) + if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.1) if(_result EQUAL 0 AND CMAKE_CXX17_STANDARD_COMPILE_OPTION) _record_compiler_features_cxx(17) endif() if(_result EQUAL 0 AND CMAKE_CXX14_STANDARD_COMPILE_OPTION) _record_compiler_features_cxx(14) endif() - if (_result EQUAL 0) + if (_result EQUAL 0 AND CMAKE_CXX11_STANDARD_COMPILE_OPTION) _record_compiler_features_cxx(11) endif() if (_result EQUAL 0) diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake index 80ecfbc..809ee06 100644 --- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake +++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake @@ -33,7 +33,7 @@ unset(_CMAKE_VS_LINK_EXE) set(CMAKE_CUDA_DEVICE_LINK_LIBRARY "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> <LANGUAGE_COMPILE_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS") set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE - "<CMAKE_CUDA_COMPILER> <CMAKE_CUDA_LINK_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS") + "<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS") string(APPEND CMAKE_CUDA_FLAGS_INIT " -Xcompiler=-GR,-EHsc") string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=-MDd,-Zi,-RTC1") diff --git a/Packaging/QtSDK/ToolsCMakeXX.cmake b/Packaging/QtSDK/ToolsCMakeXX.cmake index e227b73..c5f8f34 100644 --- a/Packaging/QtSDK/ToolsCMakeXX.cmake +++ b/Packaging/QtSDK/ToolsCMakeXX.cmake @@ -3,38 +3,29 @@ # CMake version include("${CMAKE_CURRENT_LIST_DIR}/../../Source/CMakeVersion.cmake") -set(CM_VER_XY ${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}) -set(CM_VER_X_Y ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}) -set(CM_VER_X_Y_Z ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATH}) -# Destiantion -set(CM_INST_PREF "Tools/CMake/${CM_VER_X_Y}") -set(CMAKE_BIN_DIR "${CM_INST_PREF}/bin" - CACHE STRING "Location under install bin") -set(CMAKE_DATA_DIR "${CM_INST_PREF}/share/cmake-${CM_VER_X_Y}" - CACHE STRING "Location under install data") -set(CMAKE_DOC_DIR "${CM_INST_PREF}/doc/cmake-${CM_VER_X_Y}" - CACHE STRING "Location under install docs") -set(CMAKE_MAN_DIR "${CM_INST_PREF}/man" - CACHE STRING "Location under install man pages") -set(CMAKE_XDGDATA_DIR "${CM_INST_PREF}/share" - CACHE STRING "Location under install XDG specific files") +# Install destinations +set(CMake_INSTALL_INFIX "Tools/CMake/${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/" + CACHE STRING "Location under install CMake tools") # Package set(CMake_IFW_ROOT_COMPONENT_NAME - "qt.tools.cmake.${CM_VER_XY}" + "qt.tools.cmake.${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}" CACHE STRING "QtSDK CMake tools component name") set(CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME - "CMake ${CM_VER_X_Y}" + "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}" CACHE STRING "QtSDK CMake tools component display name") set(CMake_IFW_ROOT_COMPONENT_DESCRIPTION - "CMake Build Tools ${CM_VER_X_Y_Z}" + "CMake Build Tools ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATH}" CACHE STRING "QtSDK CMake tools component description") -set(CMake_IFW_ROOT_COMPONENT_SCRIPT - "${CMAKE_CURRENT_BINARY_DIR}/qt.tools.cmake.${CM_VER_XY}.qs" - CACHE STRING "QtSDK CMake tools component display name") +set(CMake_IFW_ROOT_COMPONENT_SCRIPT_TEMPLATE + "${CMAKE_CURRENT_LIST_DIR}/qt.tools.cmake.xx.qs.in" + CACHE FILEPATH "QtSDK CMake tools script template") +set(CMake_IFW_ROOT_COMPONENT_SCRIPT_GENERATED + "${CMAKE_CURRENT_BINARY_DIR}/qt.tools.cmake.${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}.qs" + CACHE FILEPATH "QtSDK CMake tools script generated") set(CMake_IFW_ROOT_COMPONENT_PRIORITY - "${CM_VER_XY}" + "${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}" CACHE STRING "QtSDK CMake tools component sorting priority") set(CMake_IFW_ROOT_COMPONENT_DEFAULT "" CACHE STRING "QtSDK CMake tools component default") @@ -52,17 +43,3 @@ set(CPACK_IFW_DOWNLOAD_ALL "TRUE" CACHE STRING "All QtSDK components is downloaded") set(CPACK_DOWNLOAD_SITE "file:///${CMAKE_CURRENT_BINARY_DIR}/QtSDK/IFW/CMake/repository" CACHE STRING "Local repository for testing") - -# Script -set(SDKToolBinary "@SDKToolBinary@") -set(CM_VER_XY_DIR "@CMAKE${CM_VER_XY}_DIR@") -configure_file("${CMAKE_CURRENT_LIST_DIR}/qt.tools.cmake.xx.qs.in" - "${CMAKE_CURRENT_BINARY_DIR}/qt.tools.cmake.${CM_VER_XY}.qs" - @ONLY) - -# Unset temporary variables -unset(CM_VER_XY) -unset(CM_VER_X_Y) -unset(CM_VER_X_Y_Z) -unset(CM_INST_PREF) -unset(SDKToolBinary) diff --git a/Packaging/QtSDK/qt.tools.cmake.xx.qs.in b/Packaging/QtSDK/qt.tools.cmake.xx.qs.in index cb42a71..81ce157 100644 --- a/Packaging/QtSDK/qt.tools.cmake.xx.qs.in +++ b/Packaging/QtSDK/qt.tools.cmake.xx.qs.in @@ -9,15 +9,15 @@ function Component() { installer.valueChanged.connect( this, Component.prototype.reactOnTargetDirChange ); - // set the default values to CMAKE@CM_VER_XY@_DIR + // set the default values to CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR Component.prototype.reactOnTargetDirChange("TargetDir", installer.value("TargetDir")); } Component.prototype.reactOnTargetDirChange = function(key, value) { if (key == "TargetDir") { - var path = value + "/@CM_INST_PREF@"; - installer.setValue("CMAKE@CM_VER_XY@_DIR", path.replace(/\\/g, "/")); + var path = value + "/%CMAKE_BIN_DIR%"; + installer.setValue("CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR", path.replace(/\\/g, "/")); } } @@ -31,13 +31,13 @@ Component.prototype.createOperations = function() return; var cmId = component.name; - installer.setValue("CMAKE@CM_VER_XY@_ID", cmId); + installer.setValue("CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_ID", cmId); component.addOperation("Execute", ["{0,2}", "@SDKToolBinary@", "addCMake", "--id", cmId, - "--name", "@CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME@", - "--path", "@CM_VER_XY_DIR@/bin/cmake.exe", + "--name", "%CMake_IFW_ROOT_COMPONENT_DISPLAY_NAME%", + "--path", "@CMAKE%CMake_VERSION_MAJOR%%CMake_VERSION_MINOR%_BIN_DIR@/cmake.exe", "UNDOEXECUTE", "@SDKToolBinary@", "rmCMake", "--id", cmId]); diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 57b7b25..2835ee6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -787,6 +787,15 @@ target_link_libraries(CMakeLib cmsys ${CMake_KWIML_LIBRARIES} ) +if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc") + # the atomic instructions are implemented using libatomic on some platforms, + # so linking to that may be required + check_library_exists(atomic __atomic_fetch_add_4 "" LIBATOMIC_NEEDED) + if(LIBATOMIC_NEEDED) + target_link_libraries(CMakeLib atomic) + endif() +endif() + # On Apple we need CoreFoundation if(APPLE) target_link_libraries(CMakeLib "-framework CoreFoundation") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fde01c1..0c64d70 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 7) -set(CMake_VERSION_PATCH 20170112) +set(CMake_VERSION_PATCH 20170116) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 5c45fe5..ac1644f 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -134,6 +134,7 @@ void cmCTestRunTest::CompressOutput() size_t rlen = cmsysBase64_Encode(out, strm.total_out, encoded_buffer, 1); + this->CompressedOutput.clear(); for (size_t i = 0; i < rlen; i++) { this->CompressedOutput += encoded_buffer[i]; } @@ -416,6 +417,7 @@ bool cmCTestRunTest::StartTest(size_t total) << std::setw(getNumWidth(this->TestHandler->GetMaxIndex())) << this->TestProperties->Index << ": " << this->TestProperties->Name << std::endl); + this->ProcessOutput.clear(); this->ComputeArguments(); std::vector<std::string>& args = this->TestProperties->Args; this->TestResult.Properties = this->TestProperties; diff --git a/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in index e3d8554..8cc5835 100644 --- a/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in +++ b/Source/QtIFW/CMake.DeveloperReference.HTML.qs.in @@ -11,8 +11,8 @@ Component.prototype.createOperations = function() if (installer.value("os") === "win") { component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/developer-reference/html/index.html", - installer.value("StartMenuDir") + "/CMake Developer Reference.lnk"); + "@TargetDir@/%CMAKE_DOC_DIR%/developer-reference/html/index.html", + "@StartMenuDir@/CMake Developer Reference.lnk"); } diff --git a/Source/QtIFW/CMake.Dialogs.QtGUI.qs b/Source/QtIFW/CMake.Dialogs.QtGUI.qs.in index 219a0a9..71f395a 100644 --- a/Source/QtIFW/CMake.Dialogs.QtGUI.qs +++ b/Source/QtIFW/CMake.Dialogs.QtGUI.qs.in @@ -11,8 +11,8 @@ Component.prototype.createOperations = function() if (installer.value("os") === "win") { component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/bin/cmake-gui.exe", - installer.value("StartMenuDir") + "/CMake (cmake-gui).lnk"); + "@TargetDir@/%CMAKE_BIN_DIR%/cmake-gui.exe", + "@StartMenuDir@/CMake (cmake-gui).lnk"); } diff --git a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in index 5c929e8..54bc14a 100644 --- a/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in +++ b/Source/QtIFW/CMake.Documentation.SphinxHTML.qs.in @@ -11,8 +11,8 @@ Component.prototype.createOperations = function() if (installer.value("os") === "win") { component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/html/index.html", - installer.value("StartMenuDir") + "/CMake Documentation.lnk"); + "@TargetDir@/%CMAKE_DOC_DIR%/html/index.html", + "@StartMenuDir@/CMake Documentation.lnk"); } diff --git a/Source/QtIFW/CMake.qs.in b/Source/QtIFW/CMake.qs.in index 828cc7c..1f3166e 100644 --- a/Source/QtIFW/CMake.qs.in +++ b/Source/QtIFW/CMake.qs.in @@ -1,3 +1,5 @@ +// Component: CMake + function Component() { // Default constructor @@ -9,12 +11,12 @@ Component.prototype.createOperations = function() if (installer.value("os") === "win") { component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html", - installer.value("StartMenuDir") + "/CMake Web Site.lnk"); + "@TargetDir@/%CMAKE_DOC_DIR%/cmake.org.html", + "@StartMenuDir@/CMake Web Site.lnk"); component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/cmake-maintenance.exe", - installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); + "@TargetDir@/cmake-maintenance.exe", + "@StartMenuDir@/CMake Maintenance Tool.lnk"); } // Call default implementation diff --git a/Source/QtIFW/installscript.qs.in b/Source/QtIFW/installscript.qs.in index 39a8795..72d49e8 100644 --- a/Source/QtIFW/installscript.qs.in +++ b/Source/QtIFW/installscript.qs.in @@ -1,3 +1,5 @@ +// Component: CMake + function Component() { // Do not show component selection page @@ -9,15 +11,15 @@ Component.prototype.createOperations = function() // Create shortcut if (installer.value("os") === "win") { -@_CPACK_IFW_SHORTCUT_OPTIONAL@ +%_CPACK_IFW_SHORTCUT_OPTIONAL% component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/@CMAKE_DOC_DIR@/cmake.org.html", - installer.value("StartMenuDir") + "/CMake Web Site.lnk"); + "@TargetDir@/%CMAKE_DOC_DIR%/cmake.org.html", + "@StartMenuDir@/CMake Web Site.lnk"); component.addOperation("CreateShortcut", - installer.value("TargetDir") + "/cmake-maintenance.exe", - installer.value("StartMenuDir") + "/CMake Maintenance Tool.lnk"); + "@TargetDir@/cmake-maintenance.exe", + "@StartMenuDir@/CMake Maintenance Tool.lnk"); } // Call default implementation diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 7e113ab..239582f 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -63,6 +63,13 @@ void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags, void cmCommonTargetGenerator::AddModuleDefinitionFlag( cmLinkLineComputer* linkLineComputer, std::string& flags) { + // A module definition file only makes sense on certain target types. + if (this->GeneratorTarget->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GeneratorTarget->GetType() != cmStateEnums::MODULE_LIBRARY && + this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE) { + return; + } + if (!this->ModuleDefinitionFile) { return; } diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx index cf0cf88..e728632 100644 --- a/Source/cmLinkLineComputer.cxx +++ b/Source/cmLinkLineComputer.cxx @@ -184,3 +184,9 @@ std::string cmLinkLineComputer::ComputeLinkLibraries( return fout.str(); } + +std::string cmLinkLineComputer::GetLinkerLanguage(cmGeneratorTarget* target, + std::string const& config) +{ + return target->GetLinkerLanguage(config); +} diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h index bb13717..57a70bc 100644 --- a/Source/cmLinkLineComputer.h +++ b/Source/cmLinkLineComputer.h @@ -11,6 +11,7 @@ #include "cmStateDirectory.h" class cmComputeLinkInformation; +class cmGeneratorTarget; class cmOutputConverter; class cmLinkLineComputer @@ -36,6 +37,9 @@ public: virtual std::string ComputeLinkLibraries(cmComputeLinkInformation& cli, std::string const& stdLibString); + virtual std::string GetLinkerLanguage(cmGeneratorTarget* target, + std::string const& config); + protected: std::string ComputeLinkLibs(cmComputeLinkInformation& cli); std::string ComputeRPath(cmComputeLinkInformation& cli); diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 75e5ef5..6a700ff 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -59,6 +59,12 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries( return fout.str(); } +std::string cmLinkLineDeviceComputer::GetLinkerLanguage(cmGeneratorTarget*, + std::string const&) +{ + return "CUDA"; +} + cmNinjaLinkLineDeviceComputer::cmNinjaLinkLineDeviceComputer( cmOutputConverter* outputConverter, cmStateDirectory stateDir, cmGlobalNinjaGenerator const* gg) diff --git a/Source/cmLinkLineDeviceComputer.h b/Source/cmLinkLineDeviceComputer.h index d1079d7..f4bb3eb 100644 --- a/Source/cmLinkLineDeviceComputer.h +++ b/Source/cmLinkLineDeviceComputer.h @@ -17,6 +17,9 @@ public: std::string ComputeLinkLibraries(cmComputeLinkInformation& cli, std::string const& stdLibString) CM_OVERRIDE; + + std::string GetLinkerLanguage(cmGeneratorTarget* target, + std::string const& config) CM_OVERRIDE; }; class cmNinjaLinkLineDeviceComputer : public cmLinkLineDeviceComputer diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ead1e72..44c390c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -13,6 +13,7 @@ #include "cmInstallScriptGenerator.h" #include "cmInstallTargetGenerator.h" #include "cmLinkLineComputer.h" +#include "cmLinkLineDeviceComputer.h" #include "cmMakefile.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" @@ -979,7 +980,9 @@ void cmLocalGenerator::GetTargetFlags( linkFlags += this->Makefile->GetSafeDefinition(build); linkFlags += " "; } - std::string linkLanguage = target->GetLinkerLanguage(buildType); + + const std::string linkLanguage = + linkLineComputer->GetLinkerLanguage(target, buildType); if (linkLanguage.empty()) { cmSystemTools::Error( "CMake can not determine linker language for target: ", diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index ba17f81..41a4caf 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1592,8 +1592,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( // Provide a "/fast" version of the target. depends.clear(); - if ((targetName == "install") || (targetName == "install_local") || - (targetName == "install_strip")) { + if ((targetName == "install") || (targetName == "install/local") || + (targetName == "install/strip")) { // Provide a fast install target that does not depend on all // but has the same command. depends.push_back("preinstall/fast"); diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 4bc706c..b76ddeb 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -157,15 +157,6 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( this->LocalGenerator->AppendFlags( linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); - { - CM_AUTO_PTR<cmLinkLineComputer> linkLineComputer( - this->CreateLinkLineComputer( - this->LocalGenerator, - this->LocalGenerator->GetStateSnapshot().GetDirectory())); - - this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags); - } - // Construct a list of files associated with this executable that // may need to be cleaned. std::vector<std::string> exeCleanFiles; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index bc8d8ff..b172478 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -663,7 +663,6 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() this->addPoolNinjaVariable("JOB_POOL_LINK", &genTarget, vars); - this->AddModuleDefinitionFlag(linkLineComputer.get(), vars["LINK_FLAGS"]); vars["LINK_FLAGS"] = cmGlobalNinjaGenerator::EncodeLiteral(vars["LINK_FLAGS"]); diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index d675a2c..c2ff664 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -73,42 +73,19 @@ cmVSSetupAPIHelper::~cmVSSetupAPIHelper() bool cmVSSetupAPIHelper::IsVS2017Installed() { - bool ret = false; - if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) { - ret = EnumerateAndChooseVSInstance(); - } - - return ret; + return this->EnumerateAndChooseVSInstance(); } bool cmVSSetupAPIHelper::IsWin10SDKInstalled() { - bool isWin10SDKInstalled = false; - if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) { - if (EnumerateAndChooseVSInstance() && - chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) { - isWin10SDKInstalled = chosenInstanceInfo.IsWin10SDKInstalled; - } - } else { - isWin10SDKInstalled = chosenInstanceInfo.IsWin10SDKInstalled; - } - - return isWin10SDKInstalled; + return (this->EnumerateAndChooseVSInstance() && + chosenInstanceInfo.IsWin10SDKInstalled); } bool cmVSSetupAPIHelper::IsWin81SDKInstalled() { - bool isWin81SDKInstalled = false; - if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) { - if (EnumerateAndChooseVSInstance() && - chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) { - isWin81SDKInstalled = chosenInstanceInfo.IsWin81SDKInstalled; - } - } else { - isWin81SDKInstalled = chosenInstanceInfo.IsWin81SDKInstalled; - } - - return isWin81SDKInstalled; + return (this->EnumerateAndChooseVSInstance() && + chosenInstanceInfo.IsWin81SDKInstalled); } bool cmVSSetupAPIHelper::CheckInstalledComponent( @@ -241,18 +218,12 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo( bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation) { vsInstallLocation = ""; - bool isInstalled = false; + bool isInstalled = this->EnumerateAndChooseVSInstance(); - if (chosenInstanceInfo.VSInstallLocation.compare(L"") == 0) { - isInstalled = EnumerateAndChooseVSInstance(); - } - - // Enumerate and choose best VS instance - if (chosenInstanceInfo.VSInstallLocation.compare(L"") != 0) { + if (isInstalled) { std::string str(chosenInstanceInfo.VSInstallLocation.begin(), chosenInstanceInfo.VSInstallLocation.end()); vsInstallLocation = str; - isInstalled = true; } return isInstalled; diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt index 5772fcf..40c9675 100644 --- a/Tests/Cuda/CMakeLists.txt +++ b/Tests/Cuda/CMakeLists.txt @@ -2,3 +2,4 @@ ADD_TEST_MACRO(Cuda.Complex CudaComplex) ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures) ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary) +ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags) diff --git a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt new file mode 100644 index 0000000..a9eb8bd --- /dev/null +++ b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt @@ -0,0 +1,20 @@ + +cmake_minimum_required(VERSION 3.7) +project (ProperLinkFlags CUDA CXX) + +#Goal for this example: +#Verify that when we have CXX and CUDA enabled and we link an executable that +#has CUDA and CXX we use the CUDA link flags when doing the device link +#step + +#Specify a set of valid CUDA flags and an invalid set of CXX flags ( for CUDA ) +#to make sure we don't use the CXX flags when linking CUDA executables +set(CMAKE_CUDA_FLAGS "-arch=sm_35 --use_fast_math") +set(CMAKE_CXX_FLAGS "-Wall") + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CUDA_STANDARD 11) +add_executable(ProperLinkFlags file1.cu main.cxx) + +set_target_properties( ProperLinkFlags + PROPERTIES CUDA_SEPARABLE_COMPILATION ON) diff --git a/Tests/Cuda/ProperLinkFlags/file1.cu b/Tests/Cuda/ProperLinkFlags/file1.cu new file mode 100644 index 0000000..d93dc9f --- /dev/null +++ b/Tests/Cuda/ProperLinkFlags/file1.cu @@ -0,0 +1,11 @@ + +#include "file1.h" + +result_type __device__ file1_func(int x) +{ + __ldg(&x); + result_type r; + r.input = x; + r.sum = x*x; + return r; +} diff --git a/Tests/Cuda/ProperLinkFlags/file1.h b/Tests/Cuda/ProperLinkFlags/file1.h new file mode 100644 index 0000000..ff1945c --- /dev/null +++ b/Tests/Cuda/ProperLinkFlags/file1.h @@ -0,0 +1,7 @@ + +#pragma once +struct result_type +{ + int input; + int sum; +}; diff --git a/Tests/Cuda/ProperLinkFlags/main.cxx b/Tests/Cuda/ProperLinkFlags/main.cxx new file mode 100644 index 0000000..7c0ee9e --- /dev/null +++ b/Tests/Cuda/ProperLinkFlags/main.cxx @@ -0,0 +1,9 @@ + +#include <iostream> + +#include "file1.h" + +int main(int argc, char** argv) +{ + return 0; +} diff --git a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake index 4654416..ecb9a64 100644 --- a/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake +++ b/Tests/RunCMake/CTestCommandLine/repeat-until-fail-cmake.cmake @@ -12,4 +12,6 @@ add_test(NAME test1 set_tests_properties(test1 PROPERTIES DEPENDS "initialization") add_test(hello ${CMAKE_COMMAND} -E echo hello) +set_tests_properties(hello PROPERTIES FAIL_REGULAR_EXPRESSION "hello.*hello") + add_test(goodbye ${CMAKE_COMMAND} -E echo goodbye) |