initial commit
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
include(ExternalProject)
|
||||
include(FetchContent)
|
||||
|
||||
set(TARGET alsalib)
|
||||
|
||||
# If ALSA_INSTALL_PATH is set it should point to an externally provided ALSA installation.
|
||||
# Otherwise a default version will be built.
|
||||
if (ALSA_INSTALL_PATH)
|
||||
add_library(alsalib SHARED IMPORTED GLOBAL)
|
||||
set_target_properties(alsalib PROPERTIES
|
||||
IMPORTED_LOCATION ${ALSA_INSTALL_PATH}/lib/libasound.so
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${ALSA_INSTALL_PATH}/include
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(EP_TARGET ${TARGET}_source)
|
||||
|
||||
FetchContent_Declare(alsalib_download
|
||||
URL https://www.alsa-project.org/files/pub/lib/alsa-lib-1.0.29.tar.bz2
|
||||
)
|
||||
|
||||
FetchContent_GetProperties(alsalib_download)
|
||||
if (NOT alsalib_download_POPULATED)
|
||||
FetchContent_Populate(alsalib_download)
|
||||
endif()
|
||||
|
||||
set(EP_INSTALL_DIR ${alsalib_download_SOURCE_DIR}/staging)
|
||||
|
||||
ExternalProject_Add(alsalib_build
|
||||
SOURCE_DIR ${alsalib_download_SOURCE_DIR}
|
||||
BINARY_DIR ${alsalib_download_BINARY_DIR}
|
||||
|
||||
CONFIGURE_COMMAND ""
|
||||
|
||||
BUILD_COMMAND CC=${CMAKE_C_COMPILER} ${alsalib_download_SOURCE_DIR}/configure --prefix=${EP_INSTALL_DIR} --host=${TOOLCHAIN_TARGET} --disable-python
|
||||
|
||||
COMMAND make
|
||||
)
|
||||
|
||||
# CMake known bug - INTERFACE_INCLUDE_DIRECTORIES requires dir to exist at config stage
|
||||
file(MAKE_DIRECTORY ${EP_INSTALL_DIR}/include)
|
||||
|
||||
add_library(${TARGET} SHARED IMPORTED GLOBAL)
|
||||
set_target_properties(${TARGET} PROPERTIES
|
||||
IMPORTED_LOCATION ${EP_INSTALL_DIR}/lib/libasound.so
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${EP_INSTALL_DIR}/include
|
||||
)
|
||||
add_dependencies(${TARGET} ${EP_TARGET})
|
||||
|
||||
Reference in New Issue
Block a user