Skip to content

Commit

Permalink
Fix linking Unit Tests on macOS
Browse files Browse the repository at this point in the history
TODO: Rework Sparkle support
  • Loading branch information
cbjeukendrup committed Aug 4, 2021
1 parent 4faee3f commit b7430fe
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 134 deletions.
25 changes: 0 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,26 +154,6 @@ if (OS_IS_WIN)
include_directories(${PROJECT_SOURCE_DIR}/dependencies/include)
endif(OS_IS_WIN)

if (OS_IS_MAC)
find_library(AudioToolboxFW NAMES AudioToolbox)
find_library(AudioUnitFW NAMES AudioUnit)
find_library(CoreAudioFW NAMES CoreAudio)
find_library(CoreMidiFW NAMES CoreMIDI)
find_library(SystemConfigurationFW NAMES SystemConfiguration)
find_library(CoreServicesFW NAMES CoreServices)
find_library(AppKit NAMES AppKit)

set(OsxFrameworks
${AudioToolboxFW}
${AudioUnitFW}
${CoreAudioFW}
${CoreMidiFW}
${SystemConfigurationFW}
${CoreServicesFW}
${AppKit}
)
endif(OS_IS_MAC)

include(SetupFreetype)

include(FindSndFile)
Expand All @@ -187,11 +167,6 @@ if (BUILD_JACK)
endif(BUILD_JACK)

if (BUILD_AUTOUPDATE)

if (OS_IS_MAC)
set(MAC_APPCAST_URL "")
endif (OS_IS_MAC)

include(SetupSparkle)
endif(BUILD_AUTOUPDATE)

Expand Down
2 changes: 1 addition & 1 deletion build/MacOSXBundleInfo.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
<key>ATSApplicationFontsPath</key>
<string>fonts/</string>
<key>SUFeedURL</key>
<string>${MAC_APPCAST_URL}</string>
<string>${SPARKLE_APPCAST_URL}</string>
<key>SUAllowsAutomaticUpdates</key>
<false/>
<key>CFBundleLocalizations</key>
Expand Down
22 changes: 0 additions & 22 deletions build/cmake/SetupDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,3 @@ if (OS_IS_WIN)
include_directories(${PROJECT_SOURCE_DIR}/dependencies/include)

endif(OS_IS_WIN)

if (OS_IS_MAC)

find_library(AudioToolboxFW NAMES AudioToolbox)
find_library(AudioUnitFW NAMES AudioUnit)
find_library(CoreAudioFW NAMES CoreAudio)
find_library(CoreMidiFW NAMES CoreMIDI)
find_library(SystemConfigurationFW NAMES SystemConfiguration)
find_library(CoreServicesFW NAMES CoreServices)
find_library(AppKit NAMES AppKit)

set(OsxFrameworks
${AudioToolboxFW}
${AudioUnitFW}
${CoreAudioFW}
${CoreMidiFW}
${SystemConfigurationFW}
${CoreServicesFW}
${AppKit}
)

endif(OS_IS_MAC)
51 changes: 24 additions & 27 deletions build/cmake/SetupSparkle.cmake
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
include(GetPlatformInfo)
if (OS_IS_MAC)
find_package(Sparkle) # needed for SPARKLE_FOUND and SPARKLE_LIBRARY variables
if (SPARKLE_FOUND)
set(SPARKLE_ENABLED 1)
set(SPARKLE_APPCAST_URL "https://sparkle.musescore.org/${MSCORE_RELEASE_CHANNEL}/3/macos/appcast.xml")
endif()
elseif (OS_IS_WIN)
if (BUILD_64)
set(ARCH_TYPE "_x64")
else ()
set(ARCH_TYPE "_x86")
endif ()


if (BUILD_64)
set(ARCH_TYPE "_x64")
else (BUILD_64)
set(ARCH_TYPE "_x86")
endif (BUILD_64)

if (APPLE)
find_package(Sparkle) #needed for SPARKLE_FOUND variable
if(SPARKLE_FOUND)
set(MAC_SPARKLE_ENABLED 1)
set(OsxFrameworks ${OsxFrameworks} ${SPARKLE_LIBRARY})
message("Current OSX version is ${CURRENT_OSX_VERSION}")
set(MAC_APPCAST_URL "https://sparkle.musescore.org/${MSCORE_RELEASE_CHANNEL}/3/macos/appcast.xml")
endif(SPARKLE_FOUND)
elseif (MSVC)
if ((NOT MSCORE_UNSTABLE) AND (NOT DEFINED WIN_PORTABLE)) # do not include WinSparkle in unstable and portable builds
include(FindWinSparkle)
add_library(winsparkledll SHARED IMPORTED)
set_target_properties(winsparkledll PROPERTIES IMPORTED_IMPLIB ${WINSPARKLE_LIBRARY})
set(WIN_SPARKLE_ENABLED 1)
set(WIN_SPARKLE_APPCAST_URL "https://sparkle.musescore.org/${MSCORE_RELEASE_CHANNEL}/4/win/appcast${ARCH_TYPE}.xml")
message("Win Sparkle Url: " ${WIN_SPARKLE_APPCAST_URL})
endif ((NOT MSCORE_UNSTABLE) AND (NOT DEFINED WIN_PORTABLE))
else (APPLE)
message("Sparkle is not supported on your system.")
endif (APPLE)
if ((NOT MSCORE_UNSTABLE) AND (NOT DEFINED WIN_PORTABLE)) # do not include WinSparkle in unstable and portable builds
include(FindWinSparkle)
add_library(winsparkledll SHARED IMPORTED)
set_target_properties(winsparkledll PROPERTIES IMPORTED_IMPLIB ${WINSPARKLE_LIBRARY})
set(SPARKLE_ENABLED 1)
set(SPARKLE_APPCAST_URL "https://sparkle.musescore.org/${MSCORE_RELEASE_CHANNEL}/4/win/appcast${ARCH_TYPE}.xml")
message("Win Sparkle Url: " ${WIN_SPARKLE_APPCAST_URL})
endif()
else ()
message("Sparkle is not supported on your system.")
endif ()
21 changes: 10 additions & 11 deletions build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
#cmakedefine SCRIPT_INTERFACE
#cmakedefine HAS_AUDIOFILE

