1
0
mirror of synced 2024-11-24 07:40:17 +01:00

cmake: Do not ship resource.rc on non WIN32 systems

Also add some very early macOS bundle definitions.
This commit is contained in:
Mary 2020-12-28 20:03:50 +01:00
parent bbd00a6020
commit 58a65b0004
5 changed files with 29 additions and 3 deletions

View File

@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.16)
project(imhex VERSION 1.5.0)
if (APPLE)
option (CREATE_BUNDLE "Create a bundle on macOS" OFF)
endif()
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
set(CMAKE_CXX_STANDARD 20)
@ -82,7 +86,29 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGIT_BRANCH=\"\\\"${GIT_BRANCH}\"\\\"")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DRELEASE -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}\"\\\"")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}-Debug\"\\\"")
set(install_dest RUNTIME)
if (WIN32)
set(application_type WIN32)
set(imhex_icon resource.rc)
elseif (APPLE)
set (imhex_icon "${PROJECT_SOURCE_DIR}/res/mac/AppIcon.icns")
if (CREATE_BUNDLE)
set(application_type MACOSX_BUNDLE)
set_source_files_properties(${imhex_icon} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set(MACOSX_BUNDLE_ICON_FILE "AppIcon.icns")
set(MACOSX_BUNDLE_INFO_STRING ${CPACK_PACKAGE_VENDOR})
set(MACOSX_BUNDLE_GUI_IDENTIFIER "WerWolv.ImHex")
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${CPACK_PACKAGE_VERSION})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2020 WerWolv. All rights reserved." )
set(install_dest BUNDLE)
endif()
endif()
add_executable(imhex
${application_type}
source/main.cpp
source/window.cpp
@ -115,7 +141,7 @@ add_executable(imhex
source/views/view_patches.cpp
source/views/view_command_palette.cpp
resource.rc
${imhex_icon}
)
set_target_properties(imhex PROPERTIES CXX_VISIBILITY_PRESET hidden)
@ -128,4 +154,4 @@ elseif (UNIX)
target_link_libraries(imhex magic crypto ${CMAKE_DL_LIBS} capstone LLVMDemangle imgui libimhex ${Python_LIBRARIES} nlohmann_json::nlohmann_json dl)
endif()
install(TARGETS imhex DESTINATION bin)
install(TARGETS imhex ${install_dest} DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

BIN
res/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

BIN
res/mac/AppIcon.icns Normal file

Binary file not shown.

View File

@ -1 +1 @@
GLFW_ICON ICON icon.ico
GLFW_ICON ICON res/icon.ico