cmake improvements, default *nix user build to CMake
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Syping 2020-08-27 18:14:30 +02:00
parent ec93fa8ce0
commit bbf7f08980
6 changed files with 129 additions and 62 deletions

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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");

31
res/app_cmake.qrc Normal file
View file

@ -0,0 +1,31 @@
<RCC>
<qresource prefix="/img">
<file>5sync-48.png</file>
<file>5sync-16.png</file>
<file>5sync-24.png</file>
<file>5sync-32.png</file>
<file>5sync-40.png</file>
<file>5sync-64.png</file>
<file>5sync-96.png</file>
<file>5sync-128.png</file>
<file>5sync-256.png</file>
<file>add.svgz</file>
<file>avatararea.png</file>
<file>avatarareaimport.png</file>
<file>back.svgz</file>
<file>empty1x16.png</file>
<file>mappreview.jpg</file>
<file>next.svgz</file>
<file>pointmaker-8.png</file>
<file>pointmaker-16.png</file>
<file>pointmaker-24.png</file>
<file>pointmaker-32.png</file>
<file>savegame.svgz</file>
<file>watermark_1b.png</file>
<file>watermark_2b.png</file>
<file>watermark_2r.png</file>
</qresource>
<qresource prefix="/template">
<file>template.g5e</file>
</qresource>
</RCC>