#define CRASH_REPORT_URL "${CRASH_REPORT_URL}"
#define MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION}"
#define MUSESCORE_REVISION "${MUSESCORE_REVISION}"
#define INSTALL_NAME "${Mscore_INSTALL_NAME}"
#define INSTPREFIX "${CMAKE_INSTALL_PREFIX}"
#define VERSION "${MUSESCORE_VERSION_FULL}"
#define VERSION_LABEL "${MUSESCORE_VERSION_LABEL}"
#define BUILD_NUMBER "${CMAKE_BUILD_NUMBER}"
#define WIN_SPARKLE_APPCAST_URL "${WIN_SPARKLE_APPCAST_URL}"
#define CRASH_REPORT_URL "${CRASH_REPORT_URL}"
#define MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION}"
#define MUSESCORE_REVISION "${MUSESCORE_REVISION}"
#define INSTALL_NAME "${Mscore_INSTALL_NAME}"
#define INSTPREFIX "${CMAKE_INSTALL_PREFIX}"
#define VERSION "${MUSESCORE_VERSION_FULL}"
#define VERSION_LABEL "${MUSESCORE_VERSION_LABEL}"
#define BUILD_NUMBER "${CMAKE_BUILD_NUMBER}"
#define SPARKLE_APPCAST_URL "${SPARKLE_APPCAST_URL}"

#cmakedefine BUILD_TELEMETRY_MODULE
#define TELEMETRY_TRACK_ID "${TELEMETRY_TRACK_ID}"
Expand Down Expand Up @@ -66,8 +66,7 @@
#cmakedefine ENGRAVING_COMPAT_WRITESTYLE_302
#cmakedefine ENGRAVING_COMPAT_WRITEEXCERPTS_302

#cmakedefine WIN_SPARKLE_ENABLED
#cmakedefine MAC_SPARKLE_ENABLED
#cmakedefine SPARKLE_ENABLED
#cmakedefine OPENGL
#cmakedefine SOUNDFONT3
#cmakedefine WIN_PORTABLE
Expand Down
1 change: 0 additions & 1 deletion mtest/cmake.inc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ if (NOT MINGW AND NOT APPLE AND NOT MSVC)
endif (NOT MINGW AND NOT APPLE AND NOT MSVC)

