Commit c36276ef authored by SeeLook's avatar SeeLook 🎸
Browse files

Added installation rules, fixed runinplace target

- create 'share' dir out of build path
parent 97e74adf
......@@ -60,12 +60,13 @@ target_compile_definitions(metronomek
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>
)
target_link_libraries(metronomek
PRIVATE Qt6::Core Qt6::Gui Qt6::Quick ${ALSA_LINK} ${PulseAudio_LINK}
target_link_libraries(metronomek PRIVATE
Qt6::Core Qt6::Gui Qt6::Quick
${ALSA_LINK} ${PulseAudio_LINK}
)
set_target_properties(metronomek PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_GUI_IDENTIFIER org.seelook.metronomek
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
......@@ -74,6 +75,64 @@ qt_import_qml_plugins(metronomek)
qt_finalize_executable(metronomek)
##############################################################################
# Installation #
# (ignored under Android) #
##############################################################################
if(WIN32)
install(TARGETS metronomek DESTINATION .)
set(INS_PREF ".")
option(COPY_GCC_LIBS "Copy compiler specific libraries during install target" ON)
else()
if (APPLE)
install(TARGETS metronomek DESTINATION "${CMAKE_INSTALL_PREFIX}/metronomek.app/Contents/MacOs")
set(INS_PREF "metronomek.app/Contents/Resources")
else()
install(TARGETS metronomek DESTINATION bin)
set(INS_PREF "share/metronomek")
endif()
endif()
# Beat sound samples
file(GLOB BEAT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/sounds/*.raw48-16")
install(FILES ${BEAT_FILES} DESTINATION "${INS_PREF}/sounds")
install(FILES LICENSE DESTINATION "${INS_PREF}")
# translations (*.qm)
file(GLOB QM_STUFF "${CMAKE_CURRENT_SOURCE_DIR}/translations/*.qm")
install(FILES ${QM_STUFF} DESTINATION "${INS_PREF}/translations")
# Icons & other stuff
if (WIN32)
install(FILE installs/metronomek.nsi DESTINATION ${INS_PREF})
install(FILES images/metronomek.ico images/pack.ico images/logo.bmp DESTINATION ${INS_PREF})
# MINGW libraries
if (COPY_GCC_LIBS)
get_filename_component(MAKE_DIR "${CMAKE_RC_COMPILER}" DIRECTORY)
install(FILES "${MAKE_DIR}/libgcc_s_dw2-1.dll" "${MAKE_DIR}/libstdc++-6.dll" "${MAKE_DIR}/libwinpthread-1.dll" DESTINATION "${INS_PREF}")
endif()
else()
if(APPLE)
# TODO
else() # Linux
install(FILES installs/metronomek.desktop DESTINATION share/applications)
install(FILES images/hicolor/16x16/apps/metronomek.png DESTINATION share/icons/hicolor/16x16/apps/)
install(FILES images/hicolor/24x24/apps/metronomek.png DESTINATION share/icons/hicolor/24x24/apps/)
install(FILES images/hicolor/32x32/apps/metronomek.png DESTINATION share/icons/hicolor/32x32/apps/)
install(FILES images/hicolor/48x48/apps/metronomek.png DESTINATION share/icons/hicolor/48x48/apps/)
install(FILES images/hicolor/64x64/apps/metronomek.png DESTINATION share/icons/hicolor/64x64/apps/)
install(FILES images/hicolor/128x128/apps/metronomek.png DESTINATION share/icons/hicolor/128x128/apps/)
install(FILES images/hicolor/256x256/apps/metronomek.png DESTINATION share/icons/hicolor/256x256/apps/)
install(FILES images/metronomek.png DESTINATION share/icons/hicolor/512x512/apps/)
endif()
endif()
##############################################################################
# runinplace target #
# (Linux & Mac Os) #
##############################################################################
if (UNIX AND NOT ANDROID)
message(STATUS "
To enable launching MetronomeK without installing, call:
......
#! /bin/bash
# Copyright (C) 2020-2021 by Tomasz Bojczuk (seelook@gmail.com)
# Copyright (C) 2020 by Tomasz Bojczuk (seelook@gmail.com)
# on the terms of GNU GPLv3 license (http://www.gnu.org/licenses)
# This script creates links necessary to run MetronomeK without installation (in directory where it is built)
......@@ -16,24 +16,15 @@ printf "\033[01;35mLinking source files necessary to run MetronomeK"
printf "\033[01;00m"
echo
if [ $( echo $DST_DIR| grep 'Resources') ]; then
echo "Linking for Mac Os"
DST_DIR=$2/
LINK_FROM=$2/../
else
echo "Linking for Linux"
DST_DIR=$2/share/metronomek/
LINK_FROM=$2/
fi
DST_DIR=$2/../share/metronomek/
echo $DST_DIR
if [ -d $DST_DIR ]; then
echo "Already done... Exiting!"
exit
else
mkdir -p $DST_DIR
ln -s $LINK_FROM/translations $DST_DIR
ln -s $SRC_DIR/translations $DST_DIR
ln -s $SRC_DIR/sounds $DST_DIR
fi
......@@ -46,7 +46,7 @@ int main(int argc, char *argv[])
#else
// QLocale loc(qgetenv("LANG"));
QLocale loc(QLocale(qgetenv("LANG")).language(), QLocale(qgetenv("LANG")).country());
QString p = qApp->applicationDirPath() + QLatin1String("/share/metronomek/translations/");
QString p = qApp->applicationDirPath() + QLatin1String("/../share/metronomek/translations/");
#endif
QLocale::setDefault(loc);
......
......@@ -432,7 +432,7 @@ QString TaudioOUT::getRawFilePath(const QString& fName) {
#elif defined (Q_OS_WIN)
QString rawFilePath = qApp->applicationDirPath() + QLatin1String("/sounds/");
#else
QString rawFilePath = qApp->applicationDirPath() + QLatin1String("/share/metronomek/sounds/");
QString rawFilePath = qApp->applicationDirPath() + QLatin1String("/../share/metronomek/sounds/");
#endif
return rawFilePath + fName + QLatin1String(".raw48-16");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment