diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-10-11 21:06:23 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-11 21:06:23 +0800 |
| commit | e91e1d4d54a14d985626318e5cf46635bfa4006d (patch) | |
| tree | 18e5d045235b743429821c249b5611b70c8cd02d /cmake/SlangTarget.cmake | |
| parent | dfab34e4bf508fc517d4d645ebb3b6b1179a5003 (diff) | |
Restrict stdlib embed macros to single source file (#5251)
* Restrict stdlib embed macros to single source file
* Build slang-without-embedded-stdlib with the same target type as libslang
To avoid building everything twice
Diffstat (limited to 'cmake/SlangTarget.cmake')
| -rw-r--r-- | cmake/SlangTarget.cmake | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cmake/SlangTarget.cmake b/cmake/SlangTarget.cmake index 5387cd2ce..9e3fe11cd 100644 --- a/cmake/SlangTarget.cmake +++ b/cmake/SlangTarget.cmake @@ -18,6 +18,9 @@ function(slang_add_target dir type) WIN32_EXECUTABLE # Install this target for a non-component install INSTALL + # Don't include any source in this target, this is a complement to + # EXPLICIT_SOURCE, and doesn't interact with EXTRA_SOURCE_DIRS + NO_SOURCE ) set(single_value_args # Set the target name, useful for multiple targets from the same @@ -35,6 +38,10 @@ function(slang_add_target dir type) # ${EXPORT_MACRO_PREFIX}_DYNAMIC_EXPORT macros are set for using and # building respectively EXPORT_MACRO_PREFIX + # Ignore target type and use a particular style of export macro + # _DYNAMIC or _STATIC, this is useful when the target type is OBJECT + # pass in STATIC or SHARED + EXPORT_TYPE_AS # The folder in which to place this target for IDE-based generators (VS # and XCode) FOLDER @@ -115,7 +122,8 @@ function(slang_add_target dir type) # # Find the source for this target # - if(ARG_EXPLICIT_SOURCE) + if(ARG_NO_SOURCE) + elseif(ARG_EXPLICIT_SOURCE) list(APPEND source ${ARG_EXPLICIT_SOURCE}) else() slang_glob_sources(source ${dir}) @@ -269,6 +277,8 @@ function(slang_add_target dir type) if( target_type STREQUAL SHARED_LIBRARY OR target_type STREQUAL MODULE_LIBRARY + OR ARG_EXPORT_TYPE_AS STREQUAL SHARED + OR ARG_EXPORT_TYPE_AS STREQUAL MODULE ) target_compile_definitions( ${target} @@ -277,11 +287,14 @@ function(slang_add_target dir type) ) elseif( target_type STREQUAL STATIC_LIBRARY + OR ARG_EXPORT_TYPE_AS STREQUAL STATIC ) target_compile_definitions( ${target} PUBLIC "${ARG_EXPORT_MACRO_PREFIX}_STATIC" ) + else() + message(WARNING "unhandled case in slang_add_target while setting export macro") endif() endif() |
