220 lines
5.9 KiB
CMake
220 lines
5.9 KiB
CMake
# This file is copyrighted under the GPL2+ license
|
|
# copyright 2013, Jean-Philippe Meuret <jpmeuret@free.fr>
|
|
|
|
# qatsh executable
|
|
|
|
message(STATUS "Configuring qatsh ...")
|
|
|
|
# External dependencies.
|
|
# 1) Qt (4 or 5)
|
|
if(NOT DEFINED OPTION_QT5 OR NOT OPTION_QT5)
|
|
SET(OPTION_QT5 ON CACHE BOOL "Check to build with Qt 5 (rather than Qt 4)" FORCE)
|
|
endif()
|
|
if(NOT OPTION_QT5)
|
|
find_package(Qt4 4.4 COMPONENTS QtCore QtGui REQUIRED)
|
|
endif()
|
|
if(NOT QT4_FOUND)
|
|
MESSAGE(STATUS "Qt 4 not found : Trying Qt 5")
|
|
SET(OPTION_QT5 On)
|
|
endif()
|
|
if(OPTION_QT5)
|
|
cmake_minimum_required(VERSION 3.13.5)
|
|
endif()
|
|
|
|
if(OPTION_QT5)
|
|
#set(CMAKE_AUTOMOC ON)
|
|
find_package(Qt5Core REQUIRED)
|
|
find_package(Qt5Widgets REQUIRED)
|
|
set(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES})
|
|
set(QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
|
else()
|
|
include(${QT_USE_FILE})
|
|
set(QT_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) # Odd it is needed (CMake 2.8.8) !
|
|
endif()
|
|
|
|
# 2) LibSndFile
|
|
find_package(LibSndFile REQUIRED)
|
|
|
|
# Sources
|
|
set(_SRCS Main.cpp
|
|
MainWindow.cpp
|
|
DocumentWindow.cpp
|
|
|
|
ATSModelManager.cpp
|
|
ATSModel.cpp
|
|
ATSModelItems.cpp
|
|
ATSDataProxyModel.cpp
|
|
ATSFrameProxyModel.cpp
|
|
ATSPartialsFrameProxyModel.cpp
|
|
ATSPartialsProxyModel.cpp
|
|
ATSPropertiesProxyModel.cpp
|
|
ATSResidualsFrameProxyModel.cpp
|
|
ATSResidualsProxyModel.cpp
|
|
|
|
FrameAndDataProcessor.cpp
|
|
ATSSound.cpp
|
|
ATSSynthesis.cpp
|
|
IATSAnalysis.cpp
|
|
|
|
ColorMap.cpp
|
|
ColorScale.cpp
|
|
Ruler.cpp
|
|
RulerSpec.cpp
|
|
SampledSound.cpp
|
|
StandardAnalysis.cpp
|
|
|
|
AnalysisParamsDialog.cpp
|
|
FilePropertiesDialog.cpp
|
|
PreferencesDialog.cpp
|
|
|
|
DataSelectionWidget.cpp
|
|
AnalysisParamsWidget.cpp
|
|
SynthesisParamsWidget.cpp
|
|
TableAndToolsWidget.cpp
|
|
FrameAndDataEditionWidget.cpp
|
|
FrameSelectionWidget.cpp
|
|
PartialsSpecgramWidget.cpp
|
|
ResidualsSpecgramWidget.cpp
|
|
|
|
FilePropertiesView.cpp
|
|
PartialsFrameTableView.cpp
|
|
ResidualsFrameTableView.cpp
|
|
PartialsSpecgramGraphicsFrameItem.cpp
|
|
PartialsSpecgramGraphicsScene.cpp
|
|
ResidualsSpecgramGraphicsScene.cpp
|
|
PartialsSpecgramGraphicsView.cpp
|
|
ResidualsSpecgramGraphicsView.cpp)
|
|
|
|
set(_HDRS TypesAndConstants.h
|
|
ColorMap.h
|
|
RulerSpec.h
|
|
SampledSound.h
|
|
|
|
ATSMath.h
|
|
ATSSound.h
|
|
|
|
ATSModelManager.h
|
|
ATSModelItems.h
|
|
PartialsSpecgramGraphicsFrameItem.h
|
|
|
|
FrameAndDataProcessor.h
|
|
|
|
IATSAnalysis.h
|
|
StandardAnalysis.h
|
|
ATSSynthesis.h)
|
|
|
|
set(_MOC_HDRS MainWindow.h
|
|
DocumentWindow.h
|
|
|
|
ATSModel.h
|
|
ATSDataProxyModel.h
|
|
ATSFrameProxyModel.h
|
|
ATSPartialsFrameProxyModel.h
|
|
ATSPartialsProxyModel.h
|
|
ATSPropertiesProxyModel.h
|
|
ATSResidualsFrameProxyModel.h
|
|
ATSResidualsProxyModel.h
|
|
|
|
ColorScale.h
|
|
Ruler.h
|
|
|
|
PreferencesDialog.h
|
|
AnalysisParamsDialog.h
|
|
FilePropertiesDialog.h
|
|
|
|
AnalysisParamsWidget.h
|
|
DataSelectionWidget.h
|
|
FrameAndDataEditionWidget.h
|
|
FrameSelectionWidget.h
|
|
SynthesisParamsWidget.h
|
|
TableAndToolsWidget.h
|
|
PartialsSpecgramWidget.h
|
|
ResidualsSpecgramWidget.h
|
|
|
|
FilePropertiesView.h
|
|
PartialsFrameTableView.h
|
|
ResidualsFrameTableView.h
|
|
PartialsSpecgramGraphicsScene.h
|
|
ResidualsSpecgramGraphicsScene.h
|
|
PartialsSpecgramGraphicsView.h
|
|
ResidualsSpecgramGraphicsView.h)
|
|
|
|
set(_UIS MainWindow.ui
|
|
DocumentWindow.ui
|
|
|
|
PreferencesDialog.ui
|
|
FilePropertiesDialog.ui
|
|
AnalysisParamsDialog.ui
|
|
AnalysisParamsWidget.ui
|
|
DataSelectionWidget.ui
|
|
FrameAndDataEditionWidget.ui
|
|
FrameSelectionWidget.ui
|
|
|
|
FilePropertiesView.ui
|
|
PartialsFrameTableView.ui
|
|
ResidualsFrameTableView.ui
|
|
|
|
PartialsSpecgramWidget.ui
|
|
ResidualsSpecgramWidget.ui
|
|
SynthesisParamsWidget.ui
|
|
TableAndToolsWidget.ui)
|
|
|
|
set(_RSCS qatsh.qrc)
|
|
|
|
# Run moc on header files using Q_OBJECT
|
|
if(OPTION_QT5)
|
|
qt5_wrap_cpp(_MOC_SRCS ${_MOC_HDRS})
|
|
else()
|
|
qt4_wrap_cpp(_MOC_SRCS ${_MOC_HDRS})
|
|
endif()
|
|
|
|
# Run uic on .ui files.
|
|
if(OPTION_QT5)
|
|
qt5_wrap_ui(_UI_HDRS ${_UIS})
|
|
else()
|
|
qt4_wrap_ui(_UI_HDRS ${_UIS})
|
|
endif()
|
|
|
|
# Generate code for resources.
|
|
if(OPTION_QT5)
|
|
qt5_add_resources(_RCC_SRCS ${_RSCS})
|
|
else()
|
|
qt4_add_resources(_RCC_SRCS ${_RSCS})
|
|
endif()
|
|
|
|
# Embbed icon in executable.
|
|
if(MINGW)
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icon.o
|
|
COMMAND windres.exe -i ${CMAKE_CURRENT_SOURCE_DIR}/icons/icon.rc -o ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
|
|
set(_RCC_SRCS ${_RCC_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
|
|
elseif (MSVC)
|
|
set(_RCC_SRC ${_RCC_SRCS} icons/icon.rc)
|
|
endif(MINGW)
|
|
|
|
# Include dirs.
|
|
include_directories(${CMAKE_SOURCE_DIR}/mathexpr ${CMAKE_SOURCE_DIR}/atsa
|
|
${QT_INCLUDES} ${LIBSNDFILE_INCLUDE_DIR}
|
|
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
# The executable
|
|
add_executable(qatsh ${_SRCS} ${_MOC_SRCS} ${_MOC_HDRS} ${_HDRS} ${_UI_HDRS} ${_RCC_SRCS})
|
|
|
|
# Link libs.
|
|
#if(OPTION_QT5)
|
|
# qt5_use_modules(qatsh Widgets)
|
|
#endif()
|
|
target_link_libraries(qatsh atsa mathexpr ${QT_LIBRARIES} ${LIBSNDFILE_LIBRARY})
|
|
|
|
# Installation.
|
|
install(TARGETS qatsh RUNTIME DESTINATION bin)
|
|
if(UNIX)
|
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/qatsh-b48.png DESTINATION share/icons)
|
|
endif(UNIX)
|
|
|
|
# 3rd party and compiler run-times installation.
|
|
if(WIN32)
|
|
include(thirdparty)
|
|
INSTALL_3RDPARTY_RUNTIME()
|
|
endif(WIN32)
|
|
|