shithub: opusfile

Download patch

ref: 856efa69c5ef58e9cea8b70414569202dd86ce3d
parent: 81abcb7d7a4f48169556f9dc74c71a78ecad0c70
author: Hendrik <git@h3ndrk.de>
date: Sun Jun 6 06:50:20 EDT 2021

Change case of namespace

Signed-off-by: Ralph Giles <giles@thaumas.net>
Signed-off-by: evpobr <evpobr@gmail.com>

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,13 +2,13 @@
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
 
-include(opusfilePackageVersion)
+include(OpusFilePackageVersion)
 get_package_version(PACKAGE_VERSION PROJECT_VERSION)
 string(REPLACE "." ";" PROJECT_VERSION_LIST ${PROJECT_VERSION})
 list(GET PROJECT_VERSION_LIST 0 PROJECT_VERSION_MAJOR)
 list(GET PROJECT_VERSION_LIST 1 PROJECT_VERSION_MINOR)
 
-project(opusfile
+project(OpusFile
   VERSION ${PROJECT_VERSION}
   LANGUAGES C
 )
@@ -44,7 +44,7 @@
   "${CMAKE_CURRENT_SOURCE_DIR}/src/opusfile.c"
   "${CMAKE_CURRENT_SOURCE_DIR}/src/stream.c"
 )
-add_library(opusfile::opusfile ALIAS opusfile)
+add_library(OpusFile::opusfile ALIAS opusfile)
 set_target_properties(opusfile PROPERTIES
   PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/opusfile.h"
   VERSION ${PROJECT_VERSION}
@@ -84,7 +84,7 @@
     $<$<BOOL:${OP_HAVE_LRINTF}>:OP_HAVE_LRINTF>
 )
 install(TARGETS opusfile
-  EXPORT opusfileTargets
+  EXPORT OpusFileTargets
   RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
   LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
   ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
@@ -127,7 +127,7 @@
     "${CMAKE_CURRENT_SOURCE_DIR}/src/internal.c"
     "${CMAKE_CURRENT_SOURCE_DIR}/src/internal.h"
   )
