Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MSVC support for GigPlayer (rework) #7162

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8116940
Add MSVC support for GigPlayer
Veratil Mar 26, 2024
10b58f7
!fixup bump size of buffers up
Veratil Mar 26, 2024
d12bd39
!fixup did not bump size check to 1024
Veratil Mar 28, 2024
21da446
!fixup Dom's CMake review
Veratil Mar 30, 2024
de0e04b
GigPlayer refactoring
Veratil Apr 10, 2024
cd6f98f
Add missing header
Veratil Apr 10, 2024
e6a7e21
Use std::for_each_n on supported versions, fall back to normal for lo…
Veratil Apr 10, 2024
0177752
Test gig version defines and defining file_offset_t manually if versi…
Veratil Apr 22, 2024
e424d0c
!fixup maybe adding quotes around variable will let msvc build pass a…
Veratil Apr 22, 2024
bec6f4c
Merge branch 'master' into new-msvc-gigplayer
Rossmaxx Jul 21, 2024
7ed72df
fix typo with sampleframe from merge
Rossmaxx Jul 21, 2024
4a1d472
removed accidental mingw-std-threads
Rossmaxx Jul 21, 2024
70defdd
added static cast to fix werror
Rossmaxx Jul 21, 2024
d6a4010
disabled version check for msvc
Rossmaxx Jul 21, 2024
ef2f3e4
fixed no-deprecated flag
Rossmaxx Jul 21, 2024
d879785
commented out version checking
Rossmaxx Jul 21, 2024
481e5a6
fixed mingw build after latest breakage.
Rossmaxx Jul 21, 2024
c2ad335
simplify a condition with De Morgan's law
Rossmaxx Oct 30, 2024
fcdaa1b
Merge branch 'master' into new-msvc-gigplayer
Rossmaxx Oct 30, 2024
7185d18
use < instead of " in the include
Rossmaxx Oct 31, 2024
99835ff
removed the #if because now we have for_each_n
Rossmaxx Oct 31, 2024
887ac30
linespace
Rossmaxx Oct 31, 2024
3adfdff
simplified looped index calculation by removing function
Rossmaxx Oct 31, 2024
c9addd3
remove the getPingPongIndex function too.
Rossmaxx Oct 31, 2024
9d9f3a4
fix build
Rossmaxx Oct 31, 2024
dfa3244
forgot the header file
Rossmaxx Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -530,14 +530,14 @@ ENDIF(WANT_SF2)

# check for libgig
If(WANT_GIG)
PKG_CHECK_MODULES(GIG gig)
find_package(Gig)
IF(GIG_FOUND)
SET(LMMS_HAVE_GIG TRUE)
SET(STATUS_GIG "OK")
ELSE(GIG_FOUND)
ELSE()
SET(STATUS_GIG "not found, libgig needed for decoding .gig files")
ENDIF(GIG_FOUND)
ENDIF(WANT_GIG)
ENDIF()
ENDIF()

# check for pthreads
IF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE OR LMMS_BUILD_OPENBSD OR LMMS_BUILD_FREEBSD OR LMMS_BUILD_HAIKU)
Expand Down
32 changes: 32 additions & 0 deletions cmake/modules/FindGig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2024 Kevin Zander
# Based on FindPortAudio.cmake, copyright (c) 2023 Dominic Clark
#
# Redistribution and use is allowed according to the terms of the New BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

include(ImportedTargetHelpers)

find_package_config_mode_with_fallback(gig libgig::libgig
LIBRARY_NAMES "gig"
INCLUDE_NAMES "libgig/gig.h"
PKG_CONFIG gig
PREFIX Gig
)

determine_version_from_source(Gig_VERSION libgig::libgig [[
#include <iostream>
#include <libgig/gig.h>

auto main() -> int
{
const auto version = gig::libraryVersion();
std::cout << version;
}
]])

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(Gig
REQUIRED_VARS Gig_LIBRARY Gig_INCLUDE_DIRS
VERSION_VAR Gig_VERSION
)
21 changes: 20 additions & 1 deletion plugins/GigPlayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,34 @@ if(LMMS_HAVE_GIG)
include_directories(SYSTEM ${GIG_INCLUDE_DIRS})
SET(CMAKE_AUTOUIC ON)

# Version checking logic disabled for msvc as vcpkg guarantees gig > 4.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to do version checking unconditionally as a sanity check. It's less complicated that way, makes fewer assumptions about our CI, and would catch any future mistakes.

Plus, if someone tried to build lmms on their own with MSVC, we'd want it to detect if they had an unsupported libgig version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version checking is broken on MSVC and causes a build fail, that's why I brought in this workaround.

if(NOT MSVC)
string(REPLACE "." ";" GIG_VERSION_LIST "${Gig_VERSION}")
list(LENGTH GIG_VERSION_LIST GIG_VERSION_LIST_LENGTH)
list(GET GIG_VERSION_LIST 0 GIG_VERSION_MAJOR)
list(GET GIG_VERSION_LIST 1 GIG_VERSION_MINOR)
list(GET GIG_VERSION_LIST 2 GIG_VERSION_PATCH)
if(GIG_VERSION_LIST_LENGTH GREATER 3)
list(GET GIG_VERSION_LIST 3 GIG_VERSION_REVISION)
endif()
configure_file("lmms_gig.h.in" "${CMAKE_BINARY_DIR}/lmms_gig.h")
endif()

# FIXME: Make sure we build globally with exceptions enabled and we can remove this
# Required for not crashing loading files with libgig
add_compile_options("-fexceptions")

# disable deprecated check for mingw-x-libgig
if(LMMS_BUILD_WIN32 AND NOT MSVC)
add_compile_options("-Wno-deprecated")
endif()

link_directories(${GIG_LIBRARY_DIRS})
link_libraries(${GIG_LIBRARIES})
build_plugin(gigplayer
GigPlayer.cpp GigPlayer.h PatchesDialog.cpp PatchesDialog.h PatchesDialog.ui
MOCFILES GigPlayer.h PatchesDialog.h
EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png"
)
target_link_libraries(gigplayer SampleRate::samplerate)
target_link_libraries(gigplayer SampleRate::samplerate libgig::libgig)
endif(LMMS_HAVE_GIG)
Loading
Loading