@@ -74,56 +74,32 @@ if platform.system() == 'Darwin':
7474 ])
7575else :
7676 # We need to jump through extra hoops to link swift-corelibs-foundation.
77- foundation_dir = _getenv ('FOUNDATION_BUILT_PRODUCTS_DIR' )
7877 if platform .system () == 'Windows' :
79- sdkroot = os .getenv ('SDKROOT' , None )
80- if sdkroot :
81- swift_exec .extend (['-sdk' , sdkroot ])
82- swift_exec .extend (['-Xlinker' , '-nodefaultlib:libcmt' ])
78+ swift_exec .extend (["-sdk" , '"' + _getenv ("SDKROOT" ) + '"' ])
8379 else :
80+ foundation_dir = _getenv ('FOUNDATION_BUILT_PRODUCTS_DIR' )
8481 swift_exec .extend ([
85- '-Xlinker' , '-rpath' , '-Xlinker' , foundation_dir ,
86- '-Xlinker' , '-rpath' , '-Xlinker' , os .path .join (foundation_dir , 'Foundation' ),
87- '-Xlinker' , '-rpath' , '-Xlinker' , os .path .join (foundation_dir , 'Sources' , 'Foundation' ),
88- '-Xlinker' , '-rpath' , '-Xlinker' , os .path .join (foundation_dir , 'Sources' , 'FoundationNetworking' ),
89- '-Xlinker' , '-rpath' , '-Xlinker' , os .path .join (foundation_dir , 'Sources' , 'FoundationXML' ),
82+ '-I' , os .path .join (foundation_dir , 'swift' ),
83+ '-I' , os .path .join (foundation_dir , '_CModulesForClients' ),
84+ '-L' , os .path .join (foundation_dir , 'lib' ),
9085 '-Xlinker' , '-rpath' , '-Xlinker' , os .path .join (foundation_dir , 'lib' ),
9186 ])
92- swift_exec .extend ([
93- '-L' , foundation_dir ,
94- '-L' , os .path .join (foundation_dir , 'Foundation' ),
95- '-L' , os .path .join (foundation_dir , 'Sources' , 'Foundation' ),
96- '-L' , os .path .join (foundation_dir , 'Sources' , 'FoundationNetworking' ),
97- '-L' , os .path .join (foundation_dir , 'Sources' , 'FoundationXML' ),
98- '-L' , os .path .join (foundation_dir , 'lib' ),
99- '-I' , foundation_dir ,
100- '-I' , os .path .join (foundation_dir , 'swift' ),
101- '-I' , os .path .join (foundation_dir , '_CModulesForClients' ),
102- '-Xcc' , '-F' , '-Xcc' , foundation_dir ,
103- ])
104-
105- # We also need to link swift-corelibs-libdispatch, if
106- # swift-corelibs-foundation is using it.
107- libdispatch_src_dir = os .getenv ('LIBDISPATCH_SRC_DIR' )
108- libdispatch_build_dir = os .getenv ('LIBDISPATCH_BUILD_DIR' )
109- libdispatch_overlay_dir = os .getenv ('LIBDISPATCH_OVERLAY_DIR' )
110- if ((libdispatch_src_dir is not None )
111- and (libdispatch_build_dir is not None )
112- and (libdispatch_overlay_dir is not None )):
113- swift_exec .extend ([
114- '-Xcc' , '-fblocks' ,
115- '-I' , libdispatch_src_dir ,
116- '-I' , libdispatch_overlay_dir ,
117- '-I' , os .path .join (libdispatch_overlay_dir , 'swift' ),
118- '-L' , libdispatch_build_dir ,
119- '-L' , os .path .join (libdispatch_build_dir , 'src' ),
120- '-L' , os .path .join (libdispatch_build_dir , 'src' , 'BlocksRuntime' ),
121- '-L' , os .path .join (libdispatch_build_dir , 'src' , 'swift' ),
122- '-vfsoverlay' , os .path .join (libdispatch_build_dir , 'dispatch-vfs-overlay.yaml' ),
123- ])
12487
125- if platform .system () != 'Windows' :
88+ # We also need to link swift-corelibs-libdispatch, if
89+ # swift-corelibs-foundation is using it.
90+ libdispatch_src_dir = os .getenv ('LIBDISPATCH_SRC_DIR' )
91+ libdispatch_build_dir = os .getenv ('LIBDISPATCH_BUILD_DIR' )
92+ libdispatch_overlay_dir = os .getenv ('LIBDISPATCH_OVERLAY_DIR' )
93+ if ((libdispatch_src_dir is not None )
94+ and (libdispatch_build_dir is not None )
95+ and (libdispatch_overlay_dir is not None )):
12696 swift_exec .extend ([
97+ '-I' , libdispatch_src_dir ,
98+ '-I' , libdispatch_overlay_dir ,
99+ '-I' , os .path .join (libdispatch_overlay_dir , 'swift' ),
100+ '-L' , os .path .join (libdispatch_build_dir , 'src' ),
101+ '-L' , os .path .join (libdispatch_build_dir , 'src' , 'BlocksRuntime' ),
102+ '-L' , os .path .join (libdispatch_build_dir , 'src' , 'swift' ),
127103 '-Xlinker' , '-rpath' , '-Xlinker' , libdispatch_build_dir ,
128104 ])
129105
0 commit comments