Preliminary FreeBSD support.

Encountered issues so far:

 open /dev/snd/seq failed:
 The score starts zoomed in, so one has to zoom
 out with the ctrl plus mouse wheel
This commit is contained in:
Jesper Schmitz Mouridsen 2023-06-01 01:00:58 +02:00 committed by Igor Korsukov
parent ed2023b71a
commit c75139bbe1
14 changed files with 65 additions and 10 deletions

View File

@ -28,6 +28,8 @@ elseif(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Windows")
set(OS_IS_WIN 1)
elseif(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
set(OS_IS_LIN 1)
elseif(${CMAKE_HOST_SYSTEM_NAME} MATCHES "FreeBSD")
set(OS_IS_FBSD 1)
elseif(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
set(OS_IS_MAC 1)
else()

View File

@ -25,7 +25,6 @@
###########################################
# Common
###########################################
set(EXECUTABLE_NAME mscore)
###########################################
@ -108,6 +107,14 @@ elseif(OS_IS_WASM)
-s ERROR_ON_UNDEFINED_SYMBOLS=0 \
-O3 \
")
elseif(OS_IS_FBSD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L /usr/local/lib -lasound -lpthread")
set(MSCORE_OUTPUT_NAME "${EXECUTABLE_NAME}")
set(CMAKE_INSTALL_RPATH "${QT_INSTALL_LIBS}")
if (BUILD_SHARED_LIBS)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${SHARED_LIBS_INSTALL_DESTINATION}")
endif(BUILD_SHARED_LIBS)
else()
message(FATAL_ERROR "Unsupported Platform: ${CMAKE_HOST_SYSTEM_NAME}")
endif()
@ -397,6 +404,12 @@ elseif(OS_IS_LIN)
add_custom_target(mscore_alias ALL COMMAND echo "No symlink aliases will be created." VERBATIM )
endif (LN_EXECUTABLE)
elseif(OS_IS_FBSD)
###########################################
# FreeBSD
###########################################
install(TARGETS ${EXECUTABLE_NAME} RUNTIME DESTINATION bin )
install(FILES ${PROJECT_BINARY_DIR}/src/app/musescore DESTINATION bin)
###########################################
# MacOS
###########################################

View File

@ -252,7 +252,7 @@ int App::run(int argc, char** argv)
const QString mainQmlFile = "/platform/win/Main.qml";
#elif defined(Q_OS_MACOS)
const QString mainQmlFile = "/platform/mac/Main.qml";
#elif defined(Q_OS_LINUX)
#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
const QString mainQmlFile = "/platform/linux/Main.qml";
#elif defined(Q_OS_WASM)
const QString mainQmlFile = "/Main.wasm.qml";

View File

@ -43,6 +43,13 @@ elseif(OS_IS_LIN)
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/audiodeviceslistener.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/audiodeviceslistener.h
)
elseif(OS_IS_FBSD)
set(DRIVER_SRC
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/linuxaudiodriver.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/linuxaudiodriver.h
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/audiodeviceslistener.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/audiodeviceslistener.h
)
elseif(OS_IS_MAC)
set(DRIVER_SRC
${CMAKE_CURRENT_LIST_DIR}/internal/platform/osx/osxaudiodriver.mm

View File

@ -64,6 +64,9 @@ using namespace mu::audio::fx;
#include "internal/platform/lin/linuxaudiodriver.h"
#endif
#ifdef Q_OS_FREEBSD
#include "internal/platform/lin/linuxaudiodriver.h"
#endif
#ifdef Q_OS_WIN
//#include "internal/platform/win/winmmdriver.h"
//#include "internal/platform/win/wincoreaudiodriver.h"
@ -105,7 +108,7 @@ void AudioModule::registerExports()
m_soundFontRepository = std::make_shared<SoundFontRepository>();
m_registerAudioPluginsScenario = std::make_shared<RegisterAudioPluginsScenario>();
#ifdef Q_OS_LINUX
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
m_audioDriver = std::shared_ptr<IAudioDriver>(new LinuxAudioDriver());
#endif

View File

@ -83,6 +83,9 @@ private:
#ifdef Q_OS_LINUX
std::shared_ptr<IAudioDriver> m_audioDriver;
#endif
#ifdef Q_OS_FREEBSD
std::shared_ptr<IAudioDriver> m_audioDriver;
#endif
#ifdef Q_OS_WIN
//std::shared_ptr<IAudioDriver> m_audioDriver;

View File

@ -19,7 +19,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
set(MODULE_TEST audio_test)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /usr/local/lib/libasound.so")
set(MODULE_TEST_SRC
${CMAKE_CURRENT_LIST_DIR}/mocks/audioconfigurationmock.h
${CMAKE_CURRENT_LIST_DIR}/mocks/knownaudiopluginsregistermock.h

View File

@ -35,6 +35,13 @@ elseif(OS_IS_LIN)
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/alsamidiinport.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/alsamidiinport.h
)
elseif(OS_IS_FBSD)
set(DRIVER_SRC
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/alsamidioutport.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/alsamidioutport.h
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/alsamidiinport.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/platform/lin/alsamidiinport.h
)
elseif(OS_IS_MAC)
set(DRIVER_SRC
${CMAKE_CURRENT_LIST_DIR}/internal/platform/osx/coremidioutport.cpp

View File

@ -34,7 +34,7 @@
using namespace mu::midi;
#ifdef Q_OS_LINUX
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
#include "internal/platform/lin/alsamidioutport.h"
#include "internal/platform/lin/alsamidiinport.h"
#elif defined(Q_OS_WIN)
@ -57,7 +57,7 @@ void MidiModule::registerExports()
{
m_configuration = std::make_shared<MidiConfiguration>();
#ifdef Q_OS_LINUX
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
m_midiOutPort = std::make_shared<AlsaMidiOutPort>();
m_midiInPort = std::make_shared<AlsaMidiInPort>();
#elif defined(Q_OS_WIN)

View File

@ -27,7 +27,10 @@
namespace mu::midi {
class MidiConfiguration;
#ifdef Q_OS_LINUX
#if defined(Q_OS_LINUX)
class AlsaMidiOutPort;
class AlsaMidiInPort;
#elif defined(Q_OS_FREEBSD)
class AlsaMidiOutPort;
class AlsaMidiInPort;
#elif defined(Q_OS_WIN)
@ -53,7 +56,7 @@ public:
private:
std::shared_ptr<MidiConfiguration> m_configuration;
#ifdef Q_OS_LINUX
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
std::shared_ptr<AlsaMidiOutPort> m_midiOutPort;
std::shared_ptr<AlsaMidiInPort> m_midiInPort;

View File

@ -48,6 +48,8 @@ static std::string platformFileSuffix()
return "dmg";
#elif defined(Q_OS_LINUX)
return "appimage";
#else
return "";
#endif
}

View File

@ -3151,9 +3151,11 @@ static drmp3_result drmp3_result_from_errno(int e)
#ifdef ENOTUNIQ
case ENOTUNIQ: return DRMP3_NOT_UNIQUE;
#endif
#ifndef __FreeBSD__
#ifdef EBADFD
case EBADFD: return DRMP3_ERROR;
#endif
#endif
#ifdef EREMCHG
case EREMCHG: return DRMP3_ERROR;
#endif
@ -3178,9 +3180,11 @@ static drmp3_result drmp3_result_from_errno(int e)
#ifdef ERESTART
case ERESTART: return DRMP3_ERROR;
#endif
#ifndef __FreeBSD__
#ifdef ESTRPIPE
case ESTRPIPE: return DRMP3_ERROR;
#endif
#endif
#ifdef EUSERS
case EUSERS: return DRMP3_ERROR;
#endif

View File

@ -2769,9 +2769,11 @@ static drwav_result drwav_result_from_errno(int e)
#ifdef ENOTUNIQ
case ENOTUNIQ: return DRWAV_NOT_UNIQUE;
#endif
#ifndef __FreeBSD__
#ifdef EBADFD
case EBADFD: return DRWAV_ERROR;
#endif
#endif
#ifdef EREMCHG
case EREMCHG: return DRWAV_ERROR;
#endif
@ -2796,9 +2798,11 @@ static drwav_result drwav_result_from_errno(int e)
#ifdef ERESTART
case ERESTART: return DRWAV_ERROR;
#endif
#ifndef __FreeBSD__
#ifdef ESTRPIPE
case ESTRPIPE: return DRWAV_ERROR;
#endif
#endif
#ifdef EUSERS
case EUSERS: return DRWAV_ERROR;
#endif

View File

@ -52,9 +52,9 @@
# include <sys/endian.h>
#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__NetBSD__) || defined(__DragonFly__)
# include <sys/endian.h>
#x include <sys/endian.h>
# define be16toh(x) betoh16(x)
# define le16toh(x) letoh16(x)
@ -64,6 +64,13 @@
# define be64toh(x) betoh64(x)
# define le64toh(x) letoh64(x)
#elif defined(__FreeBSD__)
# include <sys/endian.h>
# define __BYTE_ORDER _BYTE_ORDER
# define __BIG_ENDIAN _BIG_ENDIAN
# define __LITTLE_ENDIAN _LITTLE_ENDIAN
#elif defined(__WINDOWS__)