Set target defines PUBLIC.

This CL sets the target defines as PUBLIC so downstream CMakeFiles can
correctly setup the defines when including the tint headers

Change-Id: Idcb38761ed73ecda652945287ff096a11e7b2b01
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/30840
Commit-Queue: David Neto <dneto@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair 2020-10-23 17:04:10 +00:00 committed by Commit Bot service account
parent 1b1d2a5907
commit f6fdcb1114
1 changed files with 13 additions and 10 deletions

View File

@ -73,9 +73,6 @@ if (${TINT_BUILD_SPV_READER})
include_directories("${PROJECT_SOURCE_DIR}/third_party/spirv-tools/include") include_directories("${PROJECT_SOURCE_DIR}/third_party/spirv-tools/include")
endif() endif()
include_directories("${PROJECT_SOURCE_DIR}/third_party/spirv-headers/include")
include_directories("${PROJECT_SOURCE_DIR}/include")
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR
("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") OR
(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND
@ -116,19 +113,25 @@ if(MSVC)
endif() endif()
function(tint_default_compile_options TARGET) function(tint_default_compile_options TARGET)
include_directories("${PROJECT_SOURCE_DIR}") target_include_directories(${TARGET} PUBLIC "${PROJECT_SOURCE_DIR}")
target_include_directories(${TARGET} PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_compile_definitions(${TARGET} PRIVATE if (${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER})
target_include_directories(${TARGET} PUBLIC
"${PROJECT_SOURCE_DIR}/third_party/spirv-headers/include")
endif()
target_compile_definitions(${TARGET} PUBLIC
-DTINT_BUILD_SPV_READER=$<BOOL:${TINT_BUILD_SPV_READER}>) -DTINT_BUILD_SPV_READER=$<BOOL:${TINT_BUILD_SPV_READER}>)
target_compile_definitions(${TARGET} PRIVATE target_compile_definitions(${TARGET} PUBLIC
-DTINT_BUILD_WGSL_READER=$<BOOL:${TINT_BUILD_WGSL_READER}>) -DTINT_BUILD_WGSL_READER=$<BOOL:${TINT_BUILD_WGSL_READER}>)
target_compile_definitions(${TARGET} PRIVATE target_compile_definitions(${TARGET} PUBLIC
-DTINT_BUILD_HLSL_WRITER=$<BOOL:${TINT_BUILD_HLSL_WRITER}>) -DTINT_BUILD_HLSL_WRITER=$<BOOL:${TINT_BUILD_HLSL_WRITER}>)
target_compile_definitions(${TARGET} PRIVATE target_compile_definitions(${TARGET} PUBLIC
-DTINT_BUILD_MSL_WRITER=$<BOOL:${TINT_BUILD_MSL_WRITER}>) -DTINT_BUILD_MSL_WRITER=$<BOOL:${TINT_BUILD_MSL_WRITER}>)
target_compile_definitions(${TARGET} PRIVATE target_compile_definitions(${TARGET} PUBLIC
-DTINT_BUILD_SPV_WRITER=$<BOOL:${TINT_BUILD_SPV_WRITER}>) -DTINT_BUILD_SPV_WRITER=$<BOOL:${TINT_BUILD_SPV_WRITER}>)
target_compile_definitions(${TARGET} PRIVATE target_compile_definitions(${TARGET} PUBLIC
-DTINT_BUILD_WGSL_WRITER=$<BOOL:${TINT_BUILD_WGSL_WRITER}>) -DTINT_BUILD_WGSL_WRITER=$<BOOL:${TINT_BUILD_WGSL_WRITER}>)
if (${COMPILER_IS_LIKE_GNU}) if (${COMPILER_IS_LIKE_GNU})