Avoid boilerplate code in build script utilizing c++utilities/qtutilities
* Prepare use of qtutilities for improving UI * Remove code for enabling warnings that has been copied from c++utilities * Remove code for various details now handled in qtutilities helpers * Simplify configuration of executable * Simplify finding Qt modules
This commit is contained in:
parent
10363f312b
commit
8dfca58470
|
@ -34,7 +34,7 @@ jobs:
|
|||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DQT_PACKAGE_NAME=Qt5
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DQT_PACKAGE_PREFIX=Qt5
|
||||
make -j$(nproc)
|
||||
make install DESTDIR=AppDir
|
||||
# Package
|
||||
|
@ -87,7 +87,7 @@ jobs:
|
|||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DQT_PACKAGE_NAME=Qt6
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DQT_PACKAGE_PREFIX=Qt6
|
||||
make -j$(nproc)
|
||||
make install DESTDIR=AppDir
|
||||
# Package
|
||||
|
@ -134,7 +134,7 @@ jobs:
|
|||
mkdir build
|
||||
cd build
|
||||
export PKG_CONFIG_PATH="$(brew --prefix readline)/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
cmake .. -DCMAKE_PREFIX_PATH="$(brew --prefix qt@6);" -DQT_PACKAGE_NAME=Qt6
|
||||
cmake .. -DCMAKE_PREFIX_PATH="$(brew --prefix qt@6);" -DQT_PACKAGE_PREFIX=Qt6
|
||||
make
|
||||
make install-translations
|
||||
$(brew --prefix qt@6)/bin/macdeployqt build/pianobooster.app -dmg
|
||||
|
|
2
BUILD.md
2
BUILD.md
|
@ -11,7 +11,7 @@ and then run CMake from it:
|
|||
```
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake .. -DQT_PACKAGE_NAME=Qt6 # or cmake .. -DQT_PACKAGE_NAME=Qt5
|
||||
$ cmake .. -DQT_PACKAGE_PREFIX=Qt6 # or cmake .. -DQT_PACKAGE_PREFIX=Qt5
|
||||
```
|
||||
|
||||
To compile the PianoBooster source code type:
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
cmake_minimum_required(VERSION 2.4)
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif(COMMAND cmake_policy)
|
||||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
project(pianobooster)
|
||||
|
||||
# set project's name
|
||||
PROJECT( pianobooster )
|
||||
# allow using non-default configuration
|
||||
set(CONFIGURATION_PACKAGE_SUFFIX "" CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities")
|
||||
set(CONFIGURATION_PACKAGE_SUFFIX_QTUTILITIES "${CONFIGURATION_PACKAGE_SUFFIX}" CACHE STRING "sets the suffix for qtutilities")
|
||||
set(CONFIGURATION_PACKAGE_SUFFIX_QTFORKAWESOME "${CONFIGURATION_PACKAGE_SUFFIX_QTUTILITIES}" CACHE STRING "sets the suffix for qtforkawesome")
|
||||
set(PACKAGE_NAMESPACE "" CACHE STRING "sets the prefix for find_package() calls to packages configured via c++utilities")
|
||||
if (PACKAGE_NAMESPACE)
|
||||
set(PACKAGE_NAMESPACE_PREFIX "${PACKAGE_NAMESPACE}-")
|
||||
endif ()
|
||||
|
||||
ADD_SUBDIRECTORY(src build)
|
||||
add_subdirectory(src build)
|
||||
|
|
|
@ -1,4 +1,84 @@
|
|||
# Cmake File for Piano Booster
|
||||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
|
||||
# set meta data
|
||||
# note: I am treating is for now a fork as upstream does not merge any patches anymore.
|
||||
# Hence I am putting myself as author here and use my fork's URL.
|
||||
project(pianobooster)
|
||||
set(META_PROJECT_NAME ${PROJECT_NAME})
|
||||
set(META_PROJECT_TYPE application)
|
||||
set(META_APP_NAME "PianoBooster")
|
||||
set(META_APP_CATEGORIES "Music;Education;")
|
||||
set(META_APP_AUTHOR "Martchus")
|
||||
set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
|
||||
set(META_APP_DESCRIPTION "Learn the piano just by playing a game")
|
||||
set(META_VERSION_MAJOR 1)
|
||||
set(META_VERSION_MINOR 0)
|
||||
set(META_VERSION_PATCH 1)
|
||||
set(META_RELEASE_DATE "2023-05-06")
|
||||
|
||||
set(SRC_FILES MidiFile.cpp MidiTrack.cpp Song.cpp Conductor.cpp Util.cpp
|
||||
Chord.cpp Tempo.cpp MidiDevice.cpp MidiDeviceRt.cpp)
|
||||
set(HEADER_FILES MidiFile.h MidiTrack.h Song.h Conductor.h Rating.h Util.h
|
||||
Chord.h Tempo.h MidiDevice.h MidiDeviceRt.h)
|
||||
set(WIDGETS_SRC_FILES
|
||||
QtMain.cpp
|
||||
QtWindow.cpp
|
||||
GuiTopBar.cpp
|
||||
GuiSidePanel.cpp
|
||||
GuiMidiSetupDialog.cpp
|
||||
GuiKeyboardSetupDialog.cpp
|
||||
GuiPreferencesDialog.cpp
|
||||
GuiSongDetailsDialog.cpp
|
||||
GuiLoopingPopup.cpp
|
||||
GlView.cpp
|
||||
StavePosition.cpp
|
||||
Score.cpp
|
||||
Cfg.cpp
|
||||
Piano.cpp
|
||||
Draw.cpp
|
||||
Scroll.cpp
|
||||
Notation.cpp
|
||||
TrackList.cpp
|
||||
Rating.cpp
|
||||
Bar.cpp
|
||||
Settings.cpp
|
||||
Merge.cpp
|
||||
pianobooster.rc
|
||||
application.qrc
|
||||
images/pianobooster.ico
|
||||
)
|
||||
set(WIDGETS_HEADER_FILES
|
||||
QtWindow.h
|
||||
GuiTopBar.h
|
||||
GuiSidePanel.h
|
||||
GuiMidiSetupDialog.h
|
||||
GuiKeyboardSetupDialog.h
|
||||
GuiPreferencesDialog.h
|
||||
GuiSongDetailsDialog.h
|
||||
GuiLoopingPopup.h
|
||||
GlView.h
|
||||
StavePosition.h
|
||||
Score.h
|
||||
Cfg.h
|
||||
Piano.h
|
||||
Draw.h
|
||||
Scroll.h
|
||||
Notation.h
|
||||
TrackList.h
|
||||
Rating.h
|
||||
Bar.h
|
||||
Settings.h
|
||||
Merge.h
|
||||
)
|
||||
set(WIDGETS_UI_FILES
|
||||
./GuiTopBar.ui
|
||||
./GuiSidePanel.ui
|
||||
./GuiMidiSetupDialog.ui
|
||||
./GuiKeyboardSetupDialog.ui
|
||||
./GuiPreferencesDialog.ui
|
||||
./GuiSongDetailsDialog.ui
|
||||
./GuiLoopingPopup.ui
|
||||
)
|
||||
|
||||
option(WITH_INTERNAL_FLUIDSYNTH "Build with an internal FluidSynth sound generator" ON)
|
||||
option(USE_FTGL "Build with ftgl for notes localization" ON)
|
||||
|
@ -10,49 +90,36 @@ else()
|
|||
option(USE_BUNDLED_RTMIDI "Build with bundled rtmidi" ON)
|
||||
endif()
|
||||
|
||||
cmake_minimum_required(VERSION 2.4)
|
||||
if(COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
endif(COMMAND cmake_policy)
|
||||
# find c++utilities
|
||||
find_package(${PACKAGE_NAMESPACE_PREFIX}c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.20.0 REQUIRED)
|
||||
use_cpp_utilities(VISIBILITY PUBLIC)
|
||||
|
||||
if(WIN32)
|
||||
MESSAGE("GUI system is WIN32 ${CMAKE_GENERATOR}")
|
||||
endif(WIN32)
|
||||
|
||||
# set project's name
|
||||
PROJECT( pianobooster )
|
||||
|
||||
cmake_policy(SET CMP0020 NEW)
|
||||
cmake_policy(SET CMP0043 NEW)
|
||||
|
||||
# enable warnings
|
||||
add_compile_options(-Wall)
|
||||
# apply basic configuration
|
||||
include(BasicConfig)
|
||||
|
||||
# find qtutilities
|
||||
find_package(${PACKAGE_NAMESPACE_PREFIX}qtutilities${CONFIGURATION_PACKAGE_SUFFIX_QTUTILITIES} 6.11.0 REQUIRED)
|
||||
use_qt_utilities()
|
||||
|
||||
# configure prefix and data dir (FIXME: avoid hardcoding this and use relative lookup instead)
|
||||
add_compile_options("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
|
||||
|
||||
if(NOT DATA_DIR)
|
||||
set(DATA_DIR "share/games/pianobooster")
|
||||
endif()
|
||||
add_compile_options("-DDATA_DIR=\"${DATA_DIR}\"")
|
||||
|
||||
if(NOT CMAKE_INSTALL_BINDIR)
|
||||
set(CMAKE_INSTALL_BINDIR "bin")
|
||||
endif()
|
||||
|
||||
MESSAGE("PREFIX: " ${CMAKE_INSTALL_PREFIX})
|
||||
MESSAGE("DATA_DIR: " ${DATA_DIR})
|
||||
MESSAGE("CMAKE_INSTALL_BINDIR: " ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
# find OpenGL
|
||||
set(OpenGL_GL_PREFERENCE "GLVND")
|
||||
FIND_PACKAGE( OpenGL REQUIRED )
|
||||
|
||||
# find pkg-config
|
||||
if(NOT WIN32 OR MINGW)
|
||||
# the `pkg_check_modules` function is created with this call
|
||||
include(FindPkgConfig)
|
||||
FIND_PACKAGE( PkgConfig REQUIRED )
|
||||
endif()
|
||||
|
||||
# find FTGL
|
||||
if(USE_FTGL)
|
||||
if(NOT WIN32)
|
||||
pkg_check_modules(FTGL ftgl)
|
||||
|
@ -76,41 +143,37 @@ else(USE_FTGL)
|
|||
add_compile_options("-DNO_USE_FTGL")
|
||||
endif(USE_FTGL)
|
||||
|
||||
# configure internationalization support
|
||||
if(NO_LANGS)
|
||||
add_compile_options("-DNO_LANGS")
|
||||
endif()
|
||||
|
||||
# Finds Qt libraries
|
||||
set(QT_PACKAGE_NAME Qt5 CACHE STRING "Name of the Qt package to use, set e.g. to \"Qt6\" to use Qt 6")
|
||||
set(QT_COMPONENTS Core Gui Widgets LinguistTools OpenGL Xml)
|
||||
set(QT_LIBS ${QT_PACKAGE_NAME}::Core ${QT_PACKAGE_NAME}::Gui ${QT_PACKAGE_NAME}::Widgets ${QT_PACKAGE_NAME}::Xml ${QT_PACKAGE_NAME}::OpenGL)
|
||||
if (QT_PACKAGE_NAME STREQUAL Qt6)
|
||||
list(APPEND QT_COMPONENTS OpenGLWidgets Core5Compat)
|
||||
list(APPEND QT_LIBS ${QT_PACKAGE_NAME}::OpenGLWidgets ${QT_PACKAGE_NAME}::Core5Compat)
|
||||
# find Qt libraries
|
||||
list(APPEND ADDITIONAL_QT_MODULES Core Gui Widgets OpenGL Xml)
|
||||
if (QT_PACKAGE_PREFIX MATCHES ".*Qt([0-9]+).*")
|
||||
list(APPEND ADDITIONAL_QT_MODULES OpenGLWidgets Core5Compat)
|
||||
endif ()
|
||||
FIND_PACKAGE( "${QT_PACKAGE_NAME}" REQUIRED COMPONENTS ${QT_COMPONENTS})
|
||||
include(QtGuiConfig)
|
||||
include(QtConfig)
|
||||
|
||||
add_compile_options(-fPIC)
|
||||
|
||||
# Add in the link libraries for each operating system
|
||||
# add platform-specific libraries
|
||||
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
ADD_DEFINITIONS(-D__LINUX_ALSA__)
|
||||
LINK_LIBRARIES (asound)
|
||||
LINK_LIBRARIES (pthread)
|
||||
LINK_LIBRARIES (GL)
|
||||
endif(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES "Windows")
|
||||
ADD_DEFINITIONS(-D__WINDOWS_MM__ -D_WIN32)
|
||||
LINK_LIBRARIES(winmm opengl32)
|
||||
endif(${CMAKE_SYSTEM} MATCHES "Windows")
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES "Darwin")
|
||||
ADD_DEFINITIONS(-D__MACOSX_CORE__)
|
||||
ADD_DEFINITIONS(-std=c++11)
|
||||
LINK_LIBRARIES("-framework CoreMidi -framework CoreAudio -framework CoreFoundation -framework OpenGL")
|
||||
endif(${CMAKE_SYSTEM} MATCHES "Darwin")
|
||||
|
||||
# find FluidSynth
|
||||
if(WITH_INTERNAL_FLUIDSYNTH)
|
||||
if(NOT WIN32)
|
||||
pkg_check_modules(FLUIDSYNTH fluidsynth)
|
||||
|
@ -136,18 +199,10 @@ if(WITH_INTERNAL_FLUIDSYNTH)
|
|||
endif()
|
||||
ADD_DEFINITIONS(-DWITH_INTERNAL_FLUIDSYNTH)
|
||||
MESSAGE("Building with internal fluidsynth")
|
||||
SET( PB_BASE_SRCS MidiDeviceFluidSynth.cpp )
|
||||
list(APPEND SRC_FILES MidiDeviceFluidSynth.cpp)
|
||||
endif(WITH_INTERNAL_FLUIDSYNTH)
|
||||
|
||||
# we need this to be able to include headers produced by uic in our code
|
||||
# (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${OPENGL_INCLUDE_DIR} ${FTGL_INCLUDE_DIR})
|
||||
|
||||
SET(PB_BASE_SRCS MidiFile.cpp MidiTrack.cpp Song.cpp Conductor.cpp Util.cpp
|
||||
Chord.cpp Tempo.cpp MidiDevice.cpp MidiDeviceRt.cpp ${PB_BASE_SRCS})
|
||||
SET(PB_BASE_HDR MidiFile.h MidiTrack.h Song.h Conductor.h Rating.h Util.h
|
||||
Chord.h Tempo.h MidiDevice.h MidiDeviceRt.h)
|
||||
|
||||
# find JACK
|
||||
if(USE_JACK)
|
||||
# Check for Jack
|
||||
find_library(JACK_LIB jack)
|
||||
|
@ -163,12 +218,13 @@ if(USE_JACK)
|
|||
endif(JACK_FOUND)
|
||||
endif(USE_JACK)
|
||||
|
||||
# find RtMidi
|
||||
if(USE_BUNDLED_RTMIDI)
|
||||
message(STATUS "Building using bundled rtmidi")
|
||||
add_compile_options("-DUSE_BUNDLED_RTMIDI")
|
||||
include_directories("3rdparty")
|
||||
set(PB_BASE_SRCS ${PB_BASE_SRCS} 3rdparty/rtmidi/RtMidi.cpp)
|
||||
set(PB_BASE_HDR ${PB_BASE_HDR} 3rdparty/rtmidi/RtMidi.h)
|
||||
list(APPEND SRC_FILES 3rdparty/rtmidi/RtMidi.cpp)
|
||||
list(APPEND HEADER_FILES 3rdparty/rtmidi/RtMidi.h)
|
||||
else()
|
||||
pkg_check_modules(RTMIDI rtmidi)
|
||||
if(NOT RTMIDI_FOUND)
|
||||
|
@ -178,96 +234,7 @@ else()
|
|||
link_directories(${RTMIDI_LIBRARY_DIRS})
|
||||
endif()
|
||||
|
||||
# with SET() command you can change variables or define new ones
|
||||
# here we define PIANOBOOSTER_SRCS variable that contains a list of all .cpp files
|
||||
# note that we don't need \ at the end of line
|
||||
SET( PIANOBOOSTER_SRCS
|
||||
QtMain.cpp
|
||||
QtWindow.cpp
|
||||
GuiTopBar.cpp
|
||||
GuiSidePanel.cpp
|
||||
GuiMidiSetupDialog.cpp
|
||||
GuiKeyboardSetupDialog.cpp
|
||||
GuiPreferencesDialog.cpp
|
||||
GuiSongDetailsDialog.cpp
|
||||
GuiLoopingPopup.cpp
|
||||
GlView.cpp
|
||||
${PB_BASE_SRCS}
|
||||
StavePosition.cpp
|
||||
Score.cpp
|
||||
Cfg.cpp
|
||||
Piano.cpp
|
||||
Draw.cpp
|
||||
Scroll.cpp
|
||||
Notation.cpp
|
||||
TrackList.cpp
|
||||
Rating.cpp
|
||||
Bar.cpp
|
||||
Settings.cpp
|
||||
Merge.cpp
|
||||
pianobooster.rc
|
||||
images/pianobooster.ico
|
||||
)
|
||||
SET( PIANOBOOSTER_HDR
|
||||
QtWindow.h
|
||||
GuiTopBar.h
|
||||
GuiSidePanel.h
|
||||
GuiMidiSetupDialog.h
|
||||
GuiKeyboardSetupDialog.h
|
||||
GuiPreferencesDialog.h
|
||||
GuiSongDetailsDialog.h
|
||||
GuiLoopingPopup.h
|
||||
GlView.h
|
||||
${PB_BASE_HDR}
|
||||
StavePosition.h
|
||||
Score.h
|
||||
Cfg.h
|
||||
Piano.h
|
||||
Draw.h
|
||||
Scroll.h
|
||||
Notation.h
|
||||
TrackList.h
|
||||
Rating.h
|
||||
Bar.h
|
||||
Settings.h
|
||||
Merge.h
|
||||
)
|
||||
|
||||
# another list, this time it includes all header files that should be treated with moc
|
||||
SET( PIANOBOOSTER_MOC_HDRS
|
||||
QtWindow.h
|
||||
GlView.h
|
||||
GuiTopBar.h
|
||||
GuiSidePanel.h
|
||||
GuiMidiSetupDialog.h
|
||||
GuiKeyboardSetupDialog.h
|
||||
GuiPreferencesDialog.h
|
||||
GuiSongDetailsDialog.h
|
||||
GuiLoopingPopup.h
|
||||
)
|
||||
|
||||
# some .ui files
|
||||
SET( PIANOBOOSTER_UIS
|
||||
./GuiTopBar.ui
|
||||
./GuiSidePanel.ui
|
||||
./GuiMidiSetupDialog.ui
|
||||
./GuiKeyboardSetupDialog.ui
|
||||
./GuiPreferencesDialog.ui
|
||||
./GuiSongDetailsDialog.ui
|
||||
./GuiLoopingPopup.ui
|
||||
)
|
||||
|
||||
# and finally an resource file
|
||||
SET( PIANOBOOSTER_RCS
|
||||
./application.qrc
|
||||
)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# here we instruct CMake to build "pianobooster" executable from all of the source files
|
||||
# configure MacOS-specific bundling
|
||||
if(APPLE)
|
||||
# the property added the pianobooster icon to Info.plist
|
||||
set(MACOSX_BUNDLE_ICON_FILE pianobooster.icns)
|
||||
|
@ -284,137 +251,61 @@ if(APPLE)
|
|||
set(pianobooster_FONT ${CMAKE_CURRENT_SOURCE_DIR}/fonts/DejaVuSans.ttf)
|
||||
set_source_files_properties(${pianobooster_FONT} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/fonts")
|
||||
|
||||
ADD_EXECUTABLE( pianobooster MACOSX_BUNDLE
|
||||
${pianobooster_ICON} ${pianobooster_TRANSLATIONS}
|
||||
${pianobooster_MUSIC} ${pianobooster_FONT}
|
||||
${PIANOBOOSTER_HDR} ${PIANOBOOSTER_SRCS}
|
||||
${PIANOBOOSTER_MOC_SRCS} ${PIANOBOOSTER_RC_SRCS}
|
||||
${PIANOBOOSTER_UI_HDRS} ${PIANOBOOSTER_RCS} )
|
||||
|
||||
add_custom_target(install-translations cp -R -v ${CMAKE_CURRENT_BINARY_DIR}/translations/*.qm ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Resources/translations)
|
||||
|
||||
endif(APPLE)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
ADD_EXECUTABLE( pianobooster ${PIANOBOOSTER_HDR} ${PIANOBOOSTER_SRCS}
|
||||
${PIANOBOOSTER_MOC_SRCS} ${PIANOBOOSTER_RC_SRCS}
|
||||
${PIANOBOOSTER_UI_HDRS} ${PIANOBOOSTER_RCS} )
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
if(WIN32)
|
||||
ADD_EXECUTABLE( pianobooster ${PIANOBOOSTER_HDR} ${PIANOBOOSTER_SRCS}
|
||||
${PIANOBOOSTER_MOC_SRCS} ${PIANOBOOSTER_RC_SRCS}
|
||||
${PIANOBOOSTER_UI_HDRS} ${PIANOBOOSTER_RCS} )
|
||||
SET_TARGET_PROPERTIES(pianobooster PROPERTIES LINK_FLAGS "-mwindows")
|
||||
endif(WIN32)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.13.0")
|
||||
message("Please consider to switch to CMake 3.13.0")
|
||||
else()
|
||||
target_link_directories(pianobooster PUBLIC ${FTGL_LIBRARY_DIRS} ${JACK_LIBRARY_DIRS} ${FLUIDSYNTH_LIBRARY_DIRS})
|
||||
endif()
|
||||
target_link_libraries (pianobooster ${QT_LIBS} ${OPENGL_LIBRARIES} ${FTGL_LIBRARY} ${RTMIDI_LIBRARIES} ${JACK_LIBRARY} ${FLUIDSYNTH_LIBRARY} ${RTMIDI_LIBRARY})
|
||||
|
||||
# configure executable
|
||||
include(AppTarget)
|
||||
target_include_directories("${META_TARGET_NAME}" PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${OPENGL_INCLUDE_DIR} ${FTGL_INCLUDE_DIR})
|
||||
target_link_directories("${META_TARGET_NAME}" PRIVATE ${FTGL_LIBRARY_DIRS} ${JACK_LIBRARY_DIRS} ${FLUIDSYNTH_LIBRARY_DIRS})
|
||||
target_link_libraries("${META_TARGET_NAME}" PRIVATE ${OPENGL_LIBRARIES} ${FTGL_LIBRARY} ${RTMIDI_LIBRARIES} ${JACK_LIBRARY} ${FLUIDSYNTH_LIBRARY} ${RTMIDI_LIBRARY})
|
||||
|
||||
# install various additional files
|
||||
if(NOT APPLE)
|
||||
INSTALL( FILES ../pianobooster.desktop DESTINATION share/applications )
|
||||
INSTALL(TARGETS pianobooster RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES ../pianobooster.desktop DESTINATION share/applications)
|
||||
install(TARGETS "${META_TARGET_NAME}" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif(NOT APPLE)
|
||||
|
||||
if(NOT NO_DOCS)
|
||||
INSTALL( FILES ../README.md DESTINATION share/doc/pianobooster/ )
|
||||
INSTALL( FILES ../doc/faq.md DESTINATION share/doc/pianobooster/ )
|
||||
install(FILES ../README.md DESTINATION share/doc/pianobooster/)
|
||||
install(FILES ../doc/faq.md DESTINATION share/doc/pianobooster/)
|
||||
endif()
|
||||
|
||||
if(NOT NO_LICENSE)
|
||||
INSTALL( FILES ../license.txt DESTINATION share/licenses/pianobooster/ )
|
||||
install(FILES ../license.txt DESTINATION share/licenses/pianobooster/)
|
||||
endif()
|
||||
|
||||
if(NOT NO_CHANGELOG)
|
||||
INSTALL( FILES ../Changelog.txt DESTINATION share/doc/pianobooster/ )
|
||||
install(FILES ../Changelog.txt DESTINATION share/doc/pianobooster/)
|
||||
endif()
|
||||
|
||||
if(WITH_MAN)
|
||||
INSTALL( FILES ../pianobooster.6 DESTINATION share/man/man6/ )
|
||||
install(FILES ../pianobooster.6 DESTINATION share/man/man6/)
|
||||
endif()
|
||||
install(FILES ../icons/hicolor/32x32/pianobooster.png DESTINATION share/icons/hicolor/32x32/apps)
|
||||
install(FILES ../icons/hicolor/48x48/pianobooster.png DESTINATION share/icons/hicolor/48x48/apps)
|
||||
install(FILES ../icons/hicolor/64x64/pianobooster.png DESTINATION share/icons/hicolor/64x64/apps)
|
||||
|
||||
INSTALL ( FILES ../icons/hicolor/32x32/pianobooster.png DESTINATION share/icons/hicolor/32x32/apps )
|
||||
INSTALL ( FILES ../icons/hicolor/48x48/pianobooster.png DESTINATION share/icons/hicolor/48x48/apps )
|
||||
INSTALL ( FILES ../icons/hicolor/64x64/pianobooster.png DESTINATION share/icons/hicolor/64x64/apps )
|
||||
|
||||
# configure and install music books
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../music/BoosterMusicBooks.zip ${CMAKE_CURRENT_BINARY_DIR}/ COPYONLY)
|
||||
if(UNIX AND NOT APPLE)
|
||||
INSTALL ( FILES ../music/BoosterMusicBooks.zip DESTINATION ${DATA_DIR}/music )
|
||||
install(FILES ../music/BoosterMusicBooks.zip DESTINATION ${DATA_DIR}/music)
|
||||
endif(UNIX AND NOT APPLE)
|
||||
|
||||
if(WIN32)
|
||||
INSTALL( FILES ../music/BoosterMusicBooks.zip DESTINATION . )
|
||||
install(FILES ../music/BoosterMusicBooks.zip DESTINATION .)
|
||||
endif(WIN32)
|
||||
|
||||
# install fonts
|
||||
if(NOT USE_SYSTEM_FONT)
|
||||
configure_file(fonts/DejaVuSans.ttf ${CMAKE_CURRENT_BINARY_DIR}/fonts/DejaVuSans.ttf COPYONLY)
|
||||
INSTALL ( FILES fonts/DejaVuSans.ttf DESTINATION ${DATA_DIR}/fonts/)
|
||||
install(FILES fonts/DejaVuSans.ttf DESTINATION ${DATA_DIR}/fonts/)
|
||||
endif(NOT USE_SYSTEM_FONT)
|
||||
|
||||
# make translations
|
||||
if(NOT NO_LANGS)
|
||||
ADD_SUBDIRECTORY(../translations ../build/translations)
|
||||
add_subdirectory(../translations ../build/translations)
|
||||
endif(NOT NO_LANGS)
|
||||
|
||||
# configure debugging flags
|
||||
if(DEBUG_LOG_TRACE)
|
||||
ADD_DEFINITIONS(-DPB_LOG_TRACE)
|
||||
endif()
|
||||
|
||||
if(DEBUG_LOG_TIMING)
|
||||
ADD_DEFINITIONS(-DPB_LOG_TIMING)
|
||||
endif()
|
||||
|
||||
# allow enabling useful warnings (explicitly disabling not useful ones) and allow treating warnings them as errors
|
||||
# note: code copied from: https://github.com/Martchus/cpp-utilities/blob/d8c38699ba41b048c61662786c69eb02ff7eaca7/cmake/modules/BasicConfig.cmake
|
||||
option(ENABLE_WARNINGS "adds additional compiler flags to enable useful warnings" OFF)
|
||||
set(CLANG_WARNINGS
|
||||
-Wall
|
||||
-Wextra # reasonable and standard
|
||||
-Wshadow=local # warn the user if a variable declaration shadows one from a parent context
|
||||
-Wnon-virtual-dtor # warn the user if a class with virtual functions has a non-virtual destructor. This helps catch hard
|
||||
# to track down memory errors
|
||||
-Wold-style-cast # warn for c-style casts
|
||||
-Wcast-align # warn for potential performance problem casts
|
||||
-Wunused # warn on anything being unused
|
||||
-Woverloaded-virtual # warn if you overload (not override) a virtual function
|
||||
-Wconversion # warn on type conversions that may lose data
|
||||
-Wsign-conversion # warn on sign conversions
|
||||
-Wnull-dereference # warn if a null dereference is detected
|
||||
-Wdouble-promotion # warn if float is implicit promoted to double
|
||||
-Wformat=2 # warn on security issues around functions that format output (ie printf)
|
||||
-Wno-pedantic # warn NOT if non-standard C++ is used (some vendor extensions are very useful)
|
||||
-Wno-missing-field-initializers # warn NOT about missing field initializers
|
||||
-Wno-useless-cast # warn NOT about useless cases (this is sometimes very useful in templates)
|
||||
-Wno-unused-const-variable # warn NOT about unused constants (usually used in other compile unit)
|
||||
-Wno-unknown-warning-option # warn NOT about unknown warning options (depending on compiler/version not all are
|
||||
# available)
|
||||
)
|
||||
set(GCC_WARNINGS
|
||||
${CLANG_WARNINGS}
|
||||
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist
|
||||
-Wduplicated-cond # warn if if / else chain has duplicated conditions
|
||||
-Wduplicated-branches # warn if if / else branches have duplicated code
|
||||
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
|
||||
)
|
||||
if (ENABLE_WARNINGS)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
||||
target_compile_options(pianobooster PRIVATE ${CLANG_WARNINGS})
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(pianobooster PRIVATE ${GCC_WARNINGS})
|
||||
else ()
|
||||
message(AUTHOR_WARNING "Enabling warnings is not supported for compiler '${CMAKE_CXX_COMPILER_ID}'.")
|
||||
endif ()
|
||||
endif ()
|
||||
option(TREAT_WARNINGS_AS_ERRORS "adds additional compiler flag to treat warnings as errors" "${ENABLE_DEVEL_DEFAULTS}")
|
||||
if (TREAT_WARNINGS_AS_ERRORS)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(pianobooster PRIVATE -Werror)
|
||||
else ()
|
||||
message(AUTHOR_WARNING "Treating warnings as errors is not supported for compiler '${CMAKE_CXX_COMPILER_ID}'.")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../music/BoosterMusicBooks.zip ${CMAKE_CURRENT_BINARY_DIR}/ COPYONLY)
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ endif()
|
|||
get_filename_component(full_path_blank_ts ${CMAKE_CURRENT_SOURCE_DIR}/pianobooster_blank.ts ABSOLUTE)
|
||||
list(REMOVE_ITEM TRANSLATIONS_FILES ${full_path_blank_ts})
|
||||
|
||||
set(QT_PACKAGE_NAME Qt5 CACHE STRING "Name of the Qt package to use, set e.g. to \"Qt6\" to use Qt 6")
|
||||
FIND_PACKAGE("${QT_PACKAGE_NAME}" REQUIRED COMPONENTS LinguistTools)
|
||||
FIND_PACKAGE("${QT_PACKAGE_PREFIX}LinguistTools" REQUIRED COMPONENTS LinguistTools)
|
||||
|
||||
if(COMMAND QT_ADD_TRANSLATION)
|
||||
QT_ADD_TRANSLATION(QM_FILES ${TRANSLATIONS_FILES})
|
||||
|
|
Loading…
Reference in New Issue