minecraft-pi-docker/media-layer/core/CMakeLists.txt

42 lines
1.6 KiB
CMake
Raw Normal View History

2021-06-17 21:32:24 +00:00
project(media-layer-core)
# Configuration
set(CORE_SRC src/base.cpp src/media.c src/screenshot.c) # SDL Re-Implementation Using GLFW
2021-09-12 03:18:12 +00:00
if(NOT MCPI_HEADLESS_MODE)
list(APPEND CORE_SRC src/audio/api.cpp src/audio/engine.c src/audio/file.cpp)
endif()
2021-06-17 21:32:24 +00:00
# Build
if(MCPI_USE_MEDIA_LAYER_PROXY AND BUILD_NATIVE_COMPONENTS)
# Build Media Layer Core Natively And Use Proxy
add_library(media-layer-core-real OBJECT ${CORE_SRC}) # Dependencies Are Setup Later
endif()
if(NOT MCPI_USE_MEDIA_LAYER_PROXY AND BUILD_ARM_COMPONENTS)
# Directly Link Media Layer Core To MCPI
add_library(media-layer-core-real SHARED ${CORE_SRC}) # Dependencies Are Setup Later
set_target_properties(media-layer-core-real PROPERTIES OUTPUT_NAME "media-layer-core")
2021-06-17 21:32:24 +00:00
# Install
install(TARGETS media-layer-core-real DESTINATION "${MCPI_LIB_DIR}")
# Create Alias Target For Linking
add_library(media-layer-core ALIAS media-layer-core-real)
2021-06-17 21:32:24 +00:00
endif()
# Configure Media Layer Core If Built
if(TARGET media-layer-core-real)
2021-06-17 21:32:24 +00:00
# Link
target_link_libraries(media-layer-core-real media-layer-headers reborn-util pthread dl)
2021-08-27 02:52:18 +00:00
if(NOT MCPI_HEADLESS_MODE)
2021-06-17 21:32:24 +00:00
# Find FreeImage
find_library(FREEIMAGE_LIBRARY NAMES freeimage libfreeimage.so.3 REQUIRED)
2021-09-12 03:18:12 +00:00
# OpenAL
find_library(OPENAL_LIBRARY NAMES openal REQUIRED)
# Link
target_link_libraries(media-layer-core-real "${FREEIMAGE_LIBRARY}" "${OPENAL_LIBRARY}" m GLESv1_CM glfw)
2021-06-17 21:32:24 +00:00
endif()
endif()
# Add Symlinks So MCPI Can Locate Libraries
if(BUILD_ARM_COMPONENTS)
install_symlink("libmedia-layer-core.so" "${MCPI_LIB_DIR}/libSDL-1.2.so.0")
endif()