Fix copyright in windows .rc file
authorCharles Giessen <charles@lunarg.com>
Wed, 25 Jan 2023 21:32:41 +0000 (14:32 -0700)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Wed, 25 Jan 2023 23:33:21 +0000 (16:33 -0700)
This commit makes the copyright date to be taken from the day of the build
instead of it being hardcoded, which is liable to be out of date.

This commit also makes the loader.rc be generated into the build directory
rather than the source tree. Because this commit modifies the version info to
include the current header version for debug builds, this prevents needing to
update the file whenever the headers update.

loader/CMakeLists.txt
loader/loader.rc [deleted file]
loader/loader.rc.in

index c48f097c3bbef7d9351fc959b9108d04363b32c6..1e43130535dc1264bfe38600fc06969140e739e8 100644 (file)
@@ -1,7 +1,7 @@
 # ~~~
-# Copyright (c) 2014-2021 The Khronos Group Inc.
-# Copyright (c) 2014-2021 Valve Corporation
-# Copyright (c) 2014-2021 LunarG, Inc.
+# Copyright (c) 2014-2023 The Khronos Group Inc.
+# Copyright (c) 2014-2023 Valve Corporation
+# Copyright (c) 2014-2023 LunarG, Inc.
 # Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -69,9 +69,10 @@ if(WIN32)
     # Optionally uses the BUILD_DLL_VERSIONINFO build option to allow setting the exact build version
     # Adds "Dev Build" to any build without the BUILD_DLL_VERSIONINFO option set
     # ~~~
+    string(TIMESTAMP CURRENT_YEAR "%Y")
+    set(LOADER_CUR_COPYRIGHT_STR "${CURRENT_YEAR}")
     if ("$CACHE{BUILD_DLL_VERSIONINFO}" STREQUAL "")
-        # default case - use 0 as the BUILDNO
-        set(LOADER_RC_VERSION "1.0.1111.2222")
+        set(LOADER_RC_VERSION "${VulkanHeaders_VERSION}")
         set(LOADER_VER_FILE_VERSION_STR "\"${LOADER_RC_VERSION}.Dev Build\"")
         set(LOADER_VER_FILE_DESCRIPTION_STR "\"Vulkan Loader - Dev Build\"")
     else()
@@ -85,7 +86,7 @@ if(WIN32)
 
     # Configure the file to include the versioning info
     # Place it in the current directory for check-in - so the GN build has up to date info
-    configure_file(loader.rc.in ${CMAKE_CURRENT_LIST_DIR}/loader.rc)
+    configure_file(loader.rc.in ${CMAKE_CURRENT_BINARY_DIR}/loader.rc)
 else()
     # Used to make alloca() and secure_getenv() available
     target_compile_definitions(loader_specific_options INTERFACE _GNU_SOURCE)
@@ -272,7 +273,7 @@ if(WIN32)
                 ${NORMAL_LOADER_SRCS}
                 $<TARGET_OBJECTS:loader-unknown-chain>
                 ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-1.def
-                ${CMAKE_CURRENT_LIST_DIR}/loader.rc)
+                ${CMAKE_CURRENT_BINARY_DIR}/loader.rc)
 
     target_link_libraries(vulkan PRIVATE loader_specific_options loader-opt)
 
diff --git a/loader/loader.rc b/loader/loader.rc
deleted file mode 100644 (file)
index 996d9c5..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// Copyright (c) 2014-2022 The Khronos Group Inc.
-// Copyright (c) 2014-2022 Valve Corporation
-// Copyright (c) 2014-2022 LunarG, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// Author: David Pinedo <david@lunarg.com>
-// Author: Charles Giessen <charles@lunarg.com>
-//
-
-#include "winres.h"
-
-// All set through CMake
-#define VER_FILE_VERSION 1, 0, 1111, 2222
-#define VER_FILE_DESCRIPTION_STR "Vulkan Loader - Dev Build"
-#define VER_FILE_VERSION_STR "1.0.1111.2222.Dev Build"
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION VER_FILE_VERSION
- PRODUCTVERSION VER_FILE_VERSION
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS VS_FF_DEBUG
-#else
- FILEFLAGS 0x0L
-#endif
-
- FILEOS 0x00000L
- FILETYPE VFT_DLL
- FILESUBTYPE 0x0L
-BEGIN
-    BLOCK "StringFileInfo"
-    BEGIN
-        BLOCK "04090000"
-        BEGIN
-            VALUE "FileDescription", VER_FILE_DESCRIPTION_STR
-            VALUE "FileVersion", VER_FILE_VERSION_STR
-            VALUE "LegalCopyright", "Copyright (C) 2015-2022"
-            VALUE "ProductName", "Vulkan Runtime"
-            VALUE "ProductVersion", VER_FILE_VERSION_STR
-        END
-    END
-    BLOCK "VarFileInfo"
-    BEGIN
-        VALUE "Translation", 0x409, 0000
-    END
-END
index 23010f53d21126534135b57de6651c4efe7499c0..e242f9bb0ba73a7652a451f631737154ae727c83 100644 (file)
@@ -1,7 +1,7 @@
 //
-// Copyright (c) 2014-2022 The Khronos Group Inc.
-// Copyright (c) 2014-2022 Valve Corporation
-// Copyright (c) 2014-2022 LunarG, Inc.
+// Copyright (c) 2014-2023 The Khronos Group Inc.
+// Copyright (c) 2014-2023 Valve Corporation
+// Copyright (c) 2014-2023 LunarG, Inc.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
 #define VER_FILE_VERSION ${LOADER_VER_FILE_VERSION}
 #define VER_FILE_DESCRIPTION_STR ${LOADER_VER_FILE_DESCRIPTION_STR}
 #define VER_FILE_VERSION_STR ${LOADER_VER_FILE_VERSION_STR}
+#define VER_COPYRIGHT_STR "Copyright (C) 2015-${LOADER_CUR_COPYRIGHT_STR}"
 
 VS_VERSION_INFO VERSIONINFO
  FILEVERSION VER_FILE_VERSION
@@ -46,7 +47,7 @@ BEGIN
         BEGIN
             VALUE "FileDescription", VER_FILE_DESCRIPTION_STR
             VALUE "FileVersion", VER_FILE_VERSION_STR
-            VALUE "LegalCopyright", "Copyright (C) 2015-2022"
+            VALUE "LegalCopyright", VER_COPYRIGHT_STR
             VALUE "ProductName", "Vulkan Runtime"
             VALUE "ProductVersion", VER_FILE_VERSION_STR
         END