summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.si>2022-12-27 21:00:06 +0100
committerTimotej Lazar <timotej.lazar@araneo.si>2022-12-27 21:00:51 +0100
commit3f92377c674da6c23916530ff58eb79c67c46861 (patch)
tree36d92782952b2dbbad9efeb0e1d70303b18b59e3
parenta753ae71723a97b1fa37d7d14a3ec2e09697a4fe (diff)
Use pkg-config to find libraries
-rw-r--r--CMakeFFmpegLibavMacros.cmake65
-rw-r--r--CMakeLists.txt67
-rw-r--r--FindLibAV.cmake86
-rw-r--r--FindOpenGLES2.cmake170
-rw-r--r--FindSDL2.cmake168
-rw-r--r--guix.scm3
6 files changed, 33 insertions, 526 deletions
diff --git a/CMakeFFmpegLibavMacros.cmake b/CMakeFFmpegLibavMacros.cmake
deleted file mode 100644
index 06105c6..0000000
--- a/CMakeFFmpegLibavMacros.cmake
+++ /dev/null
@@ -1,65 +0,0 @@
-#-------------------------------------------------------------------
-# FindFFmpeg.cmake and FindLibAV.cmake are dependent on this file.
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file
-#
-#-------------------------------------------------------------------
-
-### Macro: set_component_found
-#
-# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
-#
-macro(set_component_found _component )
- if(${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
- # message(STATUS " - ${_component} found.")
- set(${_component}_FOUND TRUE)
- else()
- # message(STATUS " - ${_component} not found.")
- endif()
-endmacro()
-
-#
-### Macro: find_component
-#
-# Finds each component's library file and include directory, and sets
-# *_LIBRARIES and *_INCLUDE_DIRS accordingly. Additionally detects each
-# component's version and sets *_VERSION_STRING.
-#
-macro(find_component _component _library _header _version)
- find_path(${_component}_INCLUDE_DIRS ${_header}
- PATH_SUFFIXES
- ffmpeg
- libav
- include
- )
-
- find_library(${_component}_LIBRARIES
- NAMES ${_library}
- PATH_SUFFIXES
- lib
- )
-
- if(${_component}_INCLUDE_DIRS AND EXISTS "${${_component}_INCLUDE_DIRS}/${_version}")
- file(STRINGS "${${_component}_INCLUDE_DIRS}/${_version}" ${_component}_VERSION_MAJOR_LINE REGEX "^#define[ \t]+LIB${_component}_VERSION_MAJOR[ \t]+[0-9]+$")
- file(STRINGS "${${_component}_INCLUDE_DIRS}/${_version}" ${_component}_VERSION_MINOR_LINE REGEX "^#define[ \t]+LIB${_component}_VERSION_MINOR[ \t]+[0-9]+$")
- file(STRINGS "${${_component}_INCLUDE_DIRS}/${_version}" ${_component}_VERSION_PATCH_LINE REGEX "^#define[ \t]+LIB${_component}_VERSION_MICRO[ \t]+[0-9]+$")
- string(REGEX REPLACE "^#define[ \t]+LIB${_component}_VERSION_MAJOR[ \t]+([0-9]+)$" "\\1" ${_component}_VERSION_MAJOR "${${_component}_VERSION_MAJOR_LINE}")
- string(REGEX REPLACE "^#define[ \t]+LIB${_component}_VERSION_MINOR[ \t]+([0-9]+)$" "\\1" ${_component}_VERSION_MINOR "${${_component}_VERSION_MINOR_LINE}")
- string(REGEX REPLACE "^#define[ \t]+LIB${_component}_VERSION_MICRO[ \t]+([0-9]+)$" "\\1" ${_component}_VERSION_PATCH "${${_component}_VERSION_PATCH_LINE}")
- set(${_component}_VERSION_STRING ${${_component}_VERSION_MAJOR}.${${_component}_VERSION_MINOR}.${${_component}_VERSION_PATCH})
- unset(${_component}_VERSION_MAJOR_LINE)
- unset(${_component}_VERSION_MINOR_LINE)
- unset(${_component}_VERSION_PATCH_LINE)
- unset(${_component}_VERSION_MAJOR)
- unset(${_component}_VERSION_MINOR)
- unset(${_component}_VERSION_PATCH)
- endif()
-
- find_package_handle_standard_args(${_component}
- REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS
- VERSION_VAR ${_component}_VERSION_STRING
- )
-
- set_component_found(${_component})
-endmacro()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3d89e8..78ce3ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,12 +43,17 @@ ENDIF(AVP_WEB)
# required dependencies
IF(NOT AVP_WEB)
- INCLUDE(FindOpenGLES2.cmake)
- INCLUDE(FindSDL2.cmake)
- INCLUDE(FindLibAV.cmake)
- INCLUDE(FindSDL)
- INCLUDE(FindOpenGL)
- INCLUDE(FindOpenAL)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(LIBAVCODEC REQUIRED libavcodec)
+ pkg_check_modules(LIBAVFORMAT REQUIRED libavformat)
+ pkg_check_modules(LIBAVUTIL REQUIRED libavutil)
+ pkg_check_modules(LIBSWSCALE REQUIRED libswscale)
+ pkg_check_modules(OPENAL REQUIRED openal)
+ pkg_check_modules(EGL egl)
+ pkg_check_modules(OPENGL gl)
+ pkg_check_modules(OPENGLES2 glesv2)
+ pkg_check_modules(SDL sdl>=1.2)
+ pkg_check_modules(SDL2 sdl2)
# Use SDL 1.2 if it is installed, else use SDL 2.0.
IF(NOT SDL_TYPE)
@@ -60,18 +65,6 @@ IF(NOT AVP_WEB)
MESSAGE(FATAL_ERROR "Invalid SDL_TYPE setting ${SDL_TYPE}; must be one of AUTO SDL SDL2")
ENDIF(NOT SDL_TYPE STREQUAL "AUTO" AND NOT SDL_TYPE STREQUAL "SDL" AND NOT SDL_TYPE STREQUAL "SDL2")
- IF(SDL_FOUND)
- IF(SDL_VERSION_STRING VERSION_LESS "1.2.0")
- MESSAGE(WARNING "SDL 1.2 was claimed to be found with version ${SDL_VERSION_STRING}, ignoring...")
- UNSET(SDL_FOUND)
- ENDIF(SDL_VERSION_STRING VERSION_LESS "1.2.0")
-
- IF(SDL_VERSION_STRING VERSION_GREATER "1.2.99")
- MESSAGE(WARNING "SDL 1.2 was claimed to be found with version ${SDL_VERSION_STRING}, ignoring...")
- UNSET(SDL_FOUND)
- ENDIF(SDL_VERSION_STRING VERSION_GREATER "1.2.99")
- ENDIF(SDL_FOUND)
-
IF(SDL_TYPE STREQUAL "AUTO")
IF(SDL_FOUND)
MESSAGE(STATUS "SDL 1.2 found; using that.")
@@ -145,11 +138,6 @@ IF(NOT AVP_WEB)
MESSAGE(FATAL_ERROR "OpenGL ES 2.0 support requires SDL2.")
ENDIF(NOT SDL_TYPE STREQUAL "SDL2")
ENDIF(OPENGL_TYPE STREQUAL "OPENGLES2")
-
- # OpenAL
- IF(NOT OPENAL_FOUND)
- MESSAGE(FATAL_ERROR "OpenAL is required but CMake couldn't find it.")
- ENDIF(NOT OPENAL_FOUND)
ENDIF(NOT AVP_WEB)
# required source files
@@ -429,46 +417,51 @@ IF(NOT AVP_WEB)
ENDIF(WIN32)
IF(SDL_TYPE STREQUAL "SDL")
- INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIRS})
ENDIF(SDL_TYPE STREQUAL "SDL")
IF(SDL_TYPE STREQUAL "SDL2")
- INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
ENDIF(SDL_TYPE STREQUAL "SDL2")
IF(OPENGL_TYPE STREQUAL "OPENGL")
- INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIRS})
ENDIF(OPENGL_TYPE STREQUAL "OPENGL")
IF(OPENGL_TYPE STREQUAL "OPENGLES2")
ADD_DEFINITIONS(-DUSE_OPENGL_ES=1)
- INCLUDE_DIRECTORIES(${OPENGLES2_INCLUDE_DIR})
- INCLUDE_DIRECTORIES(${EGL_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${OPENGLES2_INCLUDE_DIRS})
+ INCLUDE_DIRECTORIES(${EGL_INCLUDE_DIRS})
ENDIF(OPENGL_TYPE STREQUAL "OPENGLES2")
- INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
+ INCLUDE_DIRECTORIES(${LIBAVCODEC_INCLUDE_DIRS})
+ INCLUDE_DIRECTORIES(${LIBAVFORMAT_INCLUDE_DIRS})
+ INCLUDE_DIRECTORIES(${LIBAVUTIL_INCLUDE_DIRS})
+ INCLUDE_DIRECTORIES(${LIBSWSCALE_INCLUDE_DIRS})
+ INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIRS})
IF(SDL_TYPE STREQUAL "SDL")
- TARGET_LINK_LIBRARIES(avp ${SDL_LIBRARY})
+ TARGET_LINK_LIBRARIES(avp ${SDL_LIBRARIES})
ENDIF(SDL_TYPE STREQUAL "SDL")
IF(SDL_TYPE STREQUAL "SDL2")
- TARGET_LINK_LIBRARIES(avp ${SDL2_LIBRARY})
+ TARGET_LINK_LIBRARIES(avp ${SDL2_LIBRARIES})
ENDIF(SDL_TYPE STREQUAL "SDL2")
IF(OPENGL_TYPE STREQUAL "OPENGL")
- TARGET_LINK_LIBRARIES(avp ${OPENGL_gl_LIBRARY})
+ TARGET_LINK_LIBRARIES(avp ${OPENGL_LIBRARIES})
ENDIF(OPENGL_TYPE STREQUAL "OPENGL")
IF(OPENGL_TYPE STREQUAL "OPENGLES2")
- TARGET_LINK_LIBRARIES(avp ${OPENGLES2_gl_LIBRARY})
+ TARGET_LINK_LIBRARIES(avp ${OPENGLES2_LIBRARIES})
TARGET_LINK_LIBRARIES(avp ${EGL_LIBRARIES})
ENDIF(OPENGL_TYPE STREQUAL "OPENGLES2")
- TARGET_LINK_LIBRARIES(avp ${OPENAL_LIBRARY})
- TARGET_LINK_LIBRARIES(avp ${LIBAV_LIBRARIES})
- TARGET_LINK_LIBRARIES(avp ${SWSCALE_LIBRARIES})
- TARGET_LINK_LIBRARIES(avp ${AVCODEC_LIBRARIES})
+ TARGET_LINK_LIBRARIES(avp ${LIBAVCODEC_LIBRARIES})
+ TARGET_LINK_LIBRARIES(avp ${LIBAVFORMAT_LIBRARIES})
+ TARGET_LINK_LIBRARIES(avp ${LIBAVUTIL_LIBRARIES})
+ TARGET_LINK_LIBRARIES(avp ${LIBSWSCALE_LIBRARIES})
+ TARGET_LINK_LIBRARIES(avp ${OPENAL_LIBRARIES})
diff --git a/FindLibAV.cmake b/FindLibAV.cmake
deleted file mode 100644
index 84d0dbf..0000000
--- a/FindLibAV.cmake
+++ /dev/null
@@ -1,86 +0,0 @@
-# vim: ts=2 sw=2
-# - Try to find the required libav components(default: AVFORMAT, AVUTIL, AVCODEC)
-#
-# Once done this will define
-# LIBAV_FOUND - System has the all required components.
-# LIBAV_INCLUDE_DIRS - Include directory necessary for using the required components headers.
-# LIBAV_LIBRARIES - Link these to use the required libav components.
-#
-# For each of the components it will additionally set.
-# - AVCODEC
-# - AVDEVICE
-# - AVFILTER
-# - AVFORMAT
-# - AVRESAMPLE
-# - AVUTIL
-# - SWSCALE
-# the following variables will be defined
-# <component>_FOUND - System has <component>
-# <component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
-# <component>_LIBRARIES - Link these to use <component>
-# <component>_VERSION_STRING - The component's version
-#
-# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
-# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
-# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
-# Copyright (c) 2013,2015 Stephen Baker <baker.stephen.e@gmail.com>
-# Copyright (c) 2015, Alexander Bessman
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-include(FindPackageHandleStandardArgs)
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeFFmpegLibavMacros.cmake)
-
-# The default components were taken from a survey over other FindLIBAV.cmake files
-if(NOT LibAV_FIND_COMPONENTS)
- set(LibAV_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
-endif()
-
-# Check for cached results. If there are skip the costly part.
-if(NOT LIBAV_LIBRARIES)
-
- # Check for all possible component.
- find_component(AVCODEC avcodec libavcodec/avcodec.h libavcodec/version.h)
- find_component(AVFORMAT avformat libavformat/avformat.h libavformat/version.h)
- find_component(AVDEVICE avdevice libavdevice/avdevice.h libavdevice/version.h)
- find_component(AVFILTER avfilter libavfilter/avfilter.h libavfilter/version.h)
- find_component(AVUTIL avutil libavutil/avutil.h libavutil/version.h)
- find_component(SWSCALE swscale libswscale/swscale.h libswscale/version.h)
-
- # Check if the required components were found and add their stuff to the LIBAV_* vars.
- foreach(_component ${LibAV_FIND_COMPONENTS})
- if(${_component}_FOUND)
- # message(STATUS "Required component ${_component} present.")
- set(LIBAV_LIBRARIES ${LIBAV_LIBRARIES} ${${_component}_LIBRARIES})
- list(APPEND LIBAV_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
- else()
- # message(STATUS "Required component ${_component} missing.")
- endif()
- endforeach()
-
- # Build the include path with duplicates removed.
- if(LIBAV_INCLUDE_DIRS)
- list(REMOVE_DUPLICATES LIBAV_INCLUDE_DIRS)
- endif()
-
- # cache the vars.
- set(LIBAV_INCLUDE_DIRS ${LIBAV_INCLUDE_DIRS} CACHE STRING "The LibAV include directories." FORCE)
- set(LIBAV_LIBRARIES ${LIBAV_LIBRARIES} CACHE STRING "The LibAV libraries." FORCE)
-
- mark_as_advanced(LIBAV_INCLUDE_DIRS LIBAV_LIBRARIES)
-endif()
-
-# Now set the noncached _FOUND vars for the components.
-foreach(_component AVCODEC AVDEVICE AVFILTER AVFORMAT AVRESAMPLE AVUTIL SWSCALE)
- set_component_found(${_component})
-endforeach()
-
-# Compile the list of required vars
-set(_LibAV_REQUIRED_VARS LIBAV_LIBRARIES LIBAV_INCLUDE_DIRS)
-foreach(_component ${LibAV_FIND_COMPONENTS})
- list(APPEND _LibAV_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
-endforeach()
-
-# Give a nice error message if some of the required vars are missing.
-find_package_handle_standard_args(LibAV DEFAULT_MSG ${_LibAV_REQUIRED_VARS})
diff --git a/FindOpenGLES2.cmake b/FindOpenGLES2.cmake
deleted file mode 100644
index 136e761..0000000
--- a/FindOpenGLES2.cmake
+++ /dev/null
@@ -1,170 +0,0 @@
-#-------------------------------------------------------------------
-# This file is part of the CMake build system for OGRE
-# (Object-oriented Graphics Rendering Engine)
-# For the latest info, see http://www.ogre3d.org/
-#
-# The contents of this file are placed in the public domain. Feel
-# free to make use of it in any way you like.
-#-------------------------------------------------------------------
-
-# - Try to find OpenGLES and EGL
-# If using ARM Mali emulation you can specify the parent directory that contains the bin and include directories by
-# setting the MALI_SDK_ROOT variable in the environment.
-#
-# For AMD emulation use the AMD_SDK_ROOT variable
-#
-# Once done this will define
-#
-# OPENGLES2_FOUND - system has OpenGLES
-# OPENGLES2_INCLUDE_DIR - the GL include directory
-# OPENGLES2_LIBRARIES - Link these to use OpenGLES
-#
-# EGL_FOUND - system has EGL
-# EGL_INCLUDE_DIR - the EGL include directory
-# EGL_LIBRARIES - Link these to use EGL
-
-#include(FindPkgMacros)
-
-IF (WIN32)
- IF (CYGWIN)
-
- FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h )
-
- FIND_LIBRARY(OPENGLES2_gl_LIBRARY libGLESv2 )
-
- ELSE (CYGWIN)
-
- IF(BORLAND)
- SET (OPENGLES2_gl_LIBRARY import32 CACHE STRING "OpenGL ES 2.x library for win32")
- ELSE(BORLAND)
- #getenv_path(AMD_SDK_ROOT)
- #getenv_path(MALI_SDK_ROOT)
-
- SET(POWERVR_SDK_PATH "C:/Imagination/PowerVR/GraphicsSDK/SDK_3.1/Builds")
- FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
- ${ENV_AMD_SDK_ROOT}/include
- ${ENV_MALI_SDK_ROOT}/include
- ${POWERVR_SDK_PATH}/Include
- "C:/Imagination Technologies/PowerVR Insider SDK/OGLES2_WINDOWS_X86EMULATION_2.10/Builds/OGLES2/Include"
- )
-
- FIND_PATH(EGL_INCLUDE_DIR EGL/egl.h
- ${ENV_AMD_SDK_ROOT}/include
- ${ENV_MALI_SDK_ROOT}/include
- ${POWERVR_SDK_PATH}/Include
- "C:/Imagination Technologies/PowerVR Insider SDK/OGLES2_WINDOWS_X86EMULATION_2.10/Builds/OGLES2/Include"
- )
-
- FIND_LIBRARY(OPENGLES2_gl_LIBRARY
- NAMES libGLESv2
- PATHS ${ENV_AMD_SDK_ROOT}/x86
- ${ENV_MALI_SDK_ROOT}/bin
- ${POWERVR_SDK_PATH}/Windows/x86_32/Lib
- "C:/Imagination Technologies/PowerVR Insider SDK/OGLES2_WINDOWS_X86EMULATION_2.10/Builds/OGLES2/WindowsX86/Lib"
- )
-
- FIND_LIBRARY(EGL_egl_LIBRARY
- NAMES libEGL
- PATHS ${ENV_AMD_SDK_ROOT}/x86
- ${ENV_MALI_SDK_ROOT}/bin
- ${POWERVR_SDK_PATH}/Windows/x86_32/Lib
- "C:/Imagination Technologies/PowerVR Insider SDK/OGLES2_WINDOWS_X86EMULATION_2.10/Builds/OGLES2/WindowsX86/Lib"
- )
- ENDIF(BORLAND)
-
- ENDIF (CYGWIN)
-
-ELSE (WIN32)
-
- IF (APPLE)
-
- #create_search_paths(/Developer/Platforms)
- #findpkg_framework(OpenGLES2)
- #set(OPENGLES2_gl_LIBRARY "-framework OpenGLES")
-
- ELSE(APPLE)
- #getenv_path(AMD_SDK_ROOT)
- #getenv_path(MALI_SDK_ROOT)
-
- FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
- ${ENV_AMD_SDK_ROOT}/include
- ${ENV_MALI_SDK_ROOT}/include
- /opt/Imagination/PowerVR/GraphicsSDK/SDK_3.1/Builds/Include
- /opt/vc/include
- /usr/openwin/share/include
- /opt/graphics/OpenGL/include /usr/X11R6/include
- /usr/include
- )
-
- FIND_LIBRARY(OPENGLES2_gl_LIBRARY
- NAMES GLESv2
- PATHS ${ENV_AMD_SDK_ROOT}/x86
- ${ENV_MALI_SDK_ROOT}/bin
- /opt/Imagination/PowerVR/GraphicsSDK/SDK_3.1/Builds/Linux/x86_32/Lib
- /opt/vc/lib
- /opt/graphics/OpenGL/lib
- /usr/openwin/lib
- /usr/shlib /usr/X11R6/lib
- /usr/lib
- )
-
- FIND_PATH(EGL_INCLUDE_DIR EGL/egl.h
- ${ENV_AMD_SDK_ROOT}/include
- ${ENV_MALI_SDK_ROOT}/include
- /opt/Imagination/PowerVR/GraphicsSDK/SDK_3.1/Builds/Include
- /opt/vc/include
- /usr/openwin/share/include
- /opt/graphics/OpenGL/include /usr/X11R6/include
- /usr/include
- )
-
- FIND_LIBRARY(EGL_egl_LIBRARY
- NAMES EGL
- PATHS ${ENV_AMD_SDK_ROOT}/x86
- ${ENV_MALI_SDK_ROOT}/bin
- /opt/Imagination/PowerVR/GraphicsSDK/SDK_3.1/Builds/Linux/x86_32/Lib
- /opt/vc/lib
- /opt/graphics/OpenGL/lib
- /usr/openwin/lib
- /usr/shlib /usr/X11R6/lib
- /usr/lib
- )
-
- # On Unix OpenGL most certainly always requires X11.
- # Feel free to tighten up these conditions if you don't
- # think this is always true.
- # It's not true on OSX.
-
- #IF (OPENGLES2_gl_LIBRARY)
- # IF(NOT X11_FOUND)
- # INCLUDE(FindX11)
- # ENDIF(NOT X11_FOUND)
- # IF (X11_FOUND)
- # IF (NOT APPLE)
- # SET (OPENGLES2_LIBRARIES ${X11_LIBRARIES})
- # ENDIF (NOT APPLE)
- # ENDIF (X11_FOUND)
- #ENDIF (OPENGLES2_gl_LIBRARY)
-
- ENDIF(APPLE)
-ENDIF (WIN32)
-
-SET( OPENGLES2_FOUND "YES" )
-IF(OPENGLES2_gl_LIBRARY AND EGL_egl_LIBRARY)
-
- SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES})
- SET( EGL_LIBRARIES ${EGL_egl_LIBRARY} ${EGL_LIBRARIES})
- SET( OPENGLES2_FOUND "YES" )
-
-ENDIF(OPENGLES2_gl_LIBRARY AND EGL_egl_LIBRARY)
-
-MARK_AS_ADVANCED(
- OPENGLES2_INCLUDE_DIR
- OPENGLES2_gl_LIBRARY
- EGL_INCLUDE_DIR
- EGL_egl_LIBRARY
-)
-
-INCLUDE(FindPackageHandleStandardArgs)
-
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENGLES2 REQUIRED_VARS OPENGLES2_LIBRARIES OPENGLES2_INCLUDE_DIR)
diff --git a/FindSDL2.cmake b/FindSDL2.cmake
deleted file mode 100644
index 4e6dab1..0000000
--- a/FindSDL2.cmake
+++ /dev/null
@@ -1,168 +0,0 @@
-# Locate SDL2 library
-# This module defines
-# SDL2_LIBRARY, the name of the library to link against
-# SDL2_FOUND, if false, do not try to link to SDL2
-# SDL2_INCLUDE_DIR, where to find SDL.h
-#
-# This module responds to the the flag:
-# SDL2_BUILDING_LIBRARY
-# If this is defined, then no SDL2main will be linked in because
-# only applications need main().
-# Otherwise, it is assumed you are building an application and this
-# module will attempt to locate and set the the proper link flags
-# as part of the returned SDL2_LIBRARY variable.
-#
-# Don't forget to include SDLmain.h and SDLmain.m your project for the
-# OS X framework based version. (Other versions link to -lSDL2main which
-# this module will try to find on your behalf.) Also for OS X, this
-# module will automatically add the -framework Cocoa on your behalf.
-#
-#
-# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
-# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
-# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
-# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
-# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
-# as appropriate. These values are used to generate the final SDL2_LIBRARY
-# variable, but when these values are unset, SDL2_LIBRARY does not get created.
-#
-#
-# $SDL2DIR is an environment variable that would
-# correspond to the ./configure --prefix=$SDL2DIR
-# used in building SDL2.
-# l.e.galup 9-20-02
-#
-# Modified by Eric Wing.
-# Added code to assist with automated building by using environmental variables
-# and providing a more controlled/consistent search behavior.
-# Added new modifications to recognize OS X frameworks and
-# additional Unix paths (FreeBSD, etc).
-# Also corrected the header search path to follow "proper" SDL guidelines.
-# Added a search for SDL2main which is needed by some platforms.
-# Added a search for threads which is needed by some platforms.
-# Added needed compile switches for MinGW.
-#
-# On OSX, this will prefer the Framework version (if found) over others.
-# People will have to manually change the cache values of
-# SDL2_LIBRARY to override this selection or set the CMake environment
-# CMAKE_INCLUDE_PATH to modify the search paths.
-#
-# Note that the header path has changed from SDL2/SDL.h to just SDL.h
-# This needed to change because "proper" SDL convention
-# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
-# reasons because not all systems place things in SDL2/ (see FreeBSD).
-
-#=============================================================================
-# Copyright 2003-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-SET(SDL2_SEARCH_PATHS
- ~/Library/Frameworks
- /Library/Frameworks
- /usr/local
- /usr
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
-)
-
-FIND_PATH(SDL2_INCLUDE_DIR
- NAMES
- SDL_gesture.h # A SDL2-only header
- HINTS
- $ENV{SDL2DIR}
- PATH_SUFFIXES
- include/SDL2
- include
- PATHS
- ${SDL2_SEARCH_PATHS}
-)
-
-FIND_LIBRARY(SDL2_LIBRARY_TEMP
- NAMES SDL2
- HINTS
- $ENV{SDL2DIR}
- PATH_SUFFIXES lib64 lib
- PATHS ${SDL2_SEARCH_PATHS}
-)
-
-IF(NOT SDL2_BUILDING_LIBRARY)
- IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
- # Non-OS X framework versions expect you to also dynamically link to
- # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
- # seem to provide SDL2main for compatibility even though they don't
- # necessarily need it.
- FIND_LIBRARY(SDL2MAIN_LIBRARY
- NAMES SDL2main
- HINTS
- $ENV{SDL2DIR}
- PATH_SUFFIXES lib64 lib
- PATHS ${SDL2_SEARCH_PATHS}
- )
- ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
-ENDIF(NOT SDL2_BUILDING_LIBRARY)
-
-# SDL2 may require threads on your system.
-# The Apple build may not need an explicit flag because one of the
-# frameworks may already provide it.
-# But for non-OSX systems, I will use the CMake Threads package.
-IF(NOT APPLE)
- FIND_PACKAGE(Threads)
-ENDIF(NOT APPLE)
-
-# MinGW needs an additional library, mwindows
-# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
-# (Actually on second look, I think it only needs one of the m* libraries.)
-IF(MINGW)
- SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
-ENDIF(MINGW)
-
-IF(SDL2_LIBRARY_TEMP)
- # For SDL2main
- IF(NOT SDL2_BUILDING_LIBRARY)
- IF(SDL2MAIN_LIBRARY)
- SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
- ENDIF(SDL2MAIN_LIBRARY)
- ENDIF(NOT SDL2_BUILDING_LIBRARY)
-
- # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
- # CMake doesn't display the -framework Cocoa string in the UI even
- # though it actually is there if I modify a pre-used variable.
- # I think it has something to do with the CACHE STRING.
- # So I use a temporary variable until the end so I can set the
- # "real" variable in one-shot.
- IF(APPLE)
- SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
- ENDIF(APPLE)
-
- # For threads, as mentioned Apple doesn't need this.
- # In fact, there seems to be a problem if I used the Threads package
- # and try using this line, so I'm just skipping it entirely for OS X.
- IF(NOT APPLE)
- SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
- ENDIF(NOT APPLE)
-
- # For MinGW library
- IF(MINGW)
- SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
- ENDIF(MINGW)
-
- # Set the final string here so the GUI reflects the final state.
- SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
- # Set the temp variable to INTERNAL so it is not seen in the CMake GUI
- SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
-ENDIF(SDL2_LIBRARY_TEMP)
-
-INCLUDE(FindPackageHandleStandardArgs)
-
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
diff --git a/guix.scm b/guix.scm
index 3f7feb8..300e833 100644
--- a/guix.scm
+++ b/guix.scm
@@ -10,6 +10,7 @@
(use-modules
(gnu packages audio)
(gnu packages gl)
+ (gnu packages pkg-config)
(gnu packages sdl)
(gnu packages video)
(guix build-system cmake)
@@ -38,6 +39,8 @@
(list #:tests? #f))
(inputs
(list ffmpeg mesa openal sdl2))
+ (native-inputs
+ (list pkg-config))
(home-page "https://sr.ht/~jetomit/avp")
(synopsis "Aliens Versus Predator game engine")
(description "Unofficial Linux port of the game engine for the Rebellion