metaforce/extern/CMakeLists.txt

101 lines
4.1 KiB
CMake
Raw Normal View History

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/extern/sanitizers-cmake/cmake")
find_package(Sanitizers)
add_subdirectory(boo EXCLUDE_FROM_ALL)
option(BUILD_ATHENA "Build Athena libraries from source" ON)
if (WIN32 OR APPLE)
# Default to binary atdna on Windows & macOS
option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" OFF)
else ()
option(BUILD_ATDNA "Build atdna utility from source (requires LLVM)" ON)
endif ()
if (NOT BUILD_ATDNA)
set(ATHENA_BASE_URL "https://github.com/libAthena/athena/releases/download/latest")
if (WIN32)
set(ATHENA_EXT 7z)
else ()
set(ATHENA_EXT tar.gz)
endif ()
include(FetchContent)
FetchContent_Declare(athena-host
URL "${ATHENA_BASE_URL}/athena-${PLATFORM_NAME}-${ATHENA_HOST_ARCH}.${ATHENA_EXT}")
message(STATUS "Fetching atdna host binary")
FetchContent_Populate(athena-host)
include(${athena-host_SOURCE_DIR}/lib/cmake/atdna/atdnaConfig.cmake)
endif ()
if (BUILD_ATHENA OR BUILD_ATDNA)
add_subdirectory(athena EXCLUDE_FROM_ALL)
else ()
if (ATHENA_ARCH STREQUAL ATHENA_HOST_ARCH)
set(athena_SOURCE_DIR "${athena-host_SOURCE_DIR}")
else ()
FetchContent_Declare(athena
URL "${ATHENA_BASE_URL}/athena-${PLATFORM_NAME}-${ATHENA_ARCH}.tar.gz")
FetchContent_Populate(athena)
endif ()
include(${athena_SOURCE_DIR}/lib/cmake/athena/AthenaConfig.cmake)
include(${athena_SOURCE_DIR}/lib/cmake/lzokay/lzokayConfig.cmake)
add_library(lzokay ALIAS lzokay::lzokay)
include(athena/atdna/atdnaHelpers.cmake)
endif ()
# amuse must come after athena/atdna
add_subdirectory(amuse EXCLUDE_FROM_ALL)
if (NOT GEKKO AND NOT NX)
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/discord-rpc)
if (NOT CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/fake-prefix)
endif ()
add_subdirectory(discord-rpc/src EXCLUDE_FROM_ALL)
target_include_directories(discord-rpc PRIVATE rapidjson/include PUBLIC discord-rpc/include)
if (APPLE)
# remove their nasty hack
get_target_property(DISCORD_LINK_LIBRARIES discord-rpc INTERFACE_LINK_LIBRARIES)
list(REMOVE_ITEM DISCORD_LINK_LIBRARIES "-framework AppKit, -mmacosx-version-min=10.10")
set_target_properties(discord-rpc PROPERTIES INTERFACE_LINK_LIBRARIES "${DISCORD_LINK_LIBRARIES}")
endif ()
if (UNIX)
# remove another nasty hack
get_target_property(DISCORD_COMPILE_OPTIONS discord-rpc COMPILE_OPTIONS)
list(REMOVE_ITEM DISCORD_COMPILE_OPTIONS "-g")
set_target_properties(discord-rpc PROPERTIES COMPILE_OPTIONS "${DISCORD_COMPILE_OPTIONS}")
endif ()
endif ()
add_subdirectory(jbus EXCLUDE_FROM_ALL)
add_subdirectory(kabufuda EXCLUDE_FROM_ALL)
add_subdirectory(libpng EXCLUDE_FROM_ALL)
add_subdirectory(libSquish EXCLUDE_FROM_ALL)
add_library(nativefiledialog STATIC EXCLUDE_FROM_ALL nativefiledialog/src/nfd_common.c)
target_include_directories(nativefiledialog PUBLIC nativefiledialog/src/include)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_sources(nativefiledialog PRIVATE nativefiledialog/src/nfd_gtk.c)
target_compile_definitions(nativefiledialog INTERFACE NATIVEFILEDIALOG_SUPPORTED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
target_link_libraries(nativefiledialog PRIVATE ${GTK3_LIBRARIES})
target_compile_options(nativefiledialog PRIVATE ${GTK3_CFLAGS_OTHER})
target_include_directories(nativefiledialog PRIVATE ${GTK3_INCLUDE_DIRS})
target_link_directories(nativefiledialog PRIVATE ${GTK3_LIBRARY_DIRS})
elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_sources(nativefiledialog PRIVATE nativefiledialog/src/nfd_cocoa.m)
target_compile_definitions(nativefiledialog INTERFACE NATIVEFILEDIALOG_SUPPORTED)
# TODO link flags
elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_sources(nativefiledialog PRIVATE nativefiledialog/src/nfd_win.cpp)
target_compile_definitions(nativefiledialog INTERFACE NATIVEFILEDIALOG_SUPPORTED)
else ()
message(WARNING "nativefiledialog unsupported for ${CMAKE_SYSTEM_NAME}")
endif ()
add_subdirectory(nod EXCLUDE_FROM_ALL)
add_subdirectory(libjpeg-turbo EXCLUDE_FROM_ALL)
add_subdirectory(xxhash EXCLUDE_FROM_ALL)
add_subdirectory(zeus EXCLUDE_FROM_ALL)