build: add application icon on Windows

This commit is contained in:
xiphon 2019-12-20 13:27:47 +00:00
parent 3e07ecabf9
commit beeddea678

View File

@ -5,7 +5,7 @@ add_subdirectory(libwalletqt)
add_subdirectory(model) add_subdirectory(model)
add_subdirectory(zxcvbn-c) add_subdirectory(zxcvbn-c)
qt5_add_resources(QML_QRC ../qml.qrc) qt5_add_resources(RESOURCES ../qml.qrc)
# Compile source files (.h/.cpp) # Compile source files (.h/.cpp)
file(GLOB SOURCE_FILES file(GLOB SOURCE_FILES
@ -64,18 +64,23 @@ if(WITH_SCANNER)
) )
endif() endif()
message(STATUS ${QML_QRC})
set(EXECUTABLE_FLAG) set(EXECUTABLE_FLAG)
if(MINGW) if(MINGW)
set(EXECUTABLE_FLAG WIN32) set(EXECUTABLE_FLAG WIN32)
set(ICON ${PROJECT_SOURCE_DIR}/images/appicon.ico)
set(ICON_RC ${CMAKE_CURRENT_BINARY_DIR}/icon.rc)
set(ICON_RES ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
file(WRITE ${ICON_RC} "IDI_ICON1 ICON DISCARDABLE \"${ICON}\"")
add_custom_command(OUTPUT ${ICON_RES} COMMAND windres ${ICON_RC} ${ICON_RES} MAIN_DEPENDENCY ${ICON_RC})
list(APPEND RESOURCES ${ICON_RES})
endif() endif()
add_executable(monero-gui ${EXECUTABLE_FLAG} main/main.cpp add_executable(monero-gui ${EXECUTABLE_FLAG} main/main.cpp
${SOURCE_FILES} ${SOURCE_FILES}
${PASS_STRENGTH_FILES} ${PASS_STRENGTH_FILES}
${QR_CODE_FILES} ${QR_CODE_FILES}
${QML_QRC} ${RESOURCES}
) )
set_property(TARGET monero-gui PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set_property(TARGET monero-gui PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")