-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adjust About dialog * actually enable translations * fix application icon on Windows #52, add more WIX customizations * add wrapper for qt_add_translations for qt5
- Loading branch information
Showing
14 changed files
with
2,355 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,21 @@ if(NOT ("$ENV{BUILD_VERSION}" STREQUAL "")) | |
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION $ENV{BUILD_VERSION}) | ||
endif() | ||
|
||
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" _version_match ${VERSION}) | ||
set(VERSION_MAJOR ${CMAKE_MATCH_1}) | ||
set(VERSION_MINOR ${CMAKE_MATCH_2}) | ||
set(VERSION_PATCH ${CMAKE_MATCH_3}) | ||
|
||
project(efibooteditor | ||
VERSION ${VERSION} | ||
DESCRIPTION "Boot Editor for (U)EFI based systems" | ||
DESCRIPTION "Boot Editor for (U)EFI based systems." | ||
LANGUAGES C CXX | ||
) | ||
|
||
set(PROJECT_NAME_CAPITALIZED "EFIBootEditor") | ||
set(PROJECT_HOMEPAGE_URL "https://github.com/Neverous/efibooteditor") | ||
set(APPLICATION_NAME "EFI Boot Editor") | ||
set(APPLICATION_ICON "${CMAKE_SOURCE_DIR}/icons/Tango/256/categories/preferences-system.ico") | ||
|
||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
|
@@ -51,6 +59,7 @@ find_package(Qt${QT_VERSION_MAJOR} | |
Gui | ||
Network | ||
Widgets | ||
LinguistTools | ||
REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE | ||
|
@@ -71,12 +80,39 @@ if(${QT_VERSION_MAJOR} GREATER 5) | |
target_link_libraries(${PROJECT_NAME} PRIVATE | ||
Qt::Core5Compat | ||
) | ||
else() | ||
if(NOT COMMAND qt_add_translations) | ||
function(qt_add_translations TARGET) | ||
cmake_parse_arguments(arg "" "" "TS_FILES;INCLUDE_DIRECTORIES" ${ARGN}) | ||
qt5_add_translation(QM_FILES ${arg_TS_FILES}) | ||
|
||
get_target_property(BINARY_DIR ${TARGET} BINARY_DIR) | ||
set(QRC ${BINARY_DIR}/translations.qrc) | ||
file(WRITE ${QRC} "<RCC><qresource prefix=\"/i18n\">\n") | ||
foreach (QM_PATH ${QM_FILES}) | ||
file(RELATIVE_PATH QM_FILE ${BINARY_DIR} ${QM_PATH}) | ||
file(APPEND ${QRC} "<file>${QM_FILE}</file>\n") | ||
endforeach (QM) | ||
file(APPEND ${QRC} "</qresource></RCC>") | ||
|
||
qt_add_resources(RESOURCES ${QRC}) | ||
target_sources(${PROJECT_NAME} PRIVATE ${RESOURCES}) | ||
endfunction() | ||
endif() | ||
endif() | ||
|
||
target_compile_definitions(${PROJECT_NAME} PRIVATE | ||
APPLICATION_NAME="${APPLICATION_NAME}" | ||
VERSION="${VERSION}" | ||
VERSION_MAJOR=${VERSION_MAJOR} | ||
VERSION_MINOR=${VERSION_MINOR} | ||
VERSION_PATCH=${VERSION_PATCH} | ||
PROJECT_NAME="${PROJECT_NAME}" | ||
PROJECT_DESCRIPTION="${PROJECT_DESCRIPTION}" | ||
PROJECT_HOMEPAGE_URL="${PROJECT_HOMEPAGE_URL}" | ||
APPLICATION_ICON="${APPLICATION_ICON}" | ||
QT_DEPRECATED_WARNINGS | ||
QT_DISABLE_DEPRECATED_BEFORE=0xFFFFFF | ||
VERSION="$ENV{BUILD_VERSION}" | ||
) | ||
|
||
# GCC | ||
|
@@ -143,12 +179,16 @@ if(WIN32) | |
# Enable all warnings in application code | ||
/Wall /permissive- /WX | ||
# Disable some warnings | ||
# C4464: relative include path contains '.. | ||
/wd4464 | ||
# C4702: unreachable code | ||
/wd4702 | ||
# C4710: 'function' : function not inlined | ||
/wd4710 | ||
# C4711: function 'function' selected for inline expansion | ||
/wd4711 | ||
# C4820: 'bytes' bytes padding added after construct 'member_name' | ||
/wd4820 | ||
# C4866: compiler may not enforce left-to-right evaluation order for call to 'C++17 operator' | ||
/wd4866 | ||
# C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified | ||
|
@@ -189,6 +229,7 @@ if(WIN32) | |
src/efivar-lite.c | ||
src/efivar-lite.common.h | ||
src/efivar-lite.win32.c | ||
windows.rc | ||
) | ||
endif() | ||
|
||
|
@@ -236,6 +277,15 @@ target_sources(${PROJECT_NAME} PRIVATE | |
qt_add_resources(RESOURCES icons.qrc) | ||
target_sources(${PROJECT_NAME} PRIVATE ${RESOURCES}) | ||
|
||
# Translations | ||
FILE(GLOB TRANSLATIONS | ||
${CMAKE_SOURCE_DIR}/translations/${PROJECT_NAME}_*.ts | ||
) | ||
|
||
qt_add_translations(${PROJECT_NAME} | ||
TS_FILES ${TRANSLATIONS} | ||
INCLUDE_DIRECTORIES "include") | ||
|
||
if(APPLE) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE | ||
"-framework CoreFoundation" | ||
|
@@ -290,13 +340,21 @@ if(WIN32) | |
install(DIRECTORY "${CMAKE_BINARY_DIR}/qt/" | ||
TYPE BIN | ||
COMPONENT Runtime | ||
PATTERN "*.pdb" EXCLUDE | ||
) | ||
|
||
if(("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") OR ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")) | ||
install(FILES "$<TARGET_PDB_FILE:${PROJECT_NAME}>" | ||
TYPE BIN | ||
COMPONENT Debug | ||
) | ||
|
||
install(DIRECTORY "${CMAKE_BINARY_DIR}/qt/" | ||
TYPE BIN | ||
COMPONENT Debug | ||
FILES_MATCHING | ||
PATTERN "*.pdb" | ||
) | ||
endif() | ||
|
||
elseif(APPLE) | ||
|
@@ -333,14 +391,14 @@ set(CPACK_PACKAGE_CONTACT "Maciej Szeptuch <[email protected]>") | |
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}") | ||
set(CPACK_PACKAGE_DIRECTORY dist) | ||
set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} "${PROJECT_NAME_CAPITALIZED}") | ||
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/Neverous/efibooteditor") | ||
set(CPACK_PACKAGE_HOMEPAGE_URL ${PROJECT_HOMEPAGE_URL}) | ||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME_CAPITALIZED}") | ||
set(CPACK_PACKAGE_NAME "${PROJECT_NAME_CAPITALIZED}") | ||
set(CPACK_PACKAGE_NAME "${APPLICATION_NAME}") | ||
set(CPACK_PACKAGE_VENDOR ${PROJECT_NAME_CAPITALIZED}) | ||
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) | ||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt") | ||
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") | ||
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/icons/Tango/scalable/categories/preferences-desktop.svg") | ||
set(CPACK_PACKAGE_ICON "${APPLICATION_ICON}") | ||
|
||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") | ||
set(CPACK_STRIP_FILES TRUE) | ||
|
@@ -352,6 +410,8 @@ if(WIN32) | |
|
||
set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") | ||
set(CPACK_WIX_PRODUCT_ICON ${CPACK_PACKAGE_ICON}) | ||
set(CPACK_WIX_UI_BANNER "${CMAKE_SOURCE_DIR}/misc/wix_banner.png") | ||
set(CPACK_WIX_UI_DIALOG "${CMAKE_SOURCE_DIR}/misc/wix_dialog.png") | ||
set(CPACK_WIX_PROPERTY_ARPHELPLINK "${CPACK_PACKAGE_HOMEPAGE_URL}") | ||
set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "${CPACK_PACKAGE_HOMEPAGE_URL}") | ||
set(CPACK_WIX_ROOT_FEATURE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.