Tweaks to gqrx executable under windows

* Build the gqrx icon into the executable under windows.
* Converted gqrx.svg into gqrx.ico for embedding the icon.
* Also build the executable as win32 app, not console,
  so it can be opened from executable without a terminal.
This commit is contained in:
Josh Blum 2016-01-26 20:42:57 -08:00
parent 666d16e44c
commit 1b2a4c7ef2
2 changed files with 19 additions and 0 deletions

BIN
resources/icons/gqrx.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -34,6 +34,19 @@ QT5_ADD_RESOURCES(RESOURCES_LIST
../resources/textfiles.qrc
)
########################################################################
# Resource file - adds an icon to GQRX executable
if (WIN32)
set(ICON_SOURCE ${CMAKE_SOURCE_DIR}/resources/icons/gqrx.ico)
set(RES_FILES "${CMAKE_CURRENT_BINARY_DIR}/gqrx.rc")
file(WRITE "${RES_FILES}" "id ICON \"${ICON_SOURCE}\"")
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)
set(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
list(APPEND RESOURCES_LIST ${RES_FILES})
endif(WIN32)
#######################################################################################################################
# Build the program
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_SOURCE} ${UIS_HDRS} ${RESOURCES_LIST})
@ -48,5 +61,11 @@ target_link_libraries(${PROJECT_NAME}
${PULSE-SIMPLE}
)
#build a win32 app, not a console app
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "/entry:mainCRTStartup ${CMAKE_EXE_LINKER_FLAGS}")
set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE ON)
endif (WIN32)
set(INSTALL_DEFAULT_BINDIR "bin" CACHE STRING "Appended to CMAKE_INSTALL_PREFIX")
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${INSTALL_DEFAULT_BINDIR})