minecraft-pi-reborn/libreborn/CMakeLists.txt

60 lines
2.0 KiB
CMake
Raw Normal View History

2021-01-27 21:26:19 +00:00
project(libreborn)
2022-06-10 01:31:40 +00:00
# Config
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/libreborn")
configure_file(include/libreborn/config.h.in "${CMAKE_CURRENT_BINARY_DIR}/include/libreborn/config.h" ESCAPE_QUOTES @ONLY)
# Util
add_library(reborn-util SHARED
src/util/exec.c
src/util/string.c
src/util/util.c
src/util/log.c
src/util/cp437.cpp
src/util/env.c
)
2022-06-25 21:30:08 +00:00
target_include_directories(
reborn-util
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
"$<INSTALL_INTERFACE:${MCPI_SDK_INCLUDE_DIR}/libreborn>"
)
2023-11-11 06:33:19 +00:00
target_link_libraries(reborn-util PRIVATE utf8cpp)
2022-07-02 22:14:23 +00:00
# Install
install(TARGETS reborn-util DESTINATION "${MCPI_LIB_DIR}")
# SDK
if(BUILD_ARM_COMPONENTS)
install(TARGETS reborn-util EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}")
install(DIRECTORY "include/" DESTINATION "${MCPI_SDK_INCLUDE_DIR}/libreborn")
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/" DESTINATION "${MCPI_SDK_INCLUDE_DIR}/libreborn")
endif()
2021-01-27 21:26:19 +00:00
2022-06-10 01:31:40 +00:00
# Patch
2021-06-17 21:32:24 +00:00
if(BUILD_ARM_COMPONENTS)
add_library(reborn-patch SHARED
src/patch/patch.cpp
src/patch/segments.cpp
src/patch/code-block.cpp
src/patch/instruction.cpp
)
2022-05-14 02:36:12 +00:00
target_link_libraries(reborn-patch dl pthread reborn-util)
2022-03-14 23:09:25 +00:00
target_compile_definitions(reborn-patch PUBLIC -DREBORN_HAS_PATCH_CODE)
2021-06-17 21:32:24 +00:00
# Install
2022-03-14 23:09:25 +00:00
install(TARGETS reborn-patch DESTINATION "${MCPI_LIB_DIR}")
2022-06-25 21:30:08 +00:00
# SDK
install(TARGETS reborn-patch EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}")
2021-06-17 21:32:24 +00:00
endif()
2023-11-11 05:44:26 +00:00
2024-06-04 22:29:13 +00:00
# Fake LibPNG To Satisfy Symbol Versioning Requirement
2023-11-11 05:44:26 +00:00
if(BUILD_ARM_COMPONENTS)
2024-01-16 08:08:34 +00:00
add_library(fake-libpng SHARED src/fake-libpng/empty.c)
2023-11-11 05:44:26 +00:00
set_target_properties(fake-libpng PROPERTIES
OUTPUT_NAME "png12"
SOVERSION 0
)
2024-06-04 22:29:13 +00:00
target_link_options(fake-libpng PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/fake-libpng/empty.vers")
2023-11-11 05:44:26 +00:00
# Install
install(TARGETS fake-libpng DESTINATION "${MCPI_LIB_DIR}")
endif()