Skip to content

Commit

Permalink
ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-w committed Nov 6, 2023
1 parent 060fe34 commit 1682644
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
apt-get update
apt-get --yes install git
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: lukka/get-cmake@latest
- uses: lukka/get-cmake@v3.27.7
with:
cmakeVersion: "~3.22.0"
cmakeVersion: "~3.16.0"
- name: Check out
uses: actions/checkout@v3
with:
Expand Down
15 changes: 5 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
CMAKE_MINIMUM_REQUIRED(VERSION 3.16)

# Set the given policy to NEW. If it does not exist, it will not be set. If it
# is already set to NEW (most likely due to predating the minimum required CMake
Expand Down Expand Up @@ -619,22 +619,22 @@ FIND_PACKAGE(Samplerate 0.1.8 MODULE REQUIRED)

# set compiler flags
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
SET(WERROR_FLAGS "-Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow")
SET(WERROR_FLAGS -Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow)
OPTION(USE_WERROR "Add -werror to the build flags. Stops the build on warnings" OFF)
IF(${USE_WERROR})
SET(WERROR_FLAGS "${WERROR_FLAGS} -Werror")
LIST(APPEND WERROR_FLAGS -Werror)
ENDIF()

# Due to a regression in gcc-4.8.X, we need to disable array-bounds check
IF (CMAKE_COMPILER_IS_GNUCXX AND ((CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "4.8.0") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "4.8.0") OR LMMS_BUILD_WIN32))
SET(WERROR_FLAGS "${WERROR_FLAGS} -Wno-array-bounds -Wno-attributes")
LIST(APPEND WERROR_FLAGS -Wno-array-bounds -Wno-attributes)
ENDIF()
ELSEIF(MSVC)
# Remove any existing /W flags
STRING(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
SET(WERROR_FLAGS "/W2")
IF(${USE_WERROR})
SET(WERROR_FLAGS "${WERROR_FLAGS} /WX")
LIST(APPEND WERROR_FLAGS "/WX")
ENDIF()
ENDIF()

Expand All @@ -647,11 +647,6 @@ IF(NOT CMAKE_BUILD_TYPE)
"MinSizeRel" "RelWithDebInfo")
ENDIF()

SET(CMAKE_C_FLAGS "${WERROR_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${WERROR_FLAGS} ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DLMMS_DEBUG")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DLMMS_DEBUG")

if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.16")
set(NOOP_COMMAND "${CMAKE_COMMAND}" "-E" "true")
else()
Expand Down
2 changes: 1 addition & 1 deletion plugins/CarlaBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if(LMMS_HAVE_WEAKCARLA)
SET(CARLA_NATIVE_LIB carla_native-plugin)

