diff --git a/CMakeLists.txt b/CMakeLists.txt index b53c80dd9..78c50de35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,11 @@ find_package(Vulkan REQUIRED) include(conan_setup) add_subdirectory(shaders) + +if(MSVC) + add_subdirectory(platform/windows) +endif() + add_subdirectory(src) if(INEXOR_BUILD_BENCHMARKS) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index e08c4e0a1..82db5f0ba 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,4 +1,9 @@ -add_executable(inexor-vulkan-renderer-example main.cpp) +add_executable(inexor-vulkan-renderer-example +main.cpp +# Windows resource file to set application icon and metadata +${CMAKE_BINARY_DIR}/include/inexor/vulkan-renderer/resource.hpp +${CMAKE_BINARY_DIR}/include/inexor/vulkan-renderer/win_resource_file.rc +) set_target_properties( inexor-vulkan-renderer-example PROPERTIES diff --git a/platform/windows/CMakeLists.txt b/platform/windows/CMakeLists.txt new file mode 100644 index 000000000..06a20da01 --- /dev/null +++ b/platform/windows/CMakeLists.txt @@ -0,0 +1,17 @@ +set(APP_MANUFACTURER_NAME "Inexor collective") +set(APP_DESCRIPTION "Inexor vulkan-renderer") +set(APP_NAME "Inexor engine") +set(APP_LICENSE "MIT License") +set(APP_ORIGINAL_NAME "Inexor vulkan renderer example") +set(APP_VERSION_MAJOR 1) +set(APP_VERSION_MINOR 0) +set(APP_VERSION_PATCH 0) + +# Replace variables in resource file with CMake values +configure_file( + win_resource_file.rc.in ${CMAKE_BINARY_DIR}/include/inexor/vulkan-renderer/win_resource_file.rc +) + +configure_file( + resource.hpp.in ${CMAKE_BINARY_DIR}/include/inexor/vulkan-renderer/resource.hpp +) diff --git a/platform/windows/inexor_icon_256px.ico b/platform/windows/inexor_icon_256px.ico new file mode 100644 index 000000000..ab3be7a55 Binary files /dev/null and b/platform/windows/inexor_icon_256px.ico differ diff --git a/platform/windows/resource.hpp.in b/platform/windows/resource.hpp.in new file mode 100644 index 000000000..1e6b73b23 --- /dev/null +++ b/platform/windows/resource.hpp.in @@ -0,0 +1,11 @@ +// Specify icon from resource file as icon of executable +#define IDI_ICON1 105 + +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 106 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/platform/windows/win_resource_file.rc.in b/platform/windows/win_resource_file.rc.in new file mode 100644 index 000000000..c9d8031b4 --- /dev/null +++ b/platform/windows/win_resource_file.rc.in @@ -0,0 +1,42 @@ +#include "resource.hpp" + +#define APSTUDIO_READONLY_SYMBOLS +#include "winres.h" +#undef APSTUDIO_READONLY_SYMBOLS + +VS_VERSION_INFO VERSIONINFO + FILEVERSION ${APP_VERSION_MAJOR},${APP_VERSION_MINOR},${APP_VERSION_PATCH},0 + PRODUCTVERSION ${APP_VERSION_MAJOR},${APP_VERSION_MINOR},${APP_VERSION_PATCH},0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040704b0" + BEGIN + // These placeholders will be filled out with the values specified by CMake + VALUE "CompanyName", "${APP_MANUFACTURER_NAME}" + VALUE "FileDescription", "${APP_DESCRIPTION}" + VALUE "FileVersion", "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}" + VALUE "InternalName", "${APP_NAME}" + VALUE "LegalCopyright", "${APP_LICENSE}" + VALUE "OriginalFilename", "${APP_ORIGINAL_NAME}" + VALUE "ProductName", "${APP_NAME}" + VALUE "ProductVersion", "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_PATCH}" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x407, 1200 + END +END + +// Use Inexor logo as icon for executable +IDI_ICON1 ICON "${PROJECT_SOURCE_DIR}\\platform\\windows\\inexor_icon_256px.ico"