diff --git a/CMakeLists.txt b/CMakeLists.txt index f111ed8b..fa9e5382 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,10 @@ include(GitCommands) # Set the project version include(K4AProjectVersion) +# Default to not embed an icon in resources +set(K4A_USE_ICON 0) +set(K4A_ICON_PATH ${CMAKE_CURRENT_LIST_DIR}/kinect-viewer.ico) + set(PROJ_DIR ${CMAKE_CURRENT_LIST_DIR}) set(INCLUDE_DIR ${PROJ_DIR}/include) @@ -59,12 +63,18 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZH:SHA_256") endif() -# If using clang or GCC only linked shared libraries if needed +# If using clang or GCC, only linked shared libraries if needed if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed") endif() +# If using clang or GCC, be sure to include a build id +if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--build-id") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--build-id") +endif() + # Find all dependencies add_subdirectory(extern) @@ -270,4 +280,4 @@ cpack_add_component( "Tools for Azure Kinect Development" REQUIRED DEPENDS - runtime) \ No newline at end of file + runtime) diff --git a/kinect-viewer.ico b/kinect-viewer.ico new file mode 100644 index 00000000..cf4dc0e1 Binary files /dev/null and b/kinect-viewer.ico differ diff --git a/tools/k4aviewer/CMakeLists.txt b/tools/k4aviewer/CMakeLists.txt index 1c272429..98578c03 100644 --- a/tools/k4aviewer/CMakeLists.txt +++ b/tools/k4aviewer/CMakeLists.txt @@ -41,6 +41,7 @@ set(SOURCE_FILES # to embed version information set(K4A_FILEDESCRIPTION "Azure Kinect Viewer") set(K4A_ORIGINALFILENAME "k4aviewer.exe") +set(K4A_USE_ICON 1) configure_file( ${K4A_VERSION_RC} ${CMAKE_CURRENT_BINARY_DIR}/version.rc diff --git a/version.rc.in b/version.rc.in index 4ea707d2..a9f81445 100644 --- a/version.rc.in +++ b/version.rc.in @@ -24,6 +24,10 @@ #define VER_PRIVATEBUILD 0 #define VER_PRERELEASE 0 +#if @K4A_USE_ICON@ +APP_ICON ICON "@K4A_ICON_PATH@" +#endif + VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION PRODUCTVERSION VER_PRODUCTVERSION