diff --git a/CMakeLists.txt b/CMakeLists.txt index f74fdc1..638d782 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,104 +13,139 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt5 COMPONENTS Network Svg Widgets REQUIRED) -add_executable(gta5view - config.h +set(GTA5VIEW_SOURCES main.cpp AboutDialog.cpp - AboutDialog.h - AboutDialog.ui AppEnv.cpp - AppEnv.h CrewDatabase.cpp - CrewDatabase.h DatabaseThread.cpp - DatabaseThread.h ExportDialog.cpp - ExportDialog.h ExportThread.cpp - ExportThread.h GlobalString.cpp - GlobalString.h IconLoader.cpp - IconLoader.h ImportDialog.cpp - ImportDialog.h - ImportDialog.ui JsonEditorDialog.cpp - JsonEditorDialog.h - JsonEditorDialog.ui MapLocationDialog.cpp - MapLocationDialog.h - MapLocationDialog.ui OptionsDialog.cpp - OptionsDialog.h - OptionsDialog.ui PictureDialog.cpp - PictureDialog.h - PictureDialog.ui PictureExport.cpp - PictureExport.h PictureWidget.cpp - PictureWidget.h PlayerListDialog.cpp - PlayerListDialog.h - PlayerListDialog.ui ProfileDatabase.cpp - ProfileDatabase.h ProfileInterface.cpp - ProfileInterface.h - ProfileInterface.ui ProfileLoader.cpp - ProfileLoader.h ProfileWidget.cpp - ProfileWidget.h SavegameCopy.cpp - SavegameCopy.h SavegameData.cpp - SavegameData.h SavegameDialog.cpp - SavegameDialog.h - SavegameDialog.ui SavegameWidget.cpp - SavegameWidget.h - SavegameWidget.ui SidebarGenerator.cpp - SidebarGenerator.h SnapmaticEditor.cpp - SnapmaticEditor.h - SnapmaticEditor.ui SnapmaticPicture.cpp - SnapmaticPicture.h SnapmaticWidget.cpp - SnapmaticWidget.h - SnapmaticWidget.ui StandardPaths.cpp - StandardPaths.h StringParser.cpp - StringParser.h TranslationClass.cpp - TranslationClass.h UserInterface.cpp - UserInterface.h - UserInterface.ui anpro/imagecropper.cpp - anpro/imagecropper.h pcg/pcg_basic.c - pcg/pcg_basic.h - res/tr_g5p.qrc - res/app.qrc uimod/JSHighlighter.cpp - uimod/JSHighlighter.h uimod/UiModLabel.cpp - uimod/UiModLabel.h uimod/UiModWidget.cpp +) + +set(GTA5VIEW_HEADERS + config.h + AboutDialog.h + AppEnv.h + CrewDatabase.h + DatabaseThread.h + ExportDialog.h + ExportThread.h + GlobalString.h + IconLoader.h + ImportDialog.h + JsonEditorDialog.h + MapLocationDialog.h + OptionsDialog.h + PictureDialog.h + PictureExport.h + PictureWidget.h + PlayerListDialog.h + ProfileDatabase.h + ProfileInterface.h + ProfileLoader.h + ProfileWidget.h + SavegameCopy.h + SavegameData.h + SavegameDialog.h + SavegameWidget.h + SidebarGenerator.h + SnapmaticEditor.h + SnapmaticPicture.h + SnapmaticWidget.h + StandardPaths.h + StringParser.h + TranslationClass.h + UserInterface.h + anpro/imagecropper.h + pcg/pcg_basic.h + uimod/JSHighlighter.h + uimod/UiModLabel.h uimod/UiModWidget.h ) +set(GTA5VIEW_INCLUDEDIR + anpro + pcg + uimod +) + +set(GTA5VIEW_FORMS + AboutDialog.ui + ExportDialog.ui + ImportDialog.ui + JsonEditorDialog.ui + MapLocationDialog.ui + OptionsDialog.ui + PictureDialog.ui + PlayerListDialog.ui + ProfileInterface.ui + SavegameDialog.ui + SavegameWidget.ui + SnapmaticEditor.ui + SnapmaticWidget.ui + UserInterface.ui +) + +set(GTA5VIEW_DEFINES + -DGTA5SYNC_CMAKE + -DGTA5SYNC_PROJECT + -DGTA5SYNC_NOASSIST +) + +set(GTA5VIEW_RESOURCES + res/tr_g5p.qrc + res/app_cmake.qrc + res/global.qrc +) + +set_property(SOURCE res/global.qrc PROPERTY AUTORCC_OPTIONS "-threshold;0;-compress;9") + +add_executable(gta5view + ${GTA5VIEW_SOURCES} + ${GTA5VIEW_FORMS} + ${GTA5VIEW_RESOURCES} +) + if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16.0") target_precompile_headers(gta5view PRIVATE config.h) endif() -target_include_directories(gta5view PRIVATE anpro pcg uimod) +target_compile_definitions(gta5view PRIVATE ${GTA5VIEW_DEFINES}) +target_include_directories(gta5view PRIVATE ${GTA5VIEW_INCLUDEDIR}) target_link_libraries(gta5view PRIVATE Qt5::Network Qt5::Svg Qt5::Widgets) -target_compile_definitions(gta5view PRIVATE -DGTA5SYNC_PROJECT -DGTA5SYNC_NOASSIST) + +install(TARGETS gta5view DESTINATION bin) +install(FILES res/gta5view.desktop DESTINATION share/applications) +install(FILES res/gta5view.png DESTINATION share/pixmaps) diff --git a/README.md b/README.md index a31d429..ec8b8ba 100644 --- a/README.md +++ b/README.md @@ -24,21 +24,19 @@ Grand Theft Auto V Savegame and Snapmatic viewer/editor #### Build gta5view for Debian/Ubuntu - sudo apt-get install git gcc g++ libqt5svg5-dev qtbase5-dev qttranslations5-l10n qt5-qmake make + sudo apt-get install cmake git gcc g++ libqt5svg5-dev qtbase5-dev qttranslations5-l10n make git clone https://gitlab.com/Syping/gta5view && cd gta5view mkdir -p build && cd build - ../configure --prefix=/opt/gta5view - make depend + cmake ../ make -j $(nproc --all) sudo make install #### Build gta5view for Fedora - sudo dnf install git gcc gcc-c++ qt5-qtbase-devel qt5-qtsvg-devel qt5-qttranslations make + sudo dnf install cmake git gcc gcc-c++ qt5-qtbase-devel qt5-qtsvg-devel qt5-qttranslations make git clone https://gitlab.com/Syping/gta5view && cd gta5view mkdir -p build && cd build - ../configure --prefix=/opt/gta5view - make depend + cmake ../ make -j $(nproc --all) sudo make install diff --git a/gta5view.pro b/gta5view.pro index f8bfb4e..270566e 100644 --- a/gta5view.pro +++ b/gta5view.pro @@ -140,7 +140,7 @@ TRANSLATIONS += \ RESOURCES += \ res/tr_g5p.qrc \ - res/app.qrc + res/app_qmake.qrc DISTFILES += res/app.rc \ res/gta5view.desktop \ @@ -160,6 +160,7 @@ INCLUDEPATH += ./anpro ./pcg ./tmext ./uimod # GTA5SYNC/GTA5VIEW ONLY +DEFINES += GTA5SYNC_QMAKE # We using qmake do we? DEFINES += GTA5SYNC_PROJECT # Enable exclusive gta5sync/gta5view functions DEFINES += GTA5SYNC_NOASSIST # Not assisting at proper usage of SnapmaticPicture class diff --git a/main.cpp b/main.cpp index b93c665..8da8242 100644 --- a/main.cpp +++ b/main.cpp @@ -74,7 +74,9 @@ int main(int argc, char *argv[]) a.setApplicationVersion(GTA5SYNC_APPVER); a.setQuitOnLastWindowClosed(false); +#ifdef GTA5SYNC_QMAKE QResource::registerResource(":/global/global.rcc"); +#endif QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR); settings.beginGroup("Startup"); diff --git a/res/app_cmake.qrc b/res/app_cmake.qrc new file mode 100644 index 0000000..e02e903 --- /dev/null +++ b/res/app_cmake.qrc @@ -0,0 +1,31 @@ + + + 5sync-48.png + 5sync-16.png + 5sync-24.png + 5sync-32.png + 5sync-40.png + 5sync-64.png + 5sync-96.png + 5sync-128.png + 5sync-256.png + add.svgz + avatararea.png + avatarareaimport.png + back.svgz + empty1x16.png + mappreview.jpg + next.svgz + pointmaker-8.png + pointmaker-16.png + pointmaker-24.png + pointmaker-32.png + savegame.svgz + watermark_1b.png + watermark_2b.png + watermark_2r.png + + + template.g5e + + diff --git a/res/app.qrc b/res/app_qmake.qrc similarity index 100% rename from res/app.qrc rename to res/app_qmake.qrc