ADD_LIBRARY(${CARLA_NATIVE_LIB} SHARED DummyCarla.cpp)
TARGET_INCLUDE_DIRECTORIES(${CARLA_NATIVE_LIB} PUBLIC ${CARLA_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(${CARLA_NATIVE_LIB} SYSTEM PUBLIC ${CARLA_INCLUDE_DIRS})
INSTALL(TARGETS ${CARLA_NATIVE_LIB}
LIBRARY DESTINATION "${PLUGIN_DIR}/optional"
RUNTIME DESTINATION "${PLUGIN_DIR}/optional"
Expand Down
4 changes: 2 additions & 2 deletions plugins/CarlaBase/Carla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ CarlaInstrument::CarlaInstrument(InstrumentTrack* const instrumentTrack, const D
fDescriptor->activate(fHandle);

// we need a play-handle which cares for calling play()
auto iph = new InstrumentPlayHandle(this, instrumentTrack);
Engine::audioEngine()->addPlayHandle( iph );
auto iph = new InstrumentPlayHandle(this, instrumentTrack);
Engine::audioEngine()->addPlayHandle( iph );

#if CARLA_VERSION_HEX >= CARLA_MIN_PARAM_VERSION
// text filter completion
Expand Down
8 changes: 6 additions & 2 deletions plugins/MidiImport/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
INCLUDE(BuildPlugin)

BUILD_PLUGIN(midiimport MidiImport.cpp MidiImport.h
ADD_LIBRARY(portsmf STATIC
portsmf/allegro.cpp portsmf/allegro.h portsmf/allegrosmfwr.cpp
portsmf/allegrord.cpp portsmf/allegrowr.cpp portsmf/allegrosmfrd.cpp
portsmf/mfmidi.cpp portsmf/mfmidi.h portsmf/strparse.cpp
portsmf/strparse.h portsmf/algrd_internal.h portsmf/algsmfrd_internal.h
portsmf/trace.h MOCFILES MidiImport.h)
portsmf/trace.h
)

BUILD_PLUGIN(midiimport MidiImport.cpp MidiImport.h MOCFILES MidiImport.h)
TARGET_LINK_LIBRARIES(midiimport portsmf)
19 changes: 9 additions & 10 deletions plugins/OpulenZ/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
INCLUDE(BuildPlugin)

# Avoid unused warnings for mididata.h
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-variable")
ENDIF()

INCLUDE_DIRECTORIES(adplug/src)

BUILD_PLUGIN(opulenz
OpulenZ.cpp
OpulenZ.h
ADD_LIBRARY(adplug STATIC
adplug/src/opl.h
adplug/src/fmopl.c
adplug/src/fmopl.h
adplug/src/temuopl.cpp
adplug/src/temuopl.h
)
TARGET_INCLUDE_DIRECTORIES(adplug PUBLIC adplug/src)

BUILD_PLUGIN(opulenz
OpulenZ.cpp
OpulenZ.h
MOCFILES OpulenZ.h
EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png"
)

TARGET_LINK_LIBRARIES(opulenz adplug)
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ TARGET_COMPILE_DEFINITIONS(lmms
PRIVATE $<TARGET_PROPERTY:lmmsobjs,INTERFACE_COMPILE_DEFINITIONS>
)

TARGET_COMPILE_DEFINITIONS(lmms PUBLIC $<$<CONFIG:Debug>:LMMS_DEBUG>)
TARGET_COMPILE_OPTIONS(lmms PUBLIC ${WERROR_FLAGS})

# Set Visual Studio startup project to lmms
# https://stackoverflow.com/a/37994396/8166701
IF(NOT CMAKE_VERSION VERSION_LESS 3.6)
Expand Down Expand Up @@ -210,6 +213,7 @@ ENDFOREACH()

set_target_properties(lmms PROPERTIES
ENABLE_EXPORTS ON
UNITY_BUILD_UNIQUE_ID "CMAKE_UNITY_ID"
)

IF(LMMS_BUILD_WIN32)
Expand Down
17 changes: 11 additions & 6 deletions src/common/SharedMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@
# include <QSharedMemory>
#endif

#ifndef CMAKE_UNITY_ID
#define CMAKE_UNITY_ID
#endif

namespace {
namespace CMAKE_UNITY_ID {

template<typename F>
int retryWhileInterrupted(F&& function) noexcept(std::is_nothrow_invocable_v<F>)
Expand All @@ -65,6 +69,7 @@ void deleteShmObject(const char* name) noexcept { shm_unlink(name); }
using FileDescriptor = lmms::UniqueNullableResource<int, -1, deleteFileDescriptor>;
using ShmObject = lmms::UniqueNullableResource<const char*, nullptr, deleteShmObject>;

} // namespace CMAKE_UNITY_ID
} // namespace


Expand All @@ -80,8 +85,8 @@ class SharedMemoryImpl
m_key{"/" + key}
{
const auto openFlags = readOnly ? O_RDONLY : O_RDWR;
const auto fd = FileDescriptor{
retryWhileInterrupted([&]() noexcept { return shm_open(m_key.c_str(), openFlags, 0); })
const auto fd = CMAKE_UNITY_ID::FileDescriptor{
CMAKE_UNITY_ID::retryWhileInterrupted([&]() noexcept { return shm_open(m_key.c_str(), openFlags, 0); })
};
if (!fd)
{
Expand All @@ -105,15 +110,15 @@ class SharedMemoryImpl
m_key{"/" + key},
m_size{size}
{
const auto fd = FileDescriptor{
retryWhileInterrupted([&]() noexcept { return shm_open(m_key.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); })
const auto fd = CMAKE_UNITY_ID::FileDescriptor{
CMAKE_UNITY_ID::retryWhileInterrupted([&]() noexcept { return shm_open(m_key.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600); })
};
if (fd.get() == -1)
{
throw std::system_error{errno, std::generic_category(), "SharedMemoryImpl: shm_open() failed"};
}
m_object.reset(m_key.c_str());
if (retryWhileInterrupted([&]() noexcept { return ftruncate(fd.get(), m_size); }) == -1)
if (CMAKE_UNITY_ID::retryWhileInterrupted([&]() noexcept { return ftruncate(fd.get(), m_size); }) == -1)
{
throw std::system_error{errno, std::generic_category(), "SharedMemoryImpl: ftruncate() failed"};
}
Expand All @@ -139,7 +144,7 @@ class SharedMemoryImpl
std::string m_key;
std::size_t m_size;
void* m_mapping;
ShmObject m_object;
CMAKE_UNITY_ID::ShmObject m_object;
};

#else
Expand Down
7 changes: 7 additions & 0 deletions src/gui/SubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ SubWindow::SubWindow( QWidget *parent, Qt::WindowFlags windowFlags ) :
m_windowTitle->setAttribute( Qt::WA_TransparentForMouseEvents, true );
m_windowTitle->setGraphicsEffect( m_shadow );

// Workaround for Qt < 5.12.0, see
// - https://stackoverflow.com/questions/10755058/qflags-enum-type-conversion-fails-all-of-a-sudden
// - https://stackoverflow.com/questions/39919142/broken-bitwise-or-operator-in-a-qt-project
// -
// - https://code.qt.io/cgit/qt/qtbase.git/commit/src/corelib/global/qnamespace.h?id=e759d38d491d9044a0558b1d45911e3b4115e772
using ::operator|;

// disable the minimize button
setWindowFlags( Qt::SubWindow | Qt::WindowMaximizeButtonHint |
Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint |
Expand Down

0 comments on commit 1682644

Please sign in to comment.