|
| 1 | +#################################################################################################### |
| 2 | +# |
| 3 | +# RawInputViewer - A utility to test, visualize, and map WM_INPUT messages. |
| 4 | +# |
| 5 | +# Copyright (c) 2025 by Bitdancer (@RealBitdancer) |
| 6 | +# |
| 7 | +# Licensed under the MIT License. See LICENSE file in the repository for details. |
| 8 | +# |
| 9 | +# Source: https://github.com/RealBitdancer/RawInputViewer |
| 10 | +# |
| 11 | +#################################################################################################### |
| 12 | + |
| 13 | +cmake_minimum_required(VERSION 3.20) |
| 14 | + |
| 15 | +project(RawInputViewer LANGUAGES CXX) |
| 16 | + |
| 17 | +set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
| 18 | +set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Limited configurations" FORCE) |
| 19 | +set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME}) |
| 20 | + |
| 21 | +add_executable(${PROJECT_NAME} WIN32) |
| 22 | + |
| 23 | +target_sources(${PROJECT_NAME} |
| 24 | + PUBLIC |
| 25 | + "src/${PROJECT_NAME}.cpp" |
| 26 | + |
| 27 | + # Header files are here as workaround to ensure folder |
| 28 | + # "Header Files" for VS2022 project files is generated. |
| 29 | + "src/${PROJECT_NAME}.hpp" |
| 30 | + "src/res/resource.h" |
| 31 | + |
| 32 | + # Resource files are here as workaround to ensure |
| 33 | + # source_group "Resource Files" is generated. |
| 34 | + "src/res/${PROJECT_NAME}.rc" |
| 35 | + "src/res/${PROJECT_NAME}.ico" |
| 36 | + "src/res/${PROJECT_NAME}.manifest" |
| 37 | + "src/res/ScanCodeMapping.txt" |
| 38 | + "src/res/VirtualKeyMapping.txt" |
| 39 | + "src/res/ListView.bmp" |
| 40 | + "src/res/ToolBar.bmp" |
| 41 | + |
| 42 | + # There seems to be no sensible workaround for having ${PROJECT_NAME}.manifest |
| 43 | + # show up in the Solution Explorer, which is annoying to say the least. |
| 44 | +) |
| 45 | + |
| 46 | +source_group("Resource Files" |
| 47 | + FILES |
| 48 | + "src/res/${PROJECT_NAME}.rc" |
| 49 | + "src/res/${PROJECT_NAME}.ico" |
| 50 | + "src/res/ScanCodeMapping.txt" |
| 51 | + "src/res/VirtualKeyMapping.txt" |
| 52 | + "src/res/ListView.bmp" |
| 53 | + "src/res/ToolBar.bmp" |
| 54 | +) |
| 55 | + |
| 56 | +set_source_files_properties("src/res/${PROJECT_NAME}.rc" PROPERTIES LANGUAGE RC) |
| 57 | + |
| 58 | +set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DPI_AWARE "PerMonitor") |
| 59 | + |
| 60 | +target_compile_definitions(${PROJECT_NAME} PRIVATE UNICODE _UNICODE) |
| 61 | +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_23) |
| 62 | +target_compile_options(${PROJECT_NAME} PRIVATE /W3) |
| 63 | +target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:Release>:/WX>) |
| 64 | + |
| 65 | +target_include_directories(${PROJECT_NAME} PRIVATE src/res) |
| 66 | +target_link_libraries(${PROJECT_NAME} PRIVATE user32 comctl32 Version) |
0 commit comments