|
20 | 20 | foundation.CFLAGS = '-DDEPLOYMENT_TARGET_MACOSX '
|
21 | 21 | foundation.LDFLAGS = '-licucore -twolevel_namespace -Wl,-alias_list,CoreFoundation/Base.subproj/DarwinSymbolAliases -sectcreate __UNICODE __csbitmaps CoreFoundation/CharacterSets/CFCharacterSetBitmaps.bitmap -sectcreate __UNICODE __properties CoreFoundation/CharacterSets/CFUniCharPropertyDatabase.data -sectcreate __UNICODE __data CoreFoundation/CharacterSets/CFUnicodeData-L.mapping -segprot __UNICODE r r '
|
22 | 22 |
|
23 |
| -foundation.SWIFTCFLAGS = '' |
24 |
| - |
25 | 23 | # For now, we do not distinguish between public and private headers (they are all private to Foundation)
|
26 | 24 | # These are really part of CF, which should ultimately be a separate target
|
27 | 25 | foundation.ROOT_HEADERS_FOLDER_PATH = "/usr/lib/swift"
|
|
47 | 45 | '-I./'
|
48 | 46 | ])
|
49 | 47 |
|
50 |
| -foundation.SWIFTCFLAGS += " ".join([ |
| 48 | +swift_cflags = [ |
51 | 49 | '-I${BUILD_DIR}/Foundation/usr/lib/swift'
|
52 |
| -]) |
| 50 | +] |
| 51 | + |
| 52 | +if "XCTEST_BUILD_DIR" in Configuration.current.variables: |
| 53 | + swift_cflags += [ |
| 54 | + '-I${XCTEST_BUILD_DIR}', |
| 55 | + '-L${XCTEST_BUILD_DIR}', |
| 56 | + ] |
| 57 | +foundation.SWIFTCFLAGS = " ".join(swift_cflags) |
53 | 58 |
|
54 |
| -foundation.LDFLAGS += '-lpthread -ldl -lm -lswiftCore' |
| 59 | +foundation.LDFLAGS += '-lpthread -ldl -lm -lswiftCore ' |
| 60 | + |
| 61 | +if "XCTEST_BUILD_DIR" in Configuration.current.variables: |
| 62 | + foundation.LDFLAGS += '-L${XCTEST_BUILD_DIR}' |
55 | 63 |
|
56 | 64 | headers = CopyHeaders(
|
57 | 65 | module = 'CoreFoundation/Base.subproj/linux.modulemap',
|
|
360 | 368 |
|
361 | 369 | script.add_product(foundation)
|
362 | 370 |
|
363 |
| -script.add_text(""" |
| 371 | +extra_script = """ |
364 | 372 | rule InstallFoundation
|
365 | 373 | command = mkdir -p "${DSTROOT}/${PREFIX}/lib/swift/${OS}"; $
|
366 | 374 | cp "${BUILD_DIR}/Foundation/${DYLIB_PREFIX}Foundation${DYLIB_SUFFIX}" "${DSTROOT}/${PREFIX}/lib/swift/${OS}"; $
|
|
373 | 381 | build ${BUILD_DIR}/.install: InstallFoundation ${BUILD_DIR}/Foundation/${DYLIB_PREFIX}Foundation${DYLIB_SUFFIX}
|
374 | 382 |
|
375 | 383 | build install: phony | ${BUILD_DIR}/.install
|
376 |
| -""") |
| 384 | +
|
| 385 | +""" |
| 386 | +if "XCTEST_BUILD_DIR" in Configuration.current.variables: |
| 387 | + extra_script += """ |
| 388 | +rule RunTestFoundation |
| 389 | + command = echo "**** RUNNING TESTS ****\\nexecute:\\nLD_LIBRARY_PATH=${BUILD_DIR}/Foundation/:${XCTEST_BUILD_DIR} ${BUILD_DIR}/TestFoundation/TestFoundation\\n**** DEBUGGING TESTS ****\\nexecute:\\nLD_LIBRARY_PATH=${BUILD_DIR}/Foundation/:${XCTEST_BUILD_DIR} lldb ${BUILD_DIR}/TestFoundation/TestFoundation\\n" |
| 390 | + description = Building Tests |
| 391 | +
|
| 392 | +build ${BUILD_DIR}/.test: RunTestFoundation | TestFoundation |
| 393 | +
|
| 394 | +build test: phony | ${BUILD_DIR}/.test |
| 395 | +
|
| 396 | +""" |
| 397 | +else: |
| 398 | + extra_script += """ |
| 399 | +rule RunTestFoundation |
| 400 | + command = echo "**** RUNNING TESTS ****\\nexecute:\\nLD_LIBRARY_PATH=${BUILD_DIR}/Foundation/ ${BUILD_DIR}/TestFoundation/TestFoundation\\n**** DEBUGGING TESTS ****\\nexecute:\\nLD_LIBRARY_PATH=${BUILD_DIR}/Foundation/ lldb ${BUILD_DIR}/TestFoundation/TestFoundation\\n" |
| 401 | + description = Building Tests |
| 402 | +
|
| 403 | +build ${BUILD_DIR}/.test: RunTestFoundation | TestFoundation |
| 404 | +
|
| 405 | +build test: phony | ${BUILD_DIR}/.test |
| 406 | +
|
| 407 | +""" |
| 408 | + |
| 409 | +script.add_text(extra_script) |
377 | 410 |
|
378 | 411 | script.generate()
|
0 commit comments