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

CMake: Create and install EXPORTED configuration #118

Merged
merged 11 commits into from
Apr 18, 2021
Merged

CMake: Create and install EXPORTED configuration #118

merged 11 commits into from
Apr 18, 2021

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Apr 16, 2021

This PR changes the build system in several ways:

  1. The CMake Project is renamed to "OpenShotAudio", which better conforms to CMake naming conventions. (The openshot-audio library target name and libopenshot-audio library name are unchanged, internally.)
  2. The main installed header file has been renamed from JuceHeader.h to OpenShotAudio.h. A copy (or symlink, depending on CMake version and OS capabilities) under the old name is still installed for compatibility, but should be considered legacy. Any references to JuceHeader.h in downstream code (including libopenshot) should be changed to OpenShotAudio.h at the earliest convenience.
  3. The build now creates a standard CMake EXPORTED configuration which defines all relevant parameters for the build output, both in the build tree and in any subsequent install tree. This makes the FindOpenShotAudio.cmake file in libopenshot's build unnecessary, and represents a more complete and robust method of establishing a dependency relationship with library consumers. All of the information needed to build projects that link with libopenshot-audio are written to the new OpenShotAudio-Config.cmake and OpenShotAudioTargets.cmake output files.
  4. Externally, in keeping with CMake conventions, the library target is EXPORTED as OpenShot::Audio, and should be referred to that way by consumers:
    find_package(OpenShotAudio)
    target_link_libraries(openshot PUBLIC OpenShot::Audio)
  5. ASIO SDK discovery on Windows platforms is moved from inline code to a FindASIO.cmake module, which is also included in the EXPORTED configuration for use by downstream library consumers.
  6. The simple openshot-audio-test-sound program has been renamed to openshot-audio-demo, and is completely rewritten in a more modern code style, making better use of C++11 STL classes and idioms.
    The function of the tool has also been enhanced to make better use of the JUCE capabilities required by libopenshot: A list of all discovered audio devices present on the system is first generated and displayed, before a test tone plays on the default output. (Actually, 5 test tones, precisely 2 seconds apart. deviceManager.playTestSound() in recent JUCE releases triggers only a brief "beep" on each call, rather than playing a continuous tone, so I took the opportunity to demonstrate std::this_thread::sleep_until and the std::chrono timer classes.)
    The binary's configuration is also included in the EXPORTED data, and may be referenced downstream as the OpenShot::openshot-audio-demo target.

@ferdnyc ferdnyc added enhancement build Issues related to compiling or installing libopenshot-audio and its dependencies labels Apr 16, 2021
cmake/Modules/FindASIO.cmake Outdated Show resolved Hide resolved
@ferdnyc
Copy link
Contributor Author

ferdnyc commented Apr 18, 2021

Merging this, as it's needed to get builds back on track. It should be fully backwards-compatible with older configs, anyway. (The FindOpenShotAudio.cmake module will still work to discover it...)

@ferdnyc ferdnyc merged commit a86c0ec into develop Apr 18, 2021
@ferdnyc ferdnyc deleted the exported branch April 18, 2021 22:48
@ferdnyc ferdnyc mentioned this pull request Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues related to compiling or installing libopenshot-audio and its dependencies enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant