cmake_minimum_required(VERSION 2.8.11) project(QMidiAmb) SET(CMAKE_OSX_ARCHITECTURES x86_64) # SET(WIN32 CMAKE_LIBRARY_PATH "C:\\Program Files (x86)\\Windows Kits\\8.0\\Lib\\win8\\um\\x64") # Find includes in corresponding build directories SET(CMAKE_INCLUDE_CURRENT_DIR ON) # Instruct CMake to run moc automatically when needed. SET(CMAKE_AUTOMOC ON) set(PROJECT_VERSION_MAJOR "0") set(PROJECT_VERSION_MINOR "1") set(PROJECT_VERSION_PATCH "0") set(PROJECT_VERSION_COUNT 3) set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") set(PROJECT_VENDOR "Bruno Martin") set(PROJECT_COPYRIGHT_YEAR "2015") set(PROJECT_DOMAIN_FIRST "brunocsmartin") set(PROJECT_DOMAIN_SECOND "fr") set(PROJECT_DOMAIN "${PROJECT_DOMAIN_FIRST}.${PROJECT_DOMAIN_SECOND}") list(APPEND CMAKE_PREFIX_PATH "/Users/brunomartin/Qt/5.5/clang_64/lib/cmake/") MESSAGE(STATUS "CMAKE_PREFIX_PATH : ${CMAKE_PREFIX_PATH}") SET(QT_BINARY_DIR "/Users/brunomartin/Qt/5.5/clang_64/bin") # Find the QtWidgets library FIND_PACKAGE(Qt5Core REQUIRED) FIND_PACKAGE(Qt5Widgets REQUIRED) FIND_PACKAGE(Qt5Multimedia REQUIRED) FIND_PACKAGE(Qt5Xml REQUIRED) FIND_PACKAGE(Qt5Bluetooth REQUIRED) INCLUDE(ExternalProject) ADD_SUBDIRECTORY(btserialport) ExternalProject_Add(project_rtmidi URL ${CMAKE_CURRENT_SOURCE_DIR}/rtmidi-2.1.0.tar.gz PREFIX lib/rtmidi CONFIGURE_COMMAND /configure BUILD_IN_SOURCE 1 BUILD_COMMAND make INSTALL_COMMAND echo Skipping install step for rtmidi ) ExternalProject_Get_Property(project_rtmidi BINARY_DIR) ExternalProject_Get_Property(project_rtmidi SOURCE_DIR) SET(rtmidi_lib_dir "${BINARY_DIR}/") SET(rtmidi_inc_dir "${SOURCE_DIR}/") MESSAGE(rtmidi_lib_dir : ${rtmidi_lib_dir}) ADD_LIBRARY(rtmidi STATIC IMPORTED) SET_PROPERTY(TARGET rtmidi PROPERTY IMPORTED_LOCATION "${rtmidi_lib_dir}/librtmidi.a") ADD_DEPENDENCIES(rtmidi project_rtmidi) IF(APPLE) FIND_LIBRARY(CORE_AUDIO_LIBRARY CoreAudio) FIND_LIBRARY(AUDIO_TOOLBOX_LIBRARY AudioToolbox) FIND_LIBRARY(AUDIO_UNIT_LIBRARY AudioUnit) FIND_LIBRARY(CARBON_LIBRARY Carbon) FIND_LIBRARY(MIDI_LIBRARY CoreMidi) SET(EXTRA_LIBS ${CORE_AUDIO_LIBRARY} ${AUDIO_TOOLBOX_LIBRARY} ${AUDIO_UNIT_LIBRARY} ${CARBON_LIBRARY} ${MIDI_LIBRARY} ${OSX_BLUETOOTH_LIB}) ENDIF (APPLE) INCLUDE_DIRECTORIES( ${rtmidi_inc_dir} ${CMAKE_CURRENT_SOURCE_DIR}/btserialport/src ) MESSAGE(${CMAKE_CURRENT_SOURCE_DIR}/btserialport/src) SET( SOURCES q_midi_amb_controller.h q_midi_amb_controller.cpp q_midi_amb_player.h q_midi_amb_player.cpp q_midi_amb_main_window.h q_midi_amb_main_window.cpp q_midi_amb_sound_widget.h q_midi_amb_sound_widget.cpp ) add_executable( QMidiAmb WIN32 MACOSX_BUNDLE main.cpp ${SOURCES} ) # Use the Widgets module from Qt 5. target_link_libraries( QMidiAmb Qt5::Core Qt5::Widgets Qt5::Multimedia Qt5::Xml Qt5::Bluetooth rtmidi bluetoothserialport ${EXTRA_LIBS} ) ADD_DEFINITIONS("-DSOUND_DIR=\"${CMAKE_SOURCE_DIR}/sounds\"") SET(ICONS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/icons) if(APPLE) set(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") set(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_NAME} ${PROJECT_VERSION}") set(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}") set(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT_YEAR} ${PROJECT_VENDOR}") set(MACOSX_BUNDLE_ICON_FILE "q_scrum.icns") set(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_DOMAIN_SECOND}.${PROJECT_DOMAIN_FIRST}") set(MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}") # set(MACOSX_BUNDLE_RESOURCES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Resources") # set(MACOSX_BUNDLE_ICON "${ICONS_DIR}/${MACOSX_BUNDLE_ICON_FILE}") # execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${MACOSX_BUNDLE_RESOURCES}) # execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MACOSX_BUNDLE_ICON} ${MACOSX_BUNDLE_RESOURCES}) add_custom_target( addframeworks ALL COMMAND ${QT_BINARY_DIR}/macdeployqt ${CMAKE_BINARY_DIR}/$/${PROJECT_NAME}.app DEPENDS ${PROJECT_NAME} ) add_custom_target( TARGET package PRE_BUILD COMMAND ${QT_BINARY_DIR}/macdeployqt ${CMAKE_BINARY_DIR}/$/${PROJECT_NAME}.app DEPENDS ${PROJECT_NAME} ) set(BIN_INSTALL_DIR ".") install(TARGETS ${PROJECT_NAME} DESTINATION ${BIN_INSTALL_DIR}) set(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}") set(CMAKE_INSTALL_PREFIX "/Applications") set(CPACK_GENERATOR "DragNDrop") set(CPACK_DMG_FORMAT "UDBZ") set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}") set(CPACK_SYSTEM_NAME "OSX") set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}") include(CPack) endif()