@@ -389,6 +389,8 @@ endfunction()
389
389
# add_swift_host_library(name
390
390
# [SHARED]
391
391
# [STATIC]
392
+ # [OBJECT]
393
+ # [IGNORE_LLVM_UPDATE_COMPILE_FLAGS]
392
394
# [LLVM_LINK_COMPONENTS comp1 ...]
393
395
# source1 [source2 source3 ...])
394
396
#
@@ -401,15 +403,25 @@ endfunction()
401
403
# STATIC
402
404
# Build a static library.
403
405
#
406
+ # OBJECT
407
+ # Build an object library
408
+ #
404
409
# LLVM_LINK_COMPONENTS
405
410
# LLVM components this library depends on.
406
411
#
412
+ # IGNORE_LLVM_UPDATE_COMPILE_FLAGS
413
+ # If set do not use llvm_update_compile_flags to generate cflags/etc. This is
414
+ # generally used when compiling a mixed c/c++/swift library and one wants to
415
+ # disable this for the swift part.
416
+ #
407
417
# source1 ...
408
418
# Sources to add into this library.
409
419
function(add_swift_host_library name)
410
420
set(options
411
421
SHARED
412
- STATIC)
422
+ STATIC
423
+ OBJECT
424
+ IGNORE_LLVM_UPDATE_COMPILE_FLAGS)
413
425
set(single_parameter_options)
414
426
set(multiple_parameter_options
415
427
LLVM_LINK_COMPONENTS)
@@ -423,8 +435,8 @@ function(add_swift_host_library name)
423
435
424
436
translate_flags(ASHL " ${options} ")
425
437
426
- if(NOT ASHL_SHARED AND NOT ASHL_STATIC)
427
- message(FATAL_ERROR " Either SHARED or STATIC must be specified ")
438
+ if(NOT ASHL_SHARED AND NOT ASHL_STATIC AND NOT ASHL_OBJECT )
439
+ message(FATAL_ERROR " One of SHARED/ STATIC/OBJECT must be specified ")
428
440
endif()
429
441
430
442
if(XCODE)
@@ -449,11 +461,15 @@ function(add_swift_host_library name)
449
461
set(libkind SHARED)
450
462
elseif(ASHL_STATIC)
451
463
set(libkind STATIC)
464
+ elseif(ASHL_OBJECT)
465
+ set(libkind OBJECT)
452
466
endif()
453
467
454
468
add_library(${name} ${libkind} ${ASHL_SOURCES} )
455
469
add_dependencies(${name} ${LLVM_COMMON_DEPENDS} )
456
- llvm_update_compile_flags(${name} )
470
+ if (NOT ASHL_IGNORE_LLVM_UPDATE_COMPILE_FLAGS)
471
+ llvm_update_compile_flags(${name} )
472
+ endif()
457
473
swift_common_llvm_config(${name} ${ASHL_LLVM_LINK_COMPONENTS} )
458
474
set_output_directory(${name}
459
475
BINARY_DIR ${SWIFT_RUNTIME_OUTPUT_INTDIR}
0 commit comments