@@ -190,33 +190,27 @@ endfunction()
190190# we create a `swift-driver` symlink adjacent to the `swift` and `swiftc` executables
191191# to ensure that `swiftc` forwards to the standalone driver when invoked.
192192function (swift_create_early_driver_copies target )
193- # Early swift-driver is built adjacent to the compiler (swift build dir)
194- if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" )
195- set (driver_package_configuration_dir "release" )
196- else ()
197- set (driver_package_configuration_dir "debug" )
198- endif ()
199-
200- set (driver_bin_dir "${CMAKE_BINARY_DIR} /../earlyswiftdriver-${SWIFT_HOST_VARIANT} -${SWIFT_HOST_VARIANT_ARCH} /${driver_package_configuration_dir} /bin" )
201- set (swift_bin_dir "${SWIFT_RUNTIME_OUTPUT_INTDIR} " )
202- # If early swift-driver wasn't built, nothing to do here.
203- if (NOT EXISTS "${driver_bin_dir} /swift-driver" OR NOT EXISTS "${driver_bin_dir} /swift-help" )
204- message (STATUS "Skipping creating early SwiftDriver symlinks - no early SwiftDriver build found at: ${driver_bin_dir} ." )
205- return ()
193+ set (SWIFT_EARLY_SWIFT_DRIVER_BUILD "" CACHE PATH "Path to early swift-driver build" )
194+
195+ if (NOT SWIFT_EARLY_SWIFT_DRIVER_BUILD)
196+ return ()
206197 endif ()
207198
208- message (STATUS "Copying over early SwiftDriver executable." )
209- message (STATUS "From: ${driver_bin_dir} /swift-driver" )
210- message (STATUS "To: ${swift_bin_dir} /swift-driver" )
211- # Use configure_file instead of file(COPY...) to establish a dependency.
212- # Further Changes to `swift-driver` will cause it to be copied over.
213- configure_file (${driver_bin_dir} /swift-driver ${swift_bin_dir} /swift-driver COPYONLY )
214-
215- message (STATUS "From: ${driver_bin_dir} /swift-help" )
216- message (STATUS "To: ${swift_bin_dir} /swift-help" )
217- # Use configure_file instead of file(COPY...) to establish a dependency.
218- # Further Changes to `swift-driver` will cause it to be copied over.
219- configure_file (${driver_bin_dir} /swift-help ${swift_bin_dir} /swift-help COPYONLY )
199+ if (EXISTS ${SWIFT_EARLY_SWIFT_DRIVER_BUILD} /swift-driver${CMAKE_EXECUTABLE_SUFFIX} )
200+ message (STATUS "Creating early SwiftDriver symlinks" )
201+
202+ # Use `configure_file` instead of `file(COPY ...)` to establish a
203+ # dependency. Further changes to `swift-driver` will cause it to be copied
204+ # over.
205+ configure_file (${SWIFT_EARLY_SWIFT_DRIVER_BUILD} /swift-driver${CMAKE_EXECUTABLE_SUFFIX}
206+ ${SWIFT_RUNTIME_OUTPUT_INTDIR} /swift-driver${CMAKE_EXECUTABLE_SUFFIX}
207+ COPYONLY )
208+ configure_file (${SWIFT_EARLY_SWIFT_DRIVER_BUILD} /swift-help${CMAKE_EXECUTABLE_SUFFIX}
209+ ${SWIFT_RUNTIME_OUTPUT_INTDIR} /swift-help${CMAKE_EXECUTABLE_SUFFIX}
210+ COPYONLY )
211+ else ()
212+ message (STATUS "Not creating early SwiftDriver symlinks (swift-driver not found)" )
213+ endif ()
220214endfunction ()
221215
222216function (dump_swift_vars)
0 commit comments