Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into remove-mixer-sani…
Browse files Browse the repository at this point in the history
…tation
  • Loading branch information
sakertooth committed Jul 4, 2024
2 parents 04f52a7 + 538572a commit c99dae1
Show file tree
Hide file tree
Showing 300 changed files with 3,493 additions and 2,125 deletions.
36 changes: 27 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ jobs:
run: |
ccache --zero-stats
source /opt/qt5*/bin/qt5*-env.sh || true
mkdir build && cd build
cmake .. $CMAKE_OPTS -DCMAKE_INSTALL_PREFIX=./install
cmake -S . \
-B build \
-DCMAKE_INSTALL_PREFIX=./install \
$CMAKE_OPTS
- name: Build
run: cmake --build build
- name: Run tests
Expand Down Expand Up @@ -95,19 +97,21 @@ jobs:
- name: Clean up Homebrew download cache
run: rm -rf ~/Library/Caches/Homebrew/downloads
- name: Restore Homebrew download cache
id: cache-homebrew
uses: actions/cache/restore@v3
with:
key: n/a - only restore from restore-keys
restore-keys: |
homebrew-
homebrew-${{ matrix.arch }}-
path: ~/Library/Caches/Homebrew/downloads
- name: Cache ccache data
uses: actions/cache@v3
with:
key: ccache-${{ github.job }}-${{ github.ref }}-${{ github.run_id }}
key: "ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}\
-${{ github.run_id }}"
restore-keys: |
ccache-${{ github.job }}-${{ github.ref }}-
ccache-${{ github.job }}-
ccache-${{ github.job }}-${{ matrix.arch }}-${{ github.ref }}-
ccache-${{ github.job }}-${{ matrix.arch }}-
path: ~/Library/Caches/ccache
- name: Install dependencies
run: |
Expand Down Expand Up @@ -154,10 +158,14 @@ jobs:
env:
CCACHE_MAXSIZE: 500MB
- name: Save Homebrew download cache
if: ${{ steps.cache-homebrew.outputs.cache-matched-key != env.key }}
uses: actions/cache/save@v3
with:
key: homebrew-${{ hashFiles('Brewfile.lock.json') }}
key: ${{ env.key }}
path: ~/Library/Caches/Homebrew/downloads
env:
key: "homebrew-${{ matrix.arch }}\
-${{ hashFiles('Brewfile.lock.json') }}"
mingw:
strategy:
fail-fast: false
Expand All @@ -175,6 +183,12 @@ jobs:
CCACHE_NOCOMPRESS: 1
MAKEFLAGS: -j2
steps:
- name: Enable POSIX MinGW
run: |
update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
- name: Configure git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Check out
Expand All @@ -194,8 +208,11 @@ jobs:
- name: Configure
run: |
ccache --zero-stats
mkdir build && cd build
../cmake/build_win${{ matrix.arch }}.sh
cmake -S . \
-B build \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_TOOLCHAIN_FILE="./cmake/toolchains/MinGW-W64-${{ matrix.arch }}.cmake" \
$CMAKE_OPTS
- name: Build
run: cmake --build build
- name: Package
Expand Down Expand Up @@ -278,6 +295,7 @@ jobs:
--toolchain C:/vcpkg/scripts/buildsystems/vcpkg.cmake `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DUSE_COMPILE_CACHE=ON `
-DUSE_WERROR=ON `
-DVCPKG_TARGET_TRIPLET="${{ matrix.arch }}-windows" `
-DVCPKG_HOST_TRIPLET="${{ matrix.arch }}-windows" `
-DVCPKG_MANIFEST_INSTALL="${{ env.should_install_manifest }}"
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
[submodule "src/3rdparty/weakjack/weakjack"]
path = src/3rdparty/weakjack/weakjack
url = https://github.com/x42/weakjack.git
[submodule "src/3rdparty/mingw-std-threads"]
path = src/3rdparty/mingw-std-threads
url = https://github.com/meganz/mingw-std-threads.git
[submodule "doc/wiki"]
path = doc/wiki
url = https://github.com/lmms/lmms.wiki.git
Expand Down
104 changes: 69 additions & 35 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ function(enable_policy_if_exists id)
endif()
endfunction()

# Needed for the SWH Ladspa plugins. See below.
enable_policy_if_exists(CMP0074) # find_package() uses <PackageName>_ROOT variables.
enable_policy_if_exists(CMP0092) # MSVC warning flags are not in CMAKE_<LANG>_FLAGS by default.
# Needed for ccache support with MSVC
enable_policy_if_exists(CMP0141) # MSVC debug information format flags are selected by an abstraction.

Expand All @@ -43,6 +42,7 @@ INCLUDE(AddFileDependencies)
INCLUDE(CheckIncludeFiles)
INCLUDE(FindPkgConfig)
INCLUDE(GenerateExportHeader)
include(StaticDependencies)

STRING(TOUPPER "${CMAKE_PROJECT_NAME}" PROJECT_NAME_UCASE)

Expand Down Expand Up @@ -154,6 +154,7 @@ CHECK_INCLUDE_FILES(sys/types.h LMMS_HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILES(sys/ipc.h LMMS_HAVE_SYS_IPC_H)
CHECK_INCLUDE_FILES(sys/time.h LMMS_HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILES(sys/times.h LMMS_HAVE_SYS_TIMES_H)
CHECK_INCLUDE_FILES(sys/prctl.h LMMS_HAVE_SYS_PRCTL_H)
CHECK_INCLUDE_FILES(sched.h LMMS_HAVE_SCHED_H)
CHECK_INCLUDE_FILES(sys/soundcard.h LMMS_HAVE_SYS_SOUNDCARD_H)
CHECK_INCLUDE_FILES(soundcard.h LMMS_HAVE_SOUNDCARD_H)
Expand All @@ -172,7 +173,7 @@ LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")
FIND_PACKAGE(Qt5 5.9.0 COMPONENTS Core Gui Widgets Xml REQUIRED)
FIND_PACKAGE(Qt5 COMPONENTS LinguistTools QUIET)

INCLUDE_DIRECTORIES(
include_directories(SYSTEM
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
Expand Down Expand Up @@ -410,7 +411,7 @@ IF(WANT_SOUNDIO)
IF(SOUNDIO_FOUND)
SET(LMMS_HAVE_SOUNDIO TRUE)
SET(STATUS_SOUNDIO "OK")
INCLUDE_DIRECTORIES("${SOUNDIO_INCLUDE_DIR}")
include_directories(SYSTEM "${SOUNDIO_INCLUDE_DIR}")
ELSE(SOUNDIO_FOUND)
SET(SOUNDIO_INCLUDE_DIR "")
SET(STATUS_SOUNDIO "not found, please install libsoundio if you require libsoundio support")
Expand Down Expand Up @@ -491,11 +492,9 @@ ENDIF(NOT LMMS_HAVE_ALSA)
IF(WANT_JACK)
IF(WANT_WEAKJACK)
SET(LMMS_HAVE_WEAKJACK TRUE)
SET(WEAKJACK_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/3rdparty/weakjack/weakjack)
SET(JACK_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/src/3rdparty/jack2/common)
SET(STATUS_JACK "OK (weak linking enabled)")
# use dlsym instead
SET(JACK_LIBRARIES ${CMAKE_DL_LIBS})
set(JACK_INCLUDE_DIRS "")
set(JACK_LIBRARIES weakjack)
SET(LMMS_HAVE_JACK TRUE)
SET(LMMS_HAVE_JACK_PRENAME TRUE)
SET(JACK_FOUND TRUE)
Expand Down Expand Up @@ -631,28 +630,68 @@ ENDIF(WANT_DEBUG_FPE)
# check for libsamplerate
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")
OPTION(USE_WERROR "Add -werror to the build flags. Stops the build on warnings" OFF)
IF(${USE_WERROR})
SET(WERROR_FLAGS "${WERROR_FLAGS} -Werror")
ENDIF()
# Shim the SYSTEM property for older CMake versions
if(CMAKE_VERSION VERSION_LESS "3.25")
define_property(TARGET
PROPERTY SYSTEM
INHERITED
BRIEF_DOCS "Shim of built-in SYSTEM property for CMake versions less than 3.25"
FULL_DOCS "Non-functional, but allows the property to be inherited properly."
"See the CMake documentation at https://cmake.org/cmake/help/latest/prop_tgt/SYSTEM.html."
)
endif()

# Add warning and error flags
option(USE_WERROR "Treat compiler warnings as errors" OFF)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(COMPILE_ERROR_FLAGS
"-Wall" # Enable most warnings by default
"-Werror=unused-function" # Unused functions are an error
# TODO: Fix the code and remove the following:
"-Wno-sign-compare" # Permit comparisons between signed and unsigned integers
"-Wno-strict-overflow" # Permit optimisations assuming no signed overflow
)
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
"-w" # Disable all warnings
)

# 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")
ENDIF()
ELSEIF(MSVC)
# Remove any existing /W flags
string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS ${CMAKE_C_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")
ENDIF()
ENDIF()
# TODO: Is this still necessary?
if(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND COMPILE_ERROR_FLAGS
"-Wno-array-bounds" # Permit out-of-bounds array subscripts
"-Wno-attributes" # Permit unrecognised attributes
)
endif()

if(USE_WERROR)
list(APPEND COMPILE_ERROR_FLAGS
"-Werror" # Treat warnings as errors
)
endif()
elseif(MSVC)
set(COMPILE_ERROR_FLAGS
"/W2" # Enable some warnings by default
"/external:W0" # Don't emit warnings for third-party code
"/external:anglebrackets" # Consider headers included with angle brackets to be third-party
"/external:templates-" # Still emit warnings from first-party instantiations of third-party templates
# Silence "class X needs to have DLL-interface to be used by clients of
# class Y" warnings. These aren't trivial to address, and don't pose a
# problem for us since we build all modules with the same compiler and
# options, and dynamically link the CRT.
"/wd4251"
)
set(THIRD_PARTY_COMPILE_ERROR_FLAGS
"/W0" # Disable all warnings
)

if(USE_WERROR)
list(APPEND COMPILE_ERROR_FLAGS
"/WX" # Treat warnings as errors
)
endif()
endif()
add_compile_options("$<IF:$<BOOL:$<TARGET_PROPERTY:SYSTEM>>,${THIRD_PARTY_COMPILE_ERROR_FLAGS},${COMPILE_ERROR_FLAGS}>")

IF(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
Expand All @@ -662,8 +701,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")

Expand Down Expand Up @@ -705,12 +742,9 @@ ENDIF()
# we somehow have to make LMMS-binary depend on MOC-files
ADD_FILE_DEPENDENCIES("${CMAKE_BINARY_DIR}/lmmsconfig.h")

IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
IF(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
ELSE(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
ENDIF(WIN32)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -DPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
elseif(MSVC)
# Use UTF-8 as the source and execution character set
add_compile_options("/utf-8")
Expand Down
40 changes: 0 additions & 40 deletions cmake/build_win32.sh

This file was deleted.

3 changes: 0 additions & 3 deletions cmake/build_win64.sh

This file was deleted.

1 change: 1 addition & 0 deletions cmake/modules/PluginList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ SET(LMMS_PLUGIN_LIST
DynamicsProcessor
Eq
Flanger
GranularPitchShifter
HydrogenImport
LadspaBrowser
LadspaEffect
Expand Down
Loading

0 comments on commit c99dae1

Please sign in to comment.