Commit 782cdc12 authored by Tom Finegan's avatar Tom Finegan

Add aom.pc (pkg-config file) generation to CMake.

BUG=aomedia:76,aomedia:471

Change-Id: I7919e00d88ea448465dfb4c51b61a65a37b06060
parent e9d70c9b
......@@ -358,7 +358,6 @@ if (XCODE)
endif ()
# Aomedia install rule.
# TODO(tomfinegan): Add the missing pkg-config related bits.
set(AOM_INSTALL_INCS
"${AOM_ROOT}/aom/aom.h"
"${AOM_ROOT}/aom/aomcx.h"
......@@ -375,5 +374,7 @@ set(AOM_INSTALL_LIBS aom)
install(FILES ${AOM_INSTALL_INCS}
DESTINATION "${CMAKE_INSTALL_PREFIX}/include/aom")
install(FILES "${AOM_CONFIG_DIR}/aom.pc"
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig")
install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS ${AOM_INSTALL_BINS} DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
......@@ -334,3 +334,35 @@ execute_process(
COMMAND ${PERL_EXECUTABLE} "${AOM_ROOT}/build/cmake/aom_version.pl"
--version_data=${AOM_GIT_DESCRIPTION}
--version_filename=${AOM_CONFIG_DIR}/aom_version.h)
# Generate aom.pc (pkg-config file).
if (NOT MSVC)
# Extract the version string from aom_version.h
file(STRINGS "${AOM_CONFIG_DIR}/aom_version.h" aom_version
REGEX "VERSION_STRING_NOSP")
string(REPLACE "#define VERSION_STRING_NOSP \"v" "" aom_version
"${aom_version}")
string(REPLACE "\"" "" aom_version "${aom_version}")
# Write pkg-config info.
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(pkgconfig_file "${AOM_CONFIG_DIR}/aom.pc")
string(TOLOWER ${CMAKE_PROJECT_NAME} pkg_name)
file(WRITE "${pkgconfig_file}" "# libaom pkg-config.\n")
file(APPEND "${pkgconfig_file}" "prefix=${prefix}\n")
file(APPEND "${pkgconfig_file}" "exec_prefix=${prefix}/bin\n")
file(APPEND "${pkgconfig_file}" "libdir=${prefix}/lib\n")
file(APPEND "${pkgconfig_file}" "includedir=${prefix}/include\n\n")
file(APPEND "${pkgconfig_file}" "Name: ${pkg_name}\n")
file(APPEND "${pkgconfig_file}" "Description: AV1 codec library.\n")
file(APPEND "${pkgconfig_file}" "Version: ${aom_version}\n")
file(APPEND "${pkgconfig_file}" "Requires:\n")
file(APPEND "${pkgconfig_file}" "Conflicts:\n")
file(APPEND "${pkgconfig_file}" "Libs: -L${prefix}/lib -l${pkg_name} -lm\n")
if (CONFIG_MULTITHREAD AND HAVE_PTHREAD_H)
file(APPEND "${pkgconfig_file}" "Libs.private: -lm -lpthread\n")
else ()
file(APPEND "${pkgconfig_file}" "Libs.private: -lm\n")
endif ()
file(APPEND "${pkgconfig_file}" "Cflags: -I${prefix}/include\n")
endif ()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment