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 libdjinterop external project dependency #2932

Merged
merged 5 commits into from
Jul 15, 2020

Conversation

mr-smidge
Copy link
Contributor

@mr-smidge mr-smidge commented Jul 11, 2020

This PR adds the libdjinterop library as an external project dependency to the CMake build system for Mixxx. It is a precursor to PR #2753 , which will add library export functionality using libdjinterop.

Notes:

  • An existing installation of the library, if available, is used in preference. If this is not available, a snapshot is downloaded from the libdjinterop GitHub repo.
  • The scons build has not been touched, on the assumption that it will be removed soon.
  • The library should be considered in beta at present. As such, the library is added only on Linux builds for now, following prior discussion with devs in PR Lib export with libdjinterop #2753 .
    • The libdjinterop library has been compiled and tested on 64-bit Windows in isolation, but I haven't integrated this in with Mixxx yet.
    • MacOS builds will fail with the current build servers because Apple LLVM 9 doesn't support std::optional<T> (only experimental), which is in the public library headers.

CMakeLists.txt Outdated
Comment on lines 1498 to 1500
# libdjinterop depends on zlib and sqlite3.
# Mixxx already has a dependency on sqlite3, but not zlib, which we add now.
find_package(ZLIB 1.2.8 REQUIRED)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might be considered slightly fishy: we're linking statically to libdjinterop, but libdjinterop depends on SQLite3 and ZLib. It just so happens that Mixxx already has the SQLite3 dependency, but not ZLib.

Are there any concerns with encoding implicit knowledge of libdjinterop's dependencies here? I'm not aware of a better way with static build.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Holzhaus Opinions?

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 this should be move to the FindDJInterop module. For the external project build, this can be taken care of in libdjinterop's own CMakeLists.txt.

Copy link
Contributor Author

@mr-smidge mr-smidge Jul 12, 2020

Choose a reason for hiding this comment

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

For the external project build, this can be taken care of in libdjinterop's own CMakeLists.txt.

The CMakeLists.txt file from libdjinterop already has a find_package(ZLIB 1.2.8 REQUIRED) line. However, I was not able to get the dependencies of the external project to transfer through to mixxx-lib (and search engines were not fruitful for me). Do you know of a way in CMake to do this?

Note: this line is only in the external project section: it isn't required if the library is found via FindDjInterop, as that would be linking to a shared library which already has the dependency explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just noticed that the ChromaPrint dependency already does this (with FFTW), so at least the situation here is in line with the status quo.

@mr-smidge mr-smidge force-pushed the enh/djinterop-external-project branch from fb83912 to 3bd92eb Compare July 11, 2020 23:16
@uklotzde
Copy link
Contributor

You could adopt our workaround in util/optional.h to enable compatibility with macOS. The pre-standard version is missing some methods from final standard and might require some workarounds.

@uklotzde
Copy link
Contributor

uklotzde commented Jul 12, 2020