-  add_library(opusfile::opusurl ALIAS opusurl)
+  add_library(OpusFile::opusurl ALIAS opusurl)
   if(WIN32)
     target_sources(opusurl PRIVATE
       "${CMAKE_CURRENT_SOURCE_DIR}/src/wincerts.c"
@@ -178,7 +178,7 @@
       $<$<C_COMPILER_ID:Clang,GNU>:-fvisibility=hidden>
   )
   install(TARGETS opusurl
-    EXPORT opusfileTargets
+    EXPORT OpusFileTargets
     RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
     LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
     ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
@@ -191,7 +191,7 @@
   add_executable(opusfile_example
     "${CMAKE_CURRENT_SOURCE_DIR}/examples/opusfile_example.c"
   )
-  add_executable(opusfile::opusfile_example ALIAS opusfile_example)
+  add_executable(OpusFile::opusfile_example ALIAS opusfile_example)
   if(WIN32)
     target_sources(opusfile_example PRIVATE
       "${CMAKE_CURRENT_SOURCE_DIR}/examples/win32utf8.c"
@@ -224,7 +224,7 @@
   add_executable(seeking_example
     "${CMAKE_CURRENT_SOURCE_DIR}/examples/seeking_example.c"
   )
-  add_executable(opusfile::seeking_example ALIAS seeking_example)
+  add_executable(OpusFile::seeking_example ALIAS seeking_example)
   if(WIN32)
     target_sources(seeking_example PRIVATE
       "${CMAKE_CURRENT_SOURCE_DIR}/examples/win32utf8.c"
@@ -277,26 +277,26 @@
   doxygen_add_docs(doxygen "${CMAKE_CURRENT_SOURCE_DIR}/include/opusfile.h" ALL USE_STAMP_FILE)
 endif()
 
-install(EXPORT opusfileTargets
+install(EXPORT OpusFileTargets
   DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/opusfile"
-  NAMESPACE opusfile::
+  NAMESPACE OpusFile::
 )
 include(CMakePackageConfigHelpers)
 configure_package_config_file(
-  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/opusfileConfig.cmake.in"
-  "${CMAKE_CURRENT_BINARY_DIR}/opusfileConfig.cmake"
+  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/OpusFileConfig.cmake.in"
+  "${CMAKE_CURRENT_BINARY_DIR}/OpusFileConfig.cmake"
   INSTALL_DESTINATION
     "${CMAKE_INSTALL_LIBDIR}/cmake/opusfile"
 )
 write_basic_package_version_file(
-  "opusfileConfigVersion.cmake"
+  "OpusFileConfigVersion.cmake"
   VERSION "${PACKAGE_VERSION}"
   COMPATIBILITY AnyNewerVersion
 )
 install(
   FILES
-    "${CMAKE_CURRENT_BINARY_DIR}/opusfileConfig.cmake"
-    "${CMAKE_CURRENT_BINARY_DIR}/opusfileConfigVersion.cmake"
+    "${CMAKE_CURRENT_BINARY_DIR}/OpusFileConfig.cmake"
+    "${CMAKE_CURRENT_BINARY_DIR}/OpusFileConfigVersion.cmake"
   DESTINATION
     "${CMAKE_INSTALL_LIBDIR}/cmake/opusfile"
 )
--- /dev/null
+++ b/cmake/OpusFileConfig.cmake.in
@@ -1,0 +1,52 @@
+@PACKAGE_INIT@
+
+# Ported from CMakeFindDependencyMacro.cmake (finding configs and using pkgconfig as fallback)
+set(cmake_quiet_arg)
+if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
+  set(cmake_quiet_arg QUIET)
+endif()
+set(cmake_required_arg)
+if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
+  set(cmake_required_arg REQUIRED)
+endif()
+
+find_package(Ogg CONFIG ${cmake_quiet_arg})
+if(NOT TARGET Ogg::ogg)
+  find_package(PkgConfig REQUIRED ${cmake_quiet_arg})
+  pkg_check_modules(Ogg ${cmake_required_arg} ${cmake_quiet_arg} IMPORTED_TARGET ogg)
+  set_target_properties(PkgConfig::Ogg PROPERTIES IMPORTED_GLOBAL TRUE)
+  add_library(Ogg::ogg ALIAS PkgConfig::Ogg)
+endif()
+
+if (NOT TARGET Ogg::ogg)
+  set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency Ogg could not be found.")
+  set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
+  return()
+endif()
+
+find_package(Opus CONFIG ${cmake_quiet_arg})
+if(NOT TARGET Opus::opus)
+  find_package(PkgConfig REQUIRED ${cmake_quiet_arg})
+  pkg_check_modules(Opus ${cmake_required_arg} ${cmake_quiet_arg} IMPORTED_TARGET opus)
+  set_target_properties(PkgConfig::Opus PROPERTIES IMPORTED_GLOBAL TRUE)
+  add_library(Opus::opus ALIAS PkgConfig::Opus)
+endif()
+
+if (NOT TARGET Opus::opus)
+  set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency Opus could not be found.")
+  set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
+  return()
+endif()
+
+set(cmake_fd_required_arg)
+set(cmake_fd_quiet_arg)
+
+if (NOT @OP_DISABLE_HTTP@)
+  include(CMakeFindDependencyMacro)
+  find_dependency(OpenSSL)
+endif()
+
+# Including targets of opusfile
+include("${CMAKE_CURRENT_LIST_DIR}/opusfileTargets.cmake")
+
+check_required_components(opusfile)
--- /dev/null
+++ b/cmake/OpusFilePackageVersion.cmake
@@ -1,0 +1,70 @@
+if(__opusfile_version)
+  return()
+endif()
+set(__opusfile_version INCLUDED)
+
+function(get_package_version PACKAGE_VERSION PROJECT_VERSION)
+
+  find_package(Git)
+  if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
+    execute_process(COMMAND ${GIT_EXECUTABLE}
+                    --git-dir=${CMAKE_CURRENT_LIST_DIR}/.git describe
+                    --tags --match "v*" OUTPUT_VARIABLE OPUSFILE_PACKAGE_VERSION)
+    if(OPUSFILE_PACKAGE_VERSION)
+      string(STRIP ${OPUSFILE_PACKAGE_VERSION}, OPUSFILE_PACKAGE_VERSION)
+      string(REPLACE \n
+                     ""
+                     OPUSFILE_PACKAGE_VERSION
+                     ${OPUSFILE_PACKAGE_VERSION})
+      string(REPLACE ,
+                     ""
+                     OPUSFILE_PACKAGE_VERSION
+                     ${OPUSFILE_PACKAGE_VERSION})
+
+      string(SUBSTRING ${OPUSFILE_PACKAGE_VERSION}
+                       1
+                       -1
+                       OPUSFILE_PACKAGE_VERSION)
+      message(STATUS "Opus package version from git repo: ${OPUSFILE_PACKAGE_VERSION}")
+    endif()
+
+  elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/package_version"
+         AND NOT OPUSFILE_PACKAGE_VERSION)
+    # Not a git repo, lets' try to parse it from package_version file if exists
+    file(STRINGS package_version OPUSFILE_PACKAGE_VERSION
+         LIMIT_COUNT 1
+         REGEX "PACKAGE_VERSION=")
+    string(REPLACE "PACKAGE_VERSION="
+                   ""
+                   OPUSFILE_PACKAGE_VERSION
+                   ${OPUSFILE_PACKAGE_VERSION})
+    string(REPLACE "\""
+                   ""
+                   OPUSFILE_PACKAGE_VERSION
+                   ${OPUSFILE_PACKAGE_VERSION})
+    # In case we have a unknown dist here we just replace it with 0
+    string(REPLACE "unknown"
+                   "0"
+                   OPUSFILE_PACKAGE_VERSION
+                   ${OPUSFILE_PACKAGE_VERSION})
+      message(STATUS "Opus package version from package_version file: ${OPUSFILE_PACKAGE_VERSION}")
+  endif()
+
+  if(OPUSFILE_PACKAGE_VERSION)
+    string(REGEX
+      REPLACE "^([0-9]+.[0-9]+\\.?([0-9]+)?).*"
+               "\\1"
+               OPUSFILE_PROJECT_VERSION
+               ${OPUSFILE_PACKAGE_VERSION})
+  else()
+    # fail to parse version from git and package version
+    message(WARNING "Could not get package version.")
+    set(OPUSFILE_PACKAGE_VERSION 0)
+    set(OPUSFILE_PROJECT_VERSION 0)
+  endif()
+
+  message(STATUS "Opus project version: ${OPUSFILE_PROJECT_VERSION}")
+
+  set(PACKAGE_VERSION ${OPUSFILE_PACKAGE_VERSION} PARENT_SCOPE)
+  set(PROJECT_VERSION ${OPUSFILE_PROJECT_VERSION} PARENT_SCOPE)
+endfunction()
--- a/cmake/opusfileConfig.cmake.in
+++ /dev/null
@@ -1,52 +1,0 @@
-@PACKAGE_INIT@
-
-# Ported from CMakeFindDependencyMacro.cmake (finding configs and using pkgconfig as fallback)
-set(cmake_quiet_arg)
-if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
-  set(cmake_quiet_arg QUIET)
-endif()
-set(cmake_required_arg)
-if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
-  set(cmake_required_arg REQUIRED)
-endif()
-
-find_package(Ogg CONFIG ${cmake_quiet_arg})
-if(NOT TARGET Ogg::ogg)
-  find_package(PkgConfig REQUIRED ${cmake_quiet_arg})
-  pkg_check_modules(Ogg ${cmake_required_arg} ${cmake_quiet_arg} IMPORTED_TARGET ogg)
-  set_target_properties(PkgConfig::Ogg PROPERTIES IMPORTED_GLOBAL TRUE)
-  add_library(Ogg::ogg ALIAS PkgConfig::Ogg)
-endif()
-
-if (NOT TARGET Ogg::ogg)
-  set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency Ogg could not be found.")
-  set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
-  return()
-endif()
-
-find_package(Opus CONFIG ${cmake_quiet_arg})
-if(NOT TARGET Opus::opus)
-  find_package(PkgConfig REQUIRED ${cmake_quiet_arg})
-  pkg_check_modules(Opus ${cmake_required_arg} ${cmake_quiet_arg} IMPORTED_TARGET opus)
-  set_target_properties(PkgConfig::Opus PROPERTIES IMPORTED_GLOBAL TRUE)
-  add_library(Opus::opus ALIAS PkgConfig::Opus)
-endif()
-
-if (NOT TARGET Opus::opus)
-  set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency Opus could not be found.")
-  set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
-  return()
-endif()
-
-set(cmake_fd_required_arg)
-set(cmake_fd_quiet_arg)
-
-if (NOT @OP_DISABLE_HTTP@)
-  include(CMakeFindDependencyMacro)
-  find_dependency(OpenSSL)
-endif()
-
-# Including targets of opusfile
-include("${CMAKE_CURRENT_LIST_DIR}/opusfileTargets.cmake")
-
-check_required_components(opusfile)
--- a/cmake/opusfilePackageVersion.cmake
+++ /dev/null
@@ -1,70 +1,0 @@
-if(__opusfile_version)
-  return()
-endif()
-set(__opusfile_version INCLUDED)
-
-function(get_package_version PACKAGE_VERSION PROJECT_VERSION)
-
-  find_package(Git)
-  if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
-    execute_process(COMMAND ${GIT_EXECUTABLE}
-                    --git-dir=${CMAKE_CURRENT_LIST_DIR}/.git describe
-                    --tags --match "v*" OUTPUT_VARIABLE OPUSFILE_PACKAGE_VERSION)
-    if(OPUSFILE_PACKAGE_VERSION)
-      string(STRIP ${OPUSFILE_PACKAGE_VERSION}, OPUSFILE_PACKAGE_VERSION)
-      string(REPLACE \n
-                     ""
-                     OPUSFILE_PACKAGE_VERSION
-                     ${OPUSFILE_PACKAGE_VERSION})
-      string(REPLACE ,
-                     ""
-                     OPUSFILE_PACKAGE_VERSION
-                     ${OPUSFILE_PACKAGE_VERSION})
-
-      string(SUBSTRING ${OPUSFILE_PACKAGE_VERSION}
-                       1
-                       -1
-                       OPUSFILE_PACKAGE_VERSION)
-      message(STATUS "Opus package version from git repo: ${OPUSFILE_PACKAGE_VERSION}")
-    endif()
-
-  elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/package_version"
-         AND NOT OPUSFILE_PACKAGE_VERSION)
-    # Not a git repo, lets' try to parse it from package_version file if exists
-    file(STRINGS package_version OPUSFILE_PACKAGE_VERSION
-         LIMIT_COUNT 1
-         REGEX "PACKAGE_VERSION=")
-    string(REPLACE "PACKAGE_VERSION="
-                   ""
-                   OPUSFILE_PACKAGE_VERSION
-                   ${OPUSFILE_PACKAGE_VERSION})
-    string(REPLACE "\""
-                   ""
-                   OPUSFILE_PACKAGE_VERSION
-                   ${OPUSFILE_PACKAGE_VERSION})
-    # In case we have a unknown dist here we just replace it with 0
-    string(REPLACE "unknown"
-                   "0"
-                   OPUSFILE_PACKAGE_VERSION
-                   ${OPUSFILE_PACKAGE_VERSION})
-      message(STATUS "Opus package version from package_version file: ${OPUSFILE_PACKAGE_VERSION}")
-  endif()
-
-  if(OPUSFILE_PACKAGE_VERSION)
-    string(REGEX
-      REPLACE "^([0-9]+.[0-9]+\\.?([0-9]+)?).*"
-               "\\1"
-               OPUSFILE_PROJECT_VERSION
-               ${OPUSFILE_PACKAGE_VERSION})
-  else()
-    # fail to parse version from git and package version
-    message(WARNING "Could not get package version.")
-    set(OPUSFILE_PACKAGE_VERSION 0)
-    set(OPUSFILE_PROJECT_VERSION 0)
-  endif()
-
-  message(STATUS "Opus project version: ${OPUSFILE_PROJECT_VERSION}")
-
-  set(PACKAGE_VERSION ${OPUSFILE_PACKAGE_VERSION} PARENT_SCOPE)
-  set(PROJECT_VERSION ${OPUSFILE_PROJECT_VERSION} PARENT_SCOPE)
-endfunction()