Merge pull request #20 from lioncash/cmake

Editor/CMakeLists: Enable AUTOMOC, AUTORCC, and AUTOUI
This commit is contained in:
Phillip Stephens 2019-08-25 18:24:33 -07:00 committed by GitHub
commit ea84a7e35b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 67 additions and 54 deletions

View File

@ -1,71 +1,84 @@
cmake_minimum_required(VERSION 3.10)
# Automatically handle invoking autorcc, moc, and uic.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 COMPONENTS LinguistTools Network Qml Svg Widgets Xml REQUIRED)
configure_file(resources/translation_res.qrc translation_res.qrc @ONLY)
set(TRANSLATIONS
resources/lang_de.ts
)
QT5_CREATE_TRANSLATION(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../lib ${TRANSLATIONS})
add_executable(amuse-gui WIN32 MACOSX_BUNDLE
ADSREditor.cpp
ADSREditor.hpp
Common.cpp
Common.hpp
CurveEditor.cpp
CurveEditor.hpp
EditorWidget.cpp
EditorWidget.hpp
KeyboardWidget.cpp
KeyboardWidget.hpp
KeymapEditor.cpp
KeymapEditor.hpp
LayersEditor.cpp
LayersEditor.hpp
MainWindow.cpp
MainWindow.hpp
MainWindow.ui
MIDIReader.cpp
MIDIReader.hpp
NewSoundMacroDialog.cpp
NewSoundMacroDialog.hpp
ProjectModel.cpp
ProjectModel.hpp
SampleEditor.cpp
SampleEditor.hpp
SongGroupEditor.cpp
SongGroupEditor.hpp
SoundGroupEditor.cpp
SoundGroupEditor.hpp
SoundMacroEditor.cpp
SoundMacroEditor.hpp
StatusBarWidget.cpp
StatusBarWidget.hpp
StudioSetupWidget.cpp
StudioSetupWidget.hpp
main.cpp
resources/resources.qrc
${CMAKE_CURRENT_BINARY_DIR}/translation_res.qrc
${QM_FILES}
)
if(WIN32)
list(APPEND PLAT_SRCS platforms/win/amuse-gui.rc platforms/win/amuse-gui.manifest)
target_sources(amuse-gui PRIVATE
platforms/win/amuse-gui.rc
platforms/win/amuse-gui.manifest
)
elseif(APPLE)
list(APPEND PLAT_SRCS platforms/mac/mainicon.icns MacOSExtras.mm)
target_sources(amuse-gui PRIVATE
MacOSExtras.mm
platforms/mac/mainicon.icns
)
set_source_files_properties(platforms/mac/mainicon.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
MACOSX_PACKAGE_LOCATION Resources
)
endif()
add_subdirectory(platforms/freedesktop)
declare_qticon_target()
list(APPEND PLAT_SRCS mainicon_qt.cpp)
target_sources(amuse-gui PRIVATE mainicon_qt.cpp)
configure_file(resources/translation_res.qrc translation_res.qrc @ONLY)
set(TRANSLATIONS
resources/lang_de.ts)
QT5_CREATE_TRANSLATION(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../lib ${TRANSLATIONS})
QT5_ADD_RESOURCES(qrc_resources.cpp resources/resources.qrc)
QT5_ADD_RESOURCES(qrc_translation_res.cpp ${CMAKE_CURRENT_BINARY_DIR}/translation_res.qrc OPTIONS -no-compress)
QT5_WRAP_UI(MAIN_WINDOW_UI MainWindow.ui)
QT5_WRAP_CPP(AMUSE_MOC
Common.hpp
MainWindow.hpp
KeyboardWidget.hpp
StatusBarWidget.hpp
ProjectModel.hpp
EditorWidget.hpp
SoundMacroEditor.hpp
ADSREditor.hpp
CurveEditor.hpp
KeymapEditor.hpp
LayersEditor.hpp
SampleEditor.hpp
SoundGroupEditor.hpp
SongGroupEditor.hpp
NewSoundMacroDialog.hpp
StudioSetupWidget.hpp)
add_executable(amuse-gui WIN32 MACOSX_BUNDLE
Common.hpp Common.cpp
MainWindow.ui ${MAIN_WINDOW_UI} MainWindow.hpp MainWindow.cpp
KeyboardWidget.hpp KeyboardWidget.cpp
StatusBarWidget.hpp StatusBarWidget.cpp
ProjectModel.hpp ProjectModel.cpp
EditorWidget.hpp EditorWidget.cpp
SoundMacroEditor.hpp SoundMacroEditor.cpp
ADSREditor.hpp ADSREditor.cpp
CurveEditor.hpp CurveEditor.cpp
KeymapEditor.hpp KeymapEditor.cpp
LayersEditor.hpp LayersEditor.cpp
SampleEditor.hpp SampleEditor.cpp
SoundGroupEditor.hpp SoundGroupEditor.cpp
SongGroupEditor.hpp SongGroupEditor.cpp
NewSoundMacroDialog.hpp NewSoundMacroDialog.cpp
StudioSetupWidget.hpp StudioSetupWidget.cpp
MIDIReader.hpp MIDIReader.cpp
resources/resources.qrc qrc_resources.cpp
${QM_FILES} qrc_translation_res.cpp
${AMUSE_MOC} ${PLAT_SRCS}
main.cpp)
if(COMMAND add_sanitizers)
add_sanitizers(amuse-gui)
endif()