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

42 lines
1.7 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}")
2022-06-25 21:30:08 +00:00
install(TARGETS media-layer-core-real EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}")
# Create Alias Target For Linking
add_library(media-layer-core ALIAS media-layer-core-real)
2022-06-25 21:30:08 +00:00
set_target_properties(media-layer-core-real PROPERTIES EXPORT_NAME media-layer-core)
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
2022-06-25 21:30:08 +00:00
target_link_libraries(media-layer-core-real PUBLIC media-layer-headers PUBLIC reborn-util PUBLIC pthread PUBLIC dl)
2021-08-27 02:52:18 +00:00
if(NOT MCPI_HEADLESS_MODE)
2021-09-12 03:18:12 +00:00
# OpenAL
find_library(OPENAL_LIBRARY NAMES openal REQUIRED)
# Link
2022-06-25 21:30:08 +00:00
target_link_libraries(media-layer-core-real PRIVATE png12_static PRIVATE "${OPENAL_LIBRARY}" PRIVATE m PUBLIC GLESv1_CM PRIVATE 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()