210 lines
6.2 KiB
CMake
210 lines
6.2 KiB
CMake
# Cmake File for Piano Booster
|
|
# for the debug build type cmake -DCMAKE_BUILD_TYPE=Debug
|
|
SET(CMAKE_BUILD_TYPE Release)
|
|
SET(CMAKE_VERBOSE_MAKEFILE OFF)
|
|
SET(USE_FLUIDSYNTH OFF)
|
|
|
|
#SET(OpenGL_GL_PREFERENCE GLVND)
|
|
#
|
|
# The inplace directory is mainly for windows builds
|
|
# SET(FLUIDSYNTH_INPLACE_DIR C:/download/misc/ljb/fluidsynth-1.0.9)
|
|
SET(FLUIDSYNTH_INPLACE_DIR /home/louis/build/fluidsynth-1.0.9)
|
|
|
|
|
|
# Testing precompiled headers it does not work -- leave as OFF.
|
|
SET(USE_PCH OFF)
|
|
|
|
cmake_minimum_required(VERSION 2.4)
|
|
if(COMMAND cmake_policy)
|
|
cmake_policy(SET CMP0003 NEW)
|
|
endif(COMMAND cmake_policy)
|
|
|
|
IF(WIN32)
|
|
MESSAGE("GUI system is WIN32 ${CMAKE_GENERATOR}")
|
|
SET(CMAKE_COLOR_MAKEFILE OFF)
|
|
ENDIF(WIN32)
|
|
|
|
# set project's name
|
|
PROJECT( pianobooster )
|
|
|
|
# enable warnings
|
|
ADD_DEFINITIONS(-Wall)
|
|
|
|
FIND_PACKAGE( OpenGL REQUIRED )
|
|
|
|
# Finds Qt5 libraries
|
|
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets LinguistTools OpenGL Xml )
|
|
|
|
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
|
|
add_definitions(-fPIC)
|
|
|
|
IF (USE_PCH)
|
|
INCLUDE(precompile/PCHSupport_26.cmake)
|
|
INCLUDE_DIRECTORIES( precompile .)
|
|
ENDIF(USE_PCH)
|
|
|
|
# Add in the link libraries for each operating system
|
|
IF(${CMAKE_SYSTEM} MATCHES "Linux")
|
|
#FIND_PACKAGE(PkgConfig REQUIRED)
|
|
#PKG_CHECK_MODULES(ALSA REQUIRED alsa>=1.0)
|
|
#IF(ALSA_FOUND)
|
|
ADD_DEFINITIONS(-D__LINUX_ALSASEQ__)
|
|
LINK_LIBRARIES (asound)
|
|
LINK_LIBRARIES (pthread)
|
|
LINK_LIBRARIES (GL)
|
|
#ELSE(ALSA_FOUND)
|
|
# MESSAGE(FATAL_ERROR "Please install the 'libasound2-dev' package and then try again")
|
|
#ENDIF(ALSA_FOUND)
|
|
|
|
ENDIF(${CMAKE_SYSTEM} MATCHES "Linux")
|
|
|
|
IF(${CMAKE_SYSTEM} MATCHES "Windows")
|
|
# FIND_PACKAGE(WINDRES REQUIRED)
|
|
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__)
|
|
LINK_LIBRARIES("-framework CoreMidi -framework CoreAudio -framework CoreFoundation -framework OpenGL")
|
|
ENDIF(${CMAKE_SYSTEM} MATCHES "Darwin")
|
|
|
|
IF(USE_FLUIDSYNTH)
|
|
ADD_DEFINITIONS(-DPB_USE_FLUIDSYNTH)
|
|
MESSAGE("Building using fluidsynth")
|
|
SET( PB_BASE_SRCS MidiDeviceFluidSynth.cpp )
|
|
|
|
IF(FLUIDSYNTH_INPLACE_DIR)
|
|
INCLUDE_DIRECTORIES(${FLUIDSYNTH_INPLACE_DIR}/include/)
|
|
IF(WIN32)
|
|
LINK_LIBRARIES( ${FLUIDSYNTH_INPLACE_DIR}/src/.libs/libfluidsynth.dll.a)
|
|
ENDIF(WIN32)
|
|
IF(UNIX)
|
|
LINK_LIBRARIES(${FLUIDSYNTH_INPLACE_DIR}/src/.libs/libfluidsynth.so)
|
|
ENDIF(UNIX)
|
|
ELSEIF(FLUIDSYNTH_INPLACE_DIR)
|
|
LINK_LIBRARIES( fluidsynth)
|
|
ENDIF(FLUIDSYNTH_INPLACE_DIR)
|
|
ENDIF(USE_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} )
|
|
|
|
SET(PB_BASE_SRCS MidiFile.cpp MidiTrack.cpp Song.cpp Conductor.cpp Util.cpp
|
|
Chord.cpp Tempo.cpp MidiDevice.cpp MidiDeviceRt.cpp rtmidi/RtMidi.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 rtmidi/RtMidi.h)
|
|
|
|
# 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
|
|
#Band.cpp
|
|
pianobooster.rc
|
|
pianobooster.ico
|
|
# precompile.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
|
|
IF(APPLE)
|
|
ADD_EXECUTABLE( pianobooster MACOSX_BUNDLE ${PIANOBOOSTER_SRCS}
|
|
${PIANOBOOSTER_MOC_SRCS} ${PIANOBOOSTER_RC_SRCS}
|
|
${PIANOBOOSTER_UI_HDRS})
|
|
ENDIF(APPLE)
|
|
|
|
IF(UNIX)
|
|
ADD_EXECUTABLE( pianobooster pianobooster.rc ${PIANOBOOSTER_SRCS}
|
|
${PIANOBOOSTER_MOC_SRCS} ${PIANOBOOSTER_RC_SRCS}
|
|
${PIANOBOOSTER_UI_HDRS} )
|
|
ENDIF(UNIX)
|
|
|
|
IF(WIN32)
|
|
ADD_EXECUTABLE( pianobooster WIN32 pianobooster.rc ${PIANOBOOSTER_SRCS}
|
|
${PIANOBOOSTER_MOC_SRCS} ${PIANOBOOSTER_RC_SRCS}
|
|
${PIANOBOOSTER_UI_HDRS} )
|
|
SET_TARGET_PROPERTIES(pianobooster PROPERTIES LINK_FLAGS "-mwindows")
|
|
ENDIF(WIN32)
|
|
|
|
qt5_use_modules(pianobooster Core Gui Widgets LinguistTools OpenGL Xml)
|
|
|
|
IF (USE_PCH)
|
|
ADD_PRECOMPILED_HEADER( pianobooster ${CMAKE_CURRENT_SOURCE_DIR}/precompile/precompile.h )
|
|
ENDIF (USE_PCH)
|
|
|
|
target_link_libraries (pianobooster Qt5::Widgets Qt5::Xml Qt5::OpenGL)
|
|
|
|
INSTALL( FILES pianobooster.desktop DESTINATION share/applications )
|
|
INSTALL(TARGETS pianobooster RUNTIME DESTINATION bin)
|
|
#INSTALL( index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kmidimon )
|
|
|
|
INSTALL( FILES ../README.md DESTINATION share/games/pianobooster/doc/ )
|
|
|
|
INSTALL ( FILES images/pianobooster.png DESTINATION share/pixmaps )
|
|
|
|
#INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/translations/*.qm DESTINATION share/pianobooster/translations/ )
|
|
|
|
|
|
|