From: Charles Giessen Date: Wed, 3 Nov 2021 20:25:29 +0000 (-0600) Subject: Replace loader_cmake_config.h with definitions X-Git-Tag: upstream/1.3.208~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=578e4771f89a0b23490d793c64aa732a304d7f8b;p=platform%2Fupstream%2FVulkan-Loader.git Replace loader_cmake_config.h with definitions Use CMakes built in ability to define compiler definitions to targets so that the loader_cmake_config.h file is made redundant. This simplifies the build process by removing the configure_file and including it. Note that this commit is a part of a series of commits and not intended to work by itself. --- diff --git a/BUILD.gn b/BUILD.gn index 08df4aef..dc1f8720 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -37,7 +37,6 @@ if (is_win) { config("vulkan_internal_config") { defines = [ - "VULKAN_NON_CMAKE_BUILD", "VK_ENABLE_BETA_EXTENSIONS", ] if (is_clang || !is_win) { diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 6ab7813f..acea3da5 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -30,10 +30,16 @@ include(CheckIncludeFile) check_function_exists(secure_getenv HAVE_SECURE_GETENV) check_function_exists(__secure_getenv HAVE___SECURE_GETENV) -if(NOT (HAVE_SECURE_GETENV OR HAVE__SECURE_GETENV)) + +if (HAVE_SECURE_GETENV) + target_compile_definitions(loader_specific_options INTERFACE HAVE_SECURE_GETENV) +endif() +if (HAVE___SECURE_GETENV) + target_compile_definitions(loader_specific_options INTERFACE HAVE___SECURE_GETENV) +endif() +if(NOT (HAVE_SECURE_GETENV OR HAVE___SECURE_GETENV)) message(WARNING "Using non-secure environmental lookups. This loader will not properly disable environent variables when run with elevated permissions.") endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/loader_cmake_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/loader_cmake_config.h) if(WIN32) if(MSVC AND NOT MSVC_VERSION LESS 1900) diff --git a/loader/get_environment.c b/loader/get_environment.c index bf878dab..10a3ddf4 100644 --- a/loader/get_environment.c +++ b/loader/get_environment.c @@ -30,12 +30,6 @@ #include "log.h" -// This is a CMake generated file with #defines for if secure_getenv and __secure_getenv -// are present. -#if !defined(VULKAN_NON_CMAKE_BUILD) -#include "loader_cmake_config.h" -#endif // !defined(VULKAN_NON_CMAKE_BUILD) - // Environment variables #if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNXNTO__) || defined(__FreeBSD__) diff --git a/loader/loader_cmake_config.h.in b/loader/loader_cmake_config.h.in deleted file mode 100644 index 3bbc4612..00000000 --- a/loader/loader_cmake_config.h.in +++ /dev/null @@ -1,2 +0,0 @@ -#cmakedefine HAVE_SECURE_GETENV -#cmakedefine HAVE___SECURE_GETENV