Bumps the VoidLibrary pin to the commit adding Void::Json::Value typed accessors (has/get_str/get_num/get_bool/child_object/child_array) and advances the EchoionCore submodule to consume them in place of the removed local jHelpers. Clean-fetch build of Echoion.ts verified green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
215 lines
7.1 KiB
CMake
215 lines
7.1 KiB
CMake
cmake_minimum_required(VERSION 4.0.0)
|
|
project(Echoion VERSION 1.0.0 LANGUAGES CXX)
|
|
|
|
# Include CPM
|
|
file(
|
|
DOWNLOAD
|
|
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.8/CPM.cmake
|
|
${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
|
|
EXPECTED_HASH SHA256=78ba32abdf798bc616bab7c73aac32a17bbd7b06ad9e26a6add69de8f3ae4791
|
|
)
|
|
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)
|
|
|
|
# Include PackageProject.cmake
|
|
CPMAddPackage(
|
|
NAME PackageProject.cmake
|
|
GITHUB_REPOSITORY TheLartians/PackageProject.cmake
|
|
VERSION 1.11.2
|
|
)
|
|
|
|
# VoidLibrary — modular C++26 infrastructure (Json, Logging, Configuration,
|
|
# Plugin, Service, Async, Functional, System, Fsm, ...). Echoion's in-house
|
|
# infrastructure is migrated onto these Void:: targets.
|
|
# For local development against a working copy, configure with
|
|
# -DCPM_Void_SOURCE=/path/to/VoidLibrary
|
|
# which CPM honours over the git checkout below.
|
|
CPMAddPackage(
|
|
NAME Void
|
|
GIT_REPOSITORY http://git.faumaray.ru/void/voidlibrary.git
|
|
GIT_TAG 44839f9f2480eaffd4e6781b1a2cea785274e706
|
|
OPTIONS
|
|
"VOID_ENABLE_TESTING OFF"
|
|
)
|
|
|
|
set(CMAKE_CXX_STANDARD 26)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
# GCC 16+ exposes experimental C++26 reflection (P2996) via -freflection.
|
|
# Void's header-only INTERFACE modules (Data/Functional/Core) do not propagate
|
|
# this flag, so apply it tree-wide for every echoion target that may include
|
|
# <Void/Data/Reflect.hpp>, <Void/Configuration/Bind.hpp>, etc.
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)
|
|
# Guard to C++ only — vendored C dependencies (quickjs) must not see it.
|
|
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-freflection>)
|
|
endif()
|
|
|
|
# Enable folder organization in IDEs
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
# Options
|
|
option(BUILD_API "Build EchoionApi" ON)
|
|
option(BUILD_CORE "Build EchoionCore" ON)
|
|
option(BUILD_PLUGIN "Build EchoionPlugin" ON)
|
|
option(BUILD_DESKTOP "Build EchoionDesktop" ON)
|
|
option(BUILD_TESTS "Build tests" OFF)
|
|
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
|
option(ECHOION_STATIC_LINK "Statically link dependencies for standalone distribution" OFF)
|
|
|
|
# Static linking configuration
|
|
if(ECHOION_STATIC_LINK)
|
|
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++" CACHE STRING "" FORCE)
|
|
set(BUILD_SHARED_LIBS OFF)
|
|
message(STATUS "Static linking enabled - building standalone distribution")
|
|
endif()
|
|
|
|
# Find packages
|
|
find_package(Threads REQUIRED)
|
|
|
|
# Add subdirectories
|
|
if(BUILD_API)
|
|
add_subdirectory(EchoionApi)
|
|
endif()
|
|
|
|
if(BUILD_CORE)
|
|
add_subdirectory(EchoionCore)
|
|
endif()
|
|
|
|
if(BUILD_PLUGIN)
|
|
add_subdirectory(EchoionPlugin)
|
|
endif()
|
|
|
|
if(BUILD_DESKTOP)
|
|
add_subdirectory(EchoionDesktop)
|
|
endif()
|
|
|
|
# Tests
|
|
if(BUILD_TESTS)
|
|
enable_testing()
|
|
# add_subdirectory(tests)
|
|
endif()
|
|
|
|
# Packaging configuration
|
|
include(CPack)
|
|
set(CPACK_PACKAGE_NAME "Echoion")
|
|
set(CPACK_PACKAGE_VENDOR "Echoion")
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Echoion Music Bot for TeamSpeak")
|
|
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
|
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
|
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
|
|
|
# Platform-specific packaging
|
|
if(WIN32)
|
|
set(CPACK_GENERATOR "ZIP;NSIS")
|
|
set(CPACK_NSIS_DISPLAY_NAME "Echoion Music Bot")
|
|
set(CPACK_NSIS_HELP_LINK "https://github.com/yourusername/echoion")
|
|
set(CPACK_NSIS_URL_INFO_ABOUT "https://github.com/yourusername/echoion")
|
|
elseif(APPLE)
|
|
set(CPACK_GENERATOR "DragNDMGZ")
|
|
set(CPACK_DMG_VOLUME_NAME "Echoion")
|
|
else()
|
|
set(CPACK_GENERATOR "TGZ;DEB;RPM")
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libssl3, libavformat58, libavcodec58, libsqlite3-0")
|
|
set(CPACK_RPM_PACKAGE_REQUIRES "openssl, ffmpeg-libs, sqlite")
|
|
endif()
|
|
|
|
# Bundling and deployment helpers
|
|
include(GNUInstallDirs)
|
|
|
|
# Function to bundle Qt dependencies
|
|
function(bundle_qt_dependencies target)
|
|
if(NOT TARGET ${target})
|
|
return()
|
|
endif()
|
|
|
|
if(WIN32)
|
|
find_program(WINDEPLOYQT windeployqt HINTS ${Qt6Core_DIR}/../../../bin)
|
|
if(WINDEPLOYQT)
|
|
add_custom_command(TARGET ${target} POST_BUILD
|
|
COMMAND ${WINDEPLOYQT}
|
|
--dir $<TARGET_FILE_DIR:${target}>/qt_libs
|
|
--release
|
|
--no-translations
|
|
--no-compiler-runtime
|
|
--no-opengl-sw
|
|
$<TARGET_FILE:${target}>
|
|
COMMENT "Bundling Qt dependencies for ${target}"
|
|
)
|
|
endif()
|
|
elseif(APPLE)
|
|
find_program(MACDEPLOYQT macdeployqt HINTS ${Qt6Core_DIR}/../../../bin)
|
|
if(MACDEPLOYQT)
|
|
add_custom_command(TARGET ${target} POST_BUILD
|
|
COMMAND ${MACDEPLOYQT} $<TARGET_FILE:${target}> -always-overwrite
|
|
COMMENT "Bundling Qt dependencies for ${target}"
|
|
)
|
|
endif()
|
|
endif()
|
|
endfunction()
|
|
|
|
# Function to install target with its dependencies
|
|
function(install_with_dependencies target)
|
|
if(NOT TARGET ${target})
|
|
return()
|
|
endif()
|
|
|
|
get_target_property(target_type ${target} TYPE)
|
|
|
|
if(target_type STREQUAL "EXECUTABLE")
|
|
install(TARGETS ${target}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
)
|
|
|
|
# Bundle Qt if needed
|
|
get_target_property(linked_libs ${target} LINK_LIBRARIES)
|
|
if(linked_libs)
|
|
foreach(lib ${linked_libs})
|
|
if(lib MATCHES "Qt6::")
|
|
bundle_qt_dependencies(${target})
|
|
break()
|
|
endif()
|
|
endforeach()
|
|
endif()
|
|
elseif(target_type STREQUAL "SHARED_LIBRARY")
|
|
install(TARGETS ${target}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
)
|
|
endif()
|
|
endfunction()
|
|
|
|
# Apply bundling to targets after all subdirectories are added
|
|
if(BUILD_DESKTOP AND TARGET EchoionDesktop)
|
|
install_with_dependencies(EchoionDesktop)
|
|
endif()
|
|
|
|
if(BUILD_CORE AND TARGET EchoionCore)
|
|
install_with_dependencies(EchoionCore)
|
|
endif()
|
|
|
|
if(BUILD_PLUGIN AND TARGET EchoionPlugin)
|
|
install_with_dependencies(EchoionPlugin)
|
|
endif()
|
|
|
|
# Print configuration summary
|
|
message(STATUS "")
|
|
message(STATUS "Echoion Configuration:")
|
|
message(STATUS " Version: ${PROJECT_VERSION}")
|
|
message(STATUS " C++ Standard: ${CMAKE_CXX_STANDARD}")
|
|
message(STATUS " Build API: ${BUILD_API}")
|
|
message(STATUS " Build Core: ${BUILD_CORE}")
|
|
message(STATUS " Build Plugin: ${BUILD_PLUGIN}")
|
|
message(STATUS " Build Desktop: ${BUILD_DESKTOP}")
|
|
message(STATUS " Build Tests: ${BUILD_TESTS}")
|
|
message(STATUS " Static Link: ${ECHOION_STATIC_LINK}")
|
|
message(STATUS "")
|
|
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
|
|
message(STATUS "To build: cmake --build build")
|
|
message(STATUS "To install: cmake --install build --prefix <install_dir>")
|
|
message(STATUS "To package: cpack -G TGZ (or DEB, RPM, ZIP, NSIS)")
|
|
message(STATUS "")
|