if (APPLE)
target_link_libraries(${TARGET} ${OsxFrameworks})
target_link_libraries(${TARGET}
dl
pthread
Expand Down
21 changes: 10 additions & 11 deletions sandbox/engraving/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
#define SCRIPT_INTERFACE
/* #undef HAS_AUDIOFILE */

#define CRASH_REPORT_URL ""
#define MUSESCORE_NAME_VERSION "MuseScore 4 (4.0.0 unstable)"
#define MUSESCORE_REVISION ""
#define INSTALL_NAME "mscore-4.0/"
#define INSTPREFIX "/home/igor/Dev/MuseScore/build.debug/install"
#define VERSION "4.0.0"
#define VERSION_LABEL "Development"
#define BUILD_NUMBER ""
#define WIN_SPARKLE_APPCAST_URL ""
#define CRASH_REPORT_URL ""
#define MUSESCORE_NAME_VERSION "MuseScore 4 (4.0.0 unstable)"
#define MUSESCORE_REVISION ""
#define INSTALL_NAME "mscore-4.0/"
#define INSTPREFIX "/home/igor/Dev/MuseScore/build.debug/install"
#define VERSION "4.0.0"
#define VERSION_LABEL "Development"
#define BUILD_NUMBER ""
#define SPARKLE_APPCAST_URL ""

#define BUILD_TELEMETRY_MODULE
#define TELEMETRY_TRACK_ID ""
Expand All @@ -62,8 +62,7 @@

/* #undef USE_SCORE_ACCESSIBLE_TREE */

/* #undef WIN_SPARKLE_ENABLED */
/* #undef MAC_SPARKLE_ENABLED */
/* #undef SPARKLE_ENABLED */
/* #undef OPENGL */
#define SOUNDFONT3
/* #undef WIN_PORTABLE */
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/tests/tst_tuplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void TestTuplet::split(const char* p1, const char* p2)
score->startCmd();
EditData dd(0);
dd.dropElement = ts;
dd.modifiers = 0;
dd.modifiers = {};
dd.dragOffset = QPointF();
dd.pos = m->pagePos();
m->drop(dd);
Expand Down
17 changes: 10 additions & 7 deletions src/framework/audio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,21 @@ set (MODULE_INCLUDE
${FLUIDSYNTH_INC}
)

if(OS_IS_WIN)
set(MODULE_LINK winmm )
endif()
set(MODULE_LINK
fluidsynth
)

if(OS_IS_LIN)
if (OS_IS_MAC)
find_library(AudioToolbox NAMES AudioToolbox)
set(MODULE_LINK ${MODULE_LINK} ${AudioToolbox})
elseif (OS_IS_WIN)
set(MODULE_LINK ${MODULE_LINK} winmm )
elseif (OS_IS_LIN)
find_package(ALSA REQUIRED)
set(MODULE_LINK ${ALSA_LIBRARIES} pthread )
set(MODULE_INCLUDE ${MODULE_INCLUDE} ${ALSA_INCLUDE_DIRS} )
set(MODULE_LINK ${MODULE_LINK} ${ALSA_LIBRARIES} pthread )
endif()

set(MODULE_LINK ${MODULE_LINK} fluidsynth )

set(MODULE_QRC audio.qrc)

set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml)
Expand Down
18 changes: 10 additions & 8 deletions src/framework/midi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ if (OS_IS_WIN)
${CMAKE_CURRENT_LIST_DIR}/internal/platform/win/winmidiinport.h
)
elseif(OS_IS_LIN)
find_package(ALSA REQUIRED)
set(MODULE_LINK ${ALSA_LIBRARIES} pthread )
set(MODULE_INCLUDE ${MODULE_INCLUDE} ${ALSA_INCLUDE_DIRS} )

set(DRIVER_SRC
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/alsamidioutport.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/alsamidioutport.h
Expand Down Expand Up @@ -72,14 +68,20 @@ set(MODULE_SRC
)

set(MODULE_LINK
${MODULE_LINK}
qzip
)

include(GetPlatformInfo)
if (OS_IS_WIN)
if (OS_IS_MAC)
find_library(CoreMIDI NAMES CoreMIDI)
find_library(CoreAudio NAMES CoreAudio)
set(MODULE_LINK ${MODULE_LINK} ${CoreMIDI} ${CoreAudio})
elseif (OS_IS_WIN)
set(MODULE_LINK ${MODULE_LINK} winmm)
endif(OS_IS_WIN)
elseif (OS_IS_LIN)
find_package(ALSA REQUIRED)
set(MODULE_INCLUDE ${MODULE_INCLUDE} ${ALSA_INCLUDE_DIRS} )
set(MODULE_LINK ${MODULE_LINK} ${ALSA_LIBRARIES} pthread )
endif()

set(MODULE_QRC midi.qrc)

Expand Down
5 changes: 5 additions & 0 deletions src/framework/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,9 @@ set(MODULE_LINK
accessibility
)

if (OS_IS_MAC)
find_library(AppKit NAMES AppKit)
set(MODULE_LINK ${MODULE_LINK} ${AppKit})
endif()

include(${PROJECT_SOURCE_DIR}/build/module.cmake)
8 changes: 0 additions & 8 deletions src/framework/ui/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,4 @@ set(MODULE_TEST_LINK
ui
)

if (OS_IS_MAC)
set(MODULE_TEST_LINK
${MODULE_TEST_LINK}
${OsxFrameworks}
)
endif()

include(${PROJECT_SOURCE_DIR}/src/framework/testing/gtest.cmake)

7 changes: 0 additions & 7 deletions src/importexport/musicxml/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ set(MODULE_TEST_LINK
iex_musicxml
)

if (OS_IS_MAC)
set(MODULE_TEST_LINK
${MODULE_TEST_LINK}
${OsxFrameworks}
)
endif()

set(MODULE_TEST_DATA_ROOT ${CMAKE_CURRENT_LIST_DIR})

include(${PROJECT_SOURCE_DIR}/src/framework/testing/qtest.cmake)
8 changes: 3 additions & 5 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,9 @@ else()
qt5_import_qml_plugins(mscore PATH_TO_SCAN ${CMAKE_SOURCE_DIR})
endif()

if (OS_IS_MAC)
target_link_libraries(mscore ${OsxFrameworks})
else (OS_IS_MAC)
# target_link_libraries(mscore rt) # TODO What is it?
endif (OS_IS_MAC)
if (OS_IS_MAC AND SPARKLE_ENABLED)
target_link_libraries(mscore ${SPARKLE_LIBRARY})
endif()


###########################################
Expand Down

0 comments on commit b7430fe

Please sign in to comment.