diff options
author | Saturneric <[email protected]> | 2021-06-17 17:57:07 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-06-17 17:57:07 +0000 |
commit | 7e218e5ddc1d8f7eb6008fae070335d759946356 (patch) | |
tree | 04cc5fa7b8397fa5ebb06f1824af8d04d6930fa4 /src | |
parent | Make it possible to compile and run on Windows. (diff) | |
download | GpgFrontend-7e218e5ddc1d8f7eb6008fae070335d759946356.tar.gz GpgFrontend-7e218e5ddc1d8f7eb6008fae070335d759946356.zip |
Improve project configuration files.
Automatically copy resource files during project settings.
Change the name of the build target to gpgfrontend.
Automatic configuration of compilation information such as version number during project setting.
Solve the problem that Windows cannot run normally.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 27 | ||||
-rw-r--r-- | src/gpg/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/main.cpp | 8 |
3 files changed, 28 insertions, 9 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0158ef6c..b4280fcc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,10 +4,27 @@ add_subdirectory(ui) aux_source_directory(. BASE_SOURCE) file(GLOB_RECURSE GPG4USB_HEADER_FILES RELACTIVE ../include/* *.h) -qt5_wrap_cpp(QT5_MOCS ${GPG4USB_HEADER_FILES} TARGET gpg4usb) +qt5_wrap_cpp(QT5_MOCS ${GPG4USB_HEADER_FILES} TARGET gpgfrontend) -add_executable(gpg4usb ${BASE_SOURCE} ../gpg4usb.qrc ${QT5_MOCS}) +# Set Build Information +configure_file(${CMAKE_SOURCE_DIR}/include/GpgFrontend.h.in ${CMAKE_SOURCE_DIR}/include/GpgFrontend.h @ONLY) + +# Copy Resource File +file(COPY ${CMAKE_SOURCE_DIR}/resource/ DESTINATION ${EXECUTABLE_OUTPUT_PATH}/ FOLLOW_SYMLINK_CHAIN) + +add_executable(gpgfrontend ${BASE_SOURCE} ${CMAKE_SOURCE_DIR}/gpgfrontend.qrc ${QT5_MOCS}) + +IF (MINGW) + message(STATUS "Link Application Static Library For MINGW")完善工程设置 + target_link_libraries(gpgfrontend + qtui gpg + Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core) + + +else() + message(STATUS "Link Application Static Library For UNIX") + target_link_libraries(gpgfrontend + qtui gpg + Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core) +endif() -target_link_libraries(gpg4usb - qtui gpg - Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core) diff --git a/src/gpg/CMakeLists.txt b/src/gpg/CMakeLists.txt index 3213c457..a12f371f 100644 --- a/src/gpg/CMakeLists.txt +++ b/src/gpg/CMakeLists.txt @@ -8,11 +8,13 @@ set(UTILS_DIR ${CMAKE_SOURCE_DIR}/utils) set(GPGME_LIB_DIR ${UTILS_DIR}/gpgme/lib) IF (MINGW) + message(STATUS "Link GPG Static Library For MINGW") target_link_libraries(gpg gpgme gpg-error assuan Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core wsock32) else() + message(STATUS "Link GPG Static Library For Unix") target_link_libraries(gpg gpgme gpg-error assuan Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core) diff --git a/src/main.cpp b/src/main.cpp index 6cb84d25..7ce4a946 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,14 +26,14 @@ int main(int argc, char *argv[]) { - Q_INIT_RESOURCE(gpg4usb); + Q_INIT_RESOURCE(gpgfrontend); QApplication app(argc, argv); // get application path QString appPath = qApp->applicationDirPath(); - QApplication::setApplicationVersion("1.0.0"); + QApplication::setApplicationVersion(BUILD_VERSION); QApplication::setApplicationName("GPGFrontend"); // dont show icons in menus @@ -67,11 +67,11 @@ int main(int argc, char *argv[]) { lang = QLocale::system().name(); } - translator.load("ts/gpg4usb_" + lang, appPath); + translator.load("./ts/gpg4usb_" + lang, appPath); QApplication::installTranslator(&translator); // set qt translations - translator2.load("ts/qt_" + lang, appPath); + translator2.load("./ts/qt_" + lang, appPath); QApplication::installTranslator(&translator2); MainWindow window; |