Please rebase on (upstream) master.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated
Comment on lines 1498 to 1500
# libdjinterop depends on zlib and sqlite3.
# Mixxx already has a dependency on sqlite3, but not zlib, which we add now.
find_package(ZLIB 1.2.8 REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

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

@Holzhaus Opinions?

CMakeLists.txt Outdated Show resolved Hide resolved
@mr-smidge
Copy link
Contributor Author

You could adopt our workaround in util/optional.h to enable compatibility with macOS. The pre-standard version is missing some methods from final standard and might require some workarounds.

@uklotzde , I thought about this approach, but wanted to check: are there plans to upgrade the version of Apple LLVM on the build servers? If there are, I might prefer that rather than add workarounds for old compilers.

@mr-smidge
Copy link
Contributor Author

Please rebase on (upstream) master.

Erm, it already is (at the time of writing) - did you see something to indicate that it wasn't? Thanks.

@mr-smidge mr-smidge force-pushed the enh/djinterop-external-project branch from 6f5008c to b0a6b4c Compare July 12, 2020 09:36
@uklotzde
Copy link
Contributor

@uklotzde , I thought about this approach, but wanted to check: are there plans to upgrade the version of Apple LLVM on the build servers? If there are, I might prefer that rather than add workarounds for old compilers.

We cannot update the CI build servers as long as we want to support older macOS releases. Please add the workaround if you want your library included in macOS builds.

@uklotzde
Copy link
Contributor

Please rebase on (upstream) master.

Erm, it already is (at the time of writing) - did you see something to indicate that it wasn't? Thanks.

If cloned your branch locally and tried to rebase on master -> conflicts

@uklotzde
Copy link
Contributor

Please rebase on (upstream) master.

Erm, it already is (at the time of writing) - did you see something to indicate that it wasn't? Thanks.

If cloned your branch locally and tried to rebase on master -> conflicts

Sorry, I forgot to pull master.

.travis.yml Outdated Show resolved Hide resolved
Add -DDJINTEROP=ON to Ubuntu/CMake travis and appveyor builds.
Add shallow git clone.
@mr-smidge mr-smidge force-pushed the enh/djinterop-external-project branch from b0a6b4c to 0aa65b2 Compare July 12, 2020 12:51
@mr-smidge
Copy link
Contributor Author

@uklotzde , I thought about this approach, but wanted to check: are there plans to upgrade the version of Apple LLVM on the build servers? If there are, I might prefer that rather than add workarounds for old compilers.

We cannot update the CI build servers as long as we want to support older macOS releases. Please add the workaround if you want your library included in macOS builds.

Raised xsco/libdjinterop#14 for the libdjinterop library. I'll focus on Linux builds for this PR and will enable it for Mixxx Mac builds in a later PR.

@mr-smidge mr-smidge marked this pull request as ready for review July 12, 2020 17:28
@Be-ing Be-ing requested a review from Holzhaus July 12, 2020 17:29
CMakeLists.txt Outdated
set(DJINTEROP_GIT_REPO_URL https://github.com/xsco/libdjinterop.git)
set(DJINTEROP_GIT_TAG tags/0.11.0)
set(DJINTEROP_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libdjinterop-install")
if(DJINTEROP_MESON_BUILD)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to support both build systems? If libdjinterop has a cmake build, let's just use that one. The user might not even have meson installed and custom build flags can't be passed to meson anyway with this implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Short bit of background: Meson has been the main build system for libdjinterop, based mainly on my personal preferences whilst developing the library, and the easier time with cross-platform dependency management. I originally added a CMake build on a "best efforts" basis with the idea that it would make it easier to integrate with Mixxx. As you note (and as written in a comment), the typical user compiling Mixxx may not even have Meson/Ninja installed.

So I have to think about whether I, as the libdjinterop maintainer, should support two build systems for the library. Given the current simplicity of the libdjinterop build, maybe I can make the CMake build "official".

Nonetheless, I am not about to go and deliberately break the CMake build (!), so I don't mind removing the conditional regardless.

CMakeLists.txt Outdated
Comment on lines 1498 to 1500
# libdjinterop depends on zlib and sqlite3.
# Mixxx already has a dependency on sqlite3, but not zlib, which we add now.
find_package(ZLIB 1.2.8 REQUIRED)
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 this should be move to the FindDJInterop module. For the external project build, this can be taken care of in libdjinterop's own CMakeLists.txt.

CMakeLists.txt Outdated Show resolved Hide resolved
Copy link
Member

@Holzhaus Holzhaus left a comment

Choose a reason for hiding this comment

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

Works fine, thanks!

CMakeLists.txt Outdated Show resolved Hide resolved
appveyor.yml Outdated Show resolved Hide resolved
@mr-smidge mr-smidge requested a review from Holzhaus July 13, 2020 20:59
Copy link
Member

@Holzhaus Holzhaus left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@mr-smidge
Copy link
Contributor Author

Many thanks @uklotzde and @Holzhaus .

The Visual Studio AppVeyor build appears to have failed tests with a large number of file-not-found errors. I presume these are transient? If so, please could someone kick off this job again?

@mr-smidge
Copy link
Contributor Author

A re-run failed too. I might need some help with these AppVeyor VS errors - I can't see how these are connected to the commits in this PR. Example:

        Start 219: EngineMicrophoneTest.TestInputMatchesOutput
219/618 Test #219: EngineMicrophoneTest.TestInputMatchesOutput .....................................***Timeout  30.01 sec
Note: Google Test filter = EngineMicrophoneTest.TestInputMatchesOutput
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from EngineMicrophoneTest
[ RUN      ] EngineMicrophoneTest.TestInputMatchesOutput
Loading resources from  "C:/projects/mixxx/cmake_build/res/"
BaseTrackPlayerImpl::slotLoadTrack "[Channel1]"
CachingReaderWorker - "[Channel1]" File not found "C:/projects/mixxx/cmake_build/src/test/sine-30.wav"

Any ideas?

@uklotzde
Copy link
Contributor

Strange. I'll push this branch to my personal AppVeyor account for testing.

@uklotzde
Copy link
Contributor

Test failures are probably caused by #2938

@uklotzde
Copy link
Contributor

Please merge master to verify that the build succeeds now.

@mr-smidge
Copy link
Contributor Author

Please merge master to verify that the build succeeds now.

Done, and the VS AppVeyor build now passes 😄.

Unfortunately, the OSX Scons build failed after timing out! 🤦 Please could this be re-run for a (hopefully) clean bill of health?

@mr-smidge
Copy link
Contributor Author

All green - ok to merge?

Then I'll update PR #2753 .

@Holzhaus
Copy link
Member

Huh? Shouldn't you merge this into #2753? This doesn't make sense in master on its own...

@uklotzde
Copy link
Contributor

uklotzde commented Jul 15, 2020

@Holzhaus I think we should merge this PR before #2753 now that it is ready. It doesn't do any harm, build times are increased only slightly and the feature can easily be disabled.

@Holzhaus
Copy link
Member

Holzhaus commented Jul 15, 2020

@uklotzde okay, then go ahead

@uklotzde
Copy link
Contributor

LGTM

@uklotzde uklotzde merged commit edb49dd into mixxxdj:master Jul 15, 2020
@uklotzde
Copy link
Contributor

Our build servers are not affected until we enable this option. Should be safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants