From 02c14b7fcd29a7dcedb930fe5d9138cb185493e1 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Tue, 21 May 2019 08:51:53 -0700 Subject: Ninja,Swift: pass along DEFINES/FLAGS/INCLUDES Since the Swift model does a single compile/link phase, we would not get the compile definitions, includes, and options past along to the build of the module. Compute these for the target when constructing the main command. --- Modules/CMakeSwiftInformation.cmake | 8 ++++---- Source/cmNinjaNormalTargetGenerator.cxx | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake index 64e7f99..1150498 100644 --- a/Modules/CMakeSwiftInformation.cmake +++ b/Modules/CMakeSwiftInformation.cmake @@ -35,9 +35,9 @@ endif() if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY) if(CMAKE_Swift_COMPILER_TARGET) - set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -target -output-file-map -incremental -emit-library -o -module-name -module-link-name -emit-module -emit-module-path -emit-dependencies ") + set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -target -output-file-map -incremental -emit-library -o -module-name -module-link-name -emit-module -emit-module-path -emit-dependencies ") else() - set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map -incremental -emit-library -o -module-name -module-link-name -emit-module -emit-module-path -emit-dependencies ") + set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map -incremental -emit-library -o -module-name -module-link-name -emit-module -emit-module-path -emit-dependencies ") endif() endif() @@ -47,9 +47,9 @@ endif() if(NOT CMAKE_Swift_LINK_EXECUTABLE) if(CMAKE_Swift_COMPILER_TARGET) - set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -target -output-file-map -incremental -emit-executable -o -emit-module -emit-module-path -emit-dependencies ") + set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -target -output-file-map -incremental -emit-executable -o -emit-module -emit-module-path -emit-dependencies ") else() - set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -output-file-map -incremental -emit-executable -o -emit-module -emit-module-path -emit-dependencies ") + set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -output-file-map -incremental -emit-executable -o -emit-module -emit-module-path -emit-dependencies ") endif() endif() diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 06063b2..59d0707 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -288,6 +288,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) vars.SwiftModuleName = "$SWIFT_MODULE_NAME"; vars.SwiftOutputFileMap = "$SWIFT_OUTPUT_FILE_MAP"; vars.SwiftSources = "$SWIFT_SOURCES"; + + vars.Defines = "$DEFINES"; + vars.Flags = "$FLAGS"; + vars.Includes = "$INCLUDES"; } std::string responseFlag; @@ -865,6 +869,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } return oss.str(); }(); + + // Since we do not perform object builds, compute the + // defines/flags/includes here so that they can be passed along + // appropriately. + vars["DEFINES"] = this->GetDefines("Swift"); + vars["FLAGS"] = this->GetFlags("Swift"); + vars["INCLUDES"] = this->GetIncludes("Swift"); } // Compute specific libraries to link with. -- cgit v0.12