Files
2026-04-20 09:09:23 -07:00

88 lines
2.8 KiB
CMake

cmake_minimum_required(VERSION 3.18)
project(vesperprofiled VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g -fsanitize=address")
# ── Dependencies ───────────────────────────────────────────────────────────
find_package(PkgConfig REQUIRED)
find_package(CURL REQUIRED)
pkg_check_modules(OPENSSL REQUIRED openssl)
pkg_check_modules(LIBYAML REQUIRED yaml-0.1)
pkg_check_modules(DBUS REQUIRED dbus-1)
pkg_check_modules(SYSTEMD REQUIRED libsystemd)
# ── Sources ────────────────────────────────────────────────────────────────
set(SOURCES
src/main.cpp
src/VesperProfileService.cpp
src/ProfileParser.cpp
src/ProfileStore.cpp
src/SignatureVerifier.cpp
src/payloads/PayloadHandlers.cpp
src/zte/DeviceIdentity.cpp
src/zte/ZTELookupClient.cpp
src/zte/ConnectivityWatcher.cpp
)
add_executable(vesperprofiled ${SOURCES})
target_include_directories(vesperprofiled PRIVATE
src/
${OPENSSL_INCLUDE_DIRS}
${LIBYAML_INCLUDE_DIRS}
${DBUS_INCLUDE_DIRS}
${SYSTEMD_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
)
target_link_libraries(vesperprofiled PRIVATE
${OPENSSL_LIBRARIES}
${LIBYAML_LIBRARIES}
${DBUS_LIBRARIES}
${SYSTEMD_LIBRARIES}
${CURL_LIBRARIES}
pthread
)
target_compile_options(vesperprofiled PRIVATE
-Wall -Wextra -Werror
${OPENSSL_CFLAGS_OTHER}
${LIBYAML_CFLAGS_OTHER}
${DBUS_CFLAGS_OTHER}
${SYSTEMD_CFLAGS_OTHER}
${CURL_CFLAGS_OTHER}
)
# ── Install ────────────────────────────────────────────────────────────────
include(GNUInstallDirs)
install(TARGETS vesperprofiled
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
)
install(FILES systemd/vesperprofiled.service
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system
)
install(FILES dbus/me.oxmc.vesperos.ProfileService.conf
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d
)
install(FILES apparmor/vesperprofiled
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/apparmor.d
)
install(FILES zte.conf.example
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/vesperprofiled
RENAME zte.conf.example
)
# Note: profile.schema.yml is NOT installed here — it is owned by the
# vesperprofiled-config-schema package and installed at
# /usr/share/vesperprofiled/schema/profile.schema.yml