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

Fix discovery of Oboe #1394

Merged
merged 5 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .azure/azure-pipelines-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ variables:
GETTEXT_VERSION: '0.22.5'
GLIB_VERSION: '2.72'
GLIB_EXTRAVERSION: '4'
OBOE_VERSION: '1.7.0'
OBOE_VERSION: '1.9.0'
SNDFILE_VERSION: '1.2.2'
INSTPATCH_VERSION: '1.1.6'
VORBIS_VERSION: '1.3.7'
Expand Down
84 changes: 84 additions & 0 deletions cmake_admin/Findoboe.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#[=======================================================================[.rst:
Findoboe
-------

Finds the oboe library.

Imported Targets
^^^^^^^^^^^^^^^^

This module provides the following imported targets, if found:

``oboe::oboe``
The oboe library

Result Variables
^^^^^^^^^^^^^^^^

This will define the following variables:

``oboe_FOUND``
True if the system has the oboe library.

For compatibility with upstream, the following variables are also set:

``oboe_INCLUDE_DIR``
``oboe_INCLUDE_DIRS``
``oboe_LIBRARY``
``oboe_LIBRARIES``
``OBOE_INCLUDE_DIR``
``OBOE_INCLUDE_DIRS``
``OBOE_LIBRARY``
``OBOE_LIBRARIES``
``OBOE_FOUND``

#]=======================================================================]

# Use pkg-config if available
find_package(PkgConfig QUIET)
pkg_check_modules(PC_OBOE QUIET oboe-1.0)

# Find the headers and library
find_path(
oboe_INCLUDE_DIR
NAMES "oboe/Oboe.h"
HINTS "${PC_OBOE_INCLUDEDIR}")

find_library(
_oboe_library
NAMES "oboe"
HINTS "${PC_OBOE_LIBDIR}")

# Extract additional flags if pkg-config is available
if(PC_OBOE_FOUND)
get_target_properties_from_pkg_config("${_oboe_library}" "PC_OBOE" "_oboe")
endif()

# Forward the result to CMake
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(oboe REQUIRED_VARS "_oboe_library"
"oboe_INCLUDE_DIR")

# Create the target
if(oboe_FOUND AND NOT TARGET oboe::oboe)
add_library(oboe::oboe UNKNOWN IMPORTED)
set_target_properties(
oboe::oboe
PROPERTIES IMPORTED_LOCATION "${_oboe_library}"
INTERFACE_COMPILE_OPTIONS "${_oboe_compile_options}"
INTERFACE_INCLUDE_DIRECTORIES "${oboe_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${_oboe_link_libraries}"
INTERFACE_LINK_DIRECTORIES "${_oboe_link_directories}")

# Set additional variables for compatibility with upstream config
set(oboe_INCLUDE_DIRS "${oboe_INCLUDE_DIR}")
set(oboe_LIBRARY oboe::oboe)
set(oboe_LIBRARIES oboe::oboe)
set(OBOE_INCLUDE_DIR "${${oboe_INCLUDE_DIR}}")
set(OBOE_INCLUDE_DIRS "${${oboe_INCLUDE_DIR}}")
set(OBOE_LIBRARY oboe::oboe)
set(OBOE_LIBRARIES oboe::oboe)
set(OBOE_FOUND TRUE)
endif()

mark_as_advanced(_oboe_library)
Loading