diff --git a/generator/vk_common/CMakeLists.txt b/generator/vk_common/CMakeLists.txt index 0ca2695..327e476 100644 --- a/generator/vk_common/CMakeLists.txt +++ b/generator/vk_common/CMakeLists.txt @@ -21,32 +21,21 @@ # SOFTWARE. # ----------------------------------------------------------------------------- -set(BUILD_TARGET lib_layer_framework) +set(LIB_BINARY lib_layer_framework) add_library( - ${BUILD_TARGET} STATIC + ${LIB_BINARY} STATIC device_functions.cpp instance_functions.cpp) target_include_directories( - ${BUILD_TARGET} PRIVATE + ${LIB_BINARY} PRIVATE # Note, this includes from the layer-specific tree ${PROJECT_SOURCE_DIR}/source ../) target_include_directories( - ${BUILD_TARGET} SYSTEM PRIVATE + ${LIB_BINARY} SYSTEM PRIVATE ../../khronos/vulkan/include) -lgl_set_build_options(${BUILD_TARGET}) - -# TODO: Log tag needs to come from child project -target_compile_definitions( - ${BUILD_TARGET} PRIVATE - $<$:VK_USE_PLATFORM_ANDROID_KHR=1> - $<$:LGL_LOG_TAG="${LGL_LOG_TAG}">) - -# TODO: Remove this? -target_link_libraries( - ${BUILD_TARGET} - $<$:log>) +lgl_set_build_options(${LIB_BINARY}) diff --git a/source_common/compiler_helper.cmake b/source_common/compiler_helper.cmake index 3859219..351795e 100644 --- a/source_common/compiler_helper.cmake +++ b/source_common/compiler_helper.cmake @@ -42,9 +42,14 @@ set(is_clangcl "$>") # Compiler is upstream clang with the standard frontend set(is_clang "$>") -# Utility macro to set standard compiler options +# Utility macro to set standard compiler and linker options macro(lgl_set_build_options BUILD_TARGET_NAME) + # Layers are shared objects so must be position independent + set_property( + TARGET ${BUILD_TARGET_NAME} + PROPERTY POSITION_INDEPENDENT_CODE ON) + target_compile_options( ${BUILD_TARGET_NAME} PRIVATE # Minimized visibility warnings @@ -61,7 +66,10 @@ macro(lgl_set_build_options BUILD_TARGET_NAME) $<${is_clang}:-Wdocumentation> # Feature disabled - $<${is_gnu_fe}:-fno-exceptions> - $<${is_gnu_fe}:-fno-rtti>) + $<${is_gnu_fe}:-fno-exceptions>) + target_compile_definitions( + ${BUILD_TARGET_NAME} PRIVATE + $<$:VK_USE_PLATFORM_ANDROID_KHR=1> + $<$:LGL_LOG_TAG="${LGL_LOG_TAG}">) endmacro() diff --git a/source_common/framework/CMakeLists.txt b/source_common/framework/CMakeLists.txt index 0ca2695..327e476 100644 --- a/source_common/framework/CMakeLists.txt +++ b/source_common/framework/CMakeLists.txt @@ -21,32 +21,21 @@ # SOFTWARE. # ----------------------------------------------------------------------------- -set(BUILD_TARGET lib_layer_framework) +set(LIB_BINARY lib_layer_framework) add_library( - ${BUILD_TARGET} STATIC + ${LIB_BINARY} STATIC device_functions.cpp instance_functions.cpp) target_include_directories( - ${BUILD_TARGET} PRIVATE + ${LIB_BINARY} PRIVATE # Note, this includes from the layer-specific tree ${PROJECT_SOURCE_DIR}/source ../) target_include_directories( - ${BUILD_TARGET} SYSTEM PRIVATE + ${LIB_BINARY} SYSTEM PRIVATE ../../khronos/vulkan/include) -lgl_set_build_options(${BUILD_TARGET}) - -# TODO: Log tag needs to come from child project -target_compile_definitions( - ${BUILD_TARGET} PRIVATE - $<$:VK_USE_PLATFORM_ANDROID_KHR=1> - $<$:LGL_LOG_TAG="${LGL_LOG_TAG}">) - -# TODO: Remove this? -target_link_libraries( - ${BUILD_TARGET} - $<$:log>) +lgl_set_build_options(${LIB_BINARY})