Make shared library dependencies private.

By default CMake makes dependencies public, which is not what we want
for libdawn, libdawn_native and libdawn_wire
This commit is contained in:
Corentin Wallez 2018-07-30 16:25:54 +02:00 committed by Corentin Wallez
parent bdc867713a
commit 1a796039d9
3 changed files with 25 additions and 4 deletions

View File

@ -116,7 +116,7 @@ endif()
if (DAWN_ENABLE_METAL) if (DAWN_ENABLE_METAL)
GenerateProcTable(metal) GenerateProcTable(metal)
list(APPEND DAWN_NATIVE_DEPS metal_autogen "-framework QuartzCore" "-framework Metal" "-framework Cocoa") list(APPEND DAWN_NATIVE_DEPS metal_autogen "-framework Metal" "-framework Cocoa")
list(APPEND DAWN_NATIVE_SOURCES list(APPEND DAWN_NATIVE_SOURCES
${METAL_DIR}/BlendStateMTL.mm ${METAL_DIR}/BlendStateMTL.mm
@ -415,7 +415,7 @@ add_dependencies(libdawn_native_objects dawn_native_utils_autogen)
add_library(libdawn_native SHARED $<TARGET_OBJECTS:libdawn_native_objects>) add_library(libdawn_native SHARED $<TARGET_OBJECTS:libdawn_native_objects>)
DawnInternalTarget("dawn_native" libdawn_native) DawnInternalTarget("dawn_native" libdawn_native)
target_link_libraries(libdawn_native ${DAWN_NATIVE_DEPS}) target_link_libraries(libdawn_native PRIVATE ${DAWN_NATIVE_DEPS})
set_property(TARGET libdawn_native PROPERTY OUTPUT_NAME "dawn_native") set_property(TARGET libdawn_native PROPERTY OUTPUT_NAME "dawn_native")
add_library(libdawn_native_static STATIC $<TARGET_OBJECTS:libdawn_native_objects>) add_library(libdawn_native_static STATIC $<TARGET_OBJECTS:libdawn_native_objects>)

View File

@ -32,6 +32,6 @@ add_library(dawn_wire SHARED
${DAWN_WIRE_INCLUDE_DIR}/Wire.h ${DAWN_WIRE_INCLUDE_DIR}/Wire.h
${DAWN_WIRE_INCLUDE_DIR}/dawn_wire_export.h ${DAWN_WIRE_INCLUDE_DIR}/dawn_wire_export.h
) )
target_link_libraries(dawn_wire dawn_common) target_link_libraries(dawn_wire PRIVATE dawn_common)
target_compile_definitions(dawn_wire PRIVATE DAWN_WIRE_IMPLEMENTATION) target_compile_definitions(dawn_wire PRIVATE DAWN_WIRE_IMPLEMENTATION)
DawnInternalTarget("wire" dawn_wire) DawnInternalTarget("wire" dawn_wire)

View File

@ -25,6 +25,16 @@ list(APPEND UTILS_SOURCES
${UTILS_DIR}/TerribleCommandBuffer.h ${UTILS_DIR}/TerribleCommandBuffer.h
) )
list(APPEND UTILS_DEPS
dawn_common
libdawn_native
shaderc_shared
libdawn
glfw
)
set(UTILS_INCLUDE_DIRS)
if (DAWN_ENABLE_D3D12) if (DAWN_ENABLE_D3D12)
list(APPEND UTILS_SOURCES list(APPEND UTILS_SOURCES
${UTILS_DIR}/D3D12Binding.cpp ${UTILS_DIR}/D3D12Binding.cpp
@ -35,6 +45,10 @@ if (DAWN_ENABLE_METAL)
list(APPEND UTILS_SOURCES list(APPEND UTILS_SOURCES
${UTILS_DIR}/MetalBinding.mm ${UTILS_DIR}/MetalBinding.mm
) )
list(APPEND UTILS_DEPS
"-framework Metal"
"-framework QuartzCore"
)
endif() endif()
if (DAWN_ENABLE_NULL) if (DAWN_ENABLE_NULL)
@ -47,16 +61,23 @@ if (DAWN_ENABLE_OPENGL)
list(APPEND UTILS_SOURCES list(APPEND UTILS_SOURCES
${UTILS_DIR}/OpenGLBinding.cpp ${UTILS_DIR}/OpenGLBinding.cpp
) )
list(APPEND UTILS_DEPS
glad
)
endif() endif()
if (DAWN_ENABLE_VULKAN) if (DAWN_ENABLE_VULKAN)
list(APPEND UTILS_SOURCES list(APPEND UTILS_SOURCES
${UTILS_DIR}/VulkanBinding.cpp ${UTILS_DIR}/VulkanBinding.cpp
) )
list(APPEND UTILS_INCLUDE_DIRS
${VULKAN_HEADERS_INCLUDE_DIR}
)
endif() endif()
add_library(utils STATIC ${UTILS_SOURCES}) add_library(utils STATIC ${UTILS_SOURCES})
target_link_libraries(utils libdawn_native shaderc_shared libdawn glfw) target_link_libraries(utils ${UTILS_DEPS})
target_include_directories(utils PRIVATE ${UTILS_INCLUDE_DIRS})
DawnInternalTarget("" utils) DawnInternalTarget("" utils)
if(NOT MSVC) if(NOT MSVC)
# allow C-style casts -- for shaderc # allow C-style casts -- for shaderc