From 1a796039d9222ea4b4a0f79cc2b6578cb8ae9737 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Mon, 30 Jul 2018 16:25:54 +0200 Subject: [PATCH] Make shared library dependencies private. By default CMake makes dependencies public, which is not what we want for libdawn, libdawn_native and libdawn_wire --- src/dawn_native/CMakeLists.txt | 4 ++-- src/dawn_wire/CMakeLists.txt | 2 +- src/utils/CMakeLists.txt | 23 ++++++++++++++++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/dawn_native/CMakeLists.txt b/src/dawn_native/CMakeLists.txt index 1137eeac53..c191ae736b 100644 --- a/src/dawn_native/CMakeLists.txt +++ b/src/dawn_native/CMakeLists.txt @@ -116,7 +116,7 @@ endif() if (DAWN_ENABLE_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 ${METAL_DIR}/BlendStateMTL.mm @@ -415,7 +415,7 @@ add_dependencies(libdawn_native_objects dawn_native_utils_autogen) add_library(libdawn_native SHARED $) 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") add_library(libdawn_native_static STATIC $) diff --git a/src/dawn_wire/CMakeLists.txt b/src/dawn_wire/CMakeLists.txt index 4c539727ae..b5ff96a5e9 100644 --- a/src/dawn_wire/CMakeLists.txt +++ b/src/dawn_wire/CMakeLists.txt @@ -32,6 +32,6 @@ add_library(dawn_wire SHARED ${DAWN_WIRE_INCLUDE_DIR}/Wire.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) DawnInternalTarget("wire" dawn_wire) diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 6e880d29c2..d985016318 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -25,6 +25,16 @@ list(APPEND UTILS_SOURCES ${UTILS_DIR}/TerribleCommandBuffer.h ) +list(APPEND UTILS_DEPS + dawn_common + libdawn_native + shaderc_shared + libdawn + glfw +) + +set(UTILS_INCLUDE_DIRS) + if (DAWN_ENABLE_D3D12) list(APPEND UTILS_SOURCES ${UTILS_DIR}/D3D12Binding.cpp @@ -35,6 +45,10 @@ if (DAWN_ENABLE_METAL) list(APPEND UTILS_SOURCES ${UTILS_DIR}/MetalBinding.mm ) + list(APPEND UTILS_DEPS + "-framework Metal" + "-framework QuartzCore" + ) endif() if (DAWN_ENABLE_NULL) @@ -47,16 +61,23 @@ if (DAWN_ENABLE_OPENGL) list(APPEND UTILS_SOURCES ${UTILS_DIR}/OpenGLBinding.cpp ) + list(APPEND UTILS_DEPS + glad + ) endif() if (DAWN_ENABLE_VULKAN) list(APPEND UTILS_SOURCES ${UTILS_DIR}/VulkanBinding.cpp ) + list(APPEND UTILS_INCLUDE_DIRS + ${VULKAN_HEADERS_INCLUDE_DIR} + ) endif() 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) if(NOT MSVC) # allow C-style casts -- for shaderc