173 lines
4.5 KiB
CMake
173 lines
4.5 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
|
|
project(ASIBFM700 LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# for ccls
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
# pass to mcc-library
|
|
option(USE_BSPLINE_PCM "Use of FITPACK bivariate splines for PCM" ON)
|
|
|
|
find_package(cxxopts REQUIRED)
|
|
|
|
#set(EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
# set(CMAKE_BUILD_TYPE "Release")
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
#add_subdirectory(LibSidServo)
|
|
|
|
# include(FetchContent)
|
|
|
|
# FetchContent_Declare(
|
|
# mcc
|
|
# GIT_REPOSITORY https://git.sao.ru/timur/mcc.git
|
|
# GIT_PROGRESS 1
|
|
# OVERRIDE_FIND_PACKAGE
|
|
# )
|
|
# FetchContent_MakeAvailable(mcc)
|
|
# set(CMAKE_MODULE_PATH
|
|
# ${CMAKE_MODULE_PATH}
|
|
# "${CMAKE_BINARY_DIR}/_deps/mcc-build"
|
|
# )
|
|
# find_package(mcc REQUIRED)
|
|
|
|
# execute_process(
|
|
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/
|
|
# COMMAND ninja -C ${CMAKE_BINARY_DIR}/erfa_lib
|
|
# )
|
|
|
|
# include(ExternalProject)
|
|
|
|
# ExternalProject_Add(
|
|
# mcclib
|
|
# # PREFIX ${CMAKE_BINARY_DIR}
|
|
# GIT_REPOSITORY https://git.sao.ru/timur/mcc.git
|
|
# GIT_PROGRESS 1
|
|
# GIT_SHALLOW 1
|
|
# BINARY_DIR ${CMAKE_BINARY_DIR}/mcc_build
|
|
# # INSTALL_DIR ${CMAKE_BINARY_DIR}/mcc_build
|
|
# CMAKE_ARGS
|
|
# -DBUILD_TESTS=OFF -USE_BSPLINE_PCM=${USE_BSPLINE_PCM}
|
|
# -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/mcc_build
|
|
# # BUILD_COMMAND make install
|
|
# # BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mcc_build/mccTargets.cmake
|
|
# # INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "Starting $<CONFIG> build"
|
|
# )
|
|
|
|
# message(STATUS "MCC: ${mcc_INCLUDE_DIR}")
|
|
|
|
# make_directory(${CMAKE_BINARY_DIR}/mcc_build/include)
|
|
|
|
# set(CMAKE_MODULE_PATH
|
|
# ${CMAKE_MODULE_PATH}
|
|
# "${CMAKE_BINARY_DIR}/mcc_build"
|
|
# )
|
|
|
|
# find_package(mcc CONFIG REQUIRED PATHS ${CMAKE_BINARY_DIR}/mcc_build)
|
|
|
|
# add_library(mcc INTERFACE IMPORTED GLOBAL)
|
|
# add_dependencies(mcc mcclib)
|
|
|
|
# set_target_properties(
|
|
# mcc
|
|
# PROPERTIES
|
|
# INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR}/mcc_build/include"
|
|
# )
|
|
# target_link_libraries(mcc INTERFACE mcclib)
|
|
|
|
# get_target_property(ii mcc INTERFACE_INCLUDE_DIRECTORIES)
|
|
# message(STATUS "$INC: ${ii}")
|
|
|
|
include(FetchContent)
|
|
|
|
set(EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
FetchContent_Declare(
|
|
servo_lib
|
|
GIT_REPOSITORY https://timur@git.sao.ru/timur/LibSidServo.git
|
|
GIT_SHALLOW 1
|
|
GIT_PROGRESS 1
|
|
SOURCE_DIR
|
|
${CMAKE_BINARY_DIR}/LibSidServo
|
|
)
|
|
|
|
FetchContent_MakeAvailable(servo_lib)
|
|
# FetchContent_GetProperties(servo_lib SOURCE_DIR servo_lib_inc)
|
|
|
|
FetchContent_Declare(
|
|
mcclib
|
|
GIT_REPOSITORY https://timur@git.sao.ru/timur/mcc.git
|
|
# GIT_REPOSITORY ssh://git@95.140.147.151:/home/git/mcc.git
|
|
GIT_SHALLOW 1
|
|
GIT_PROGRESS 1
|
|
SOURCE_DIR
|
|
${CMAKE_BINARY_DIR}/mcc
|
|
# OVERRIDE_FIND_PACKAGE
|
|
)
|
|
set(BUILD_TESTS OFF)
|
|
|
|
FetchContent_MakeAvailable(mcclib)
|
|
|
|
# add_subdirectory(${CMAKE_BINARY_DIR}/mcc)
|
|
|
|
if(USE_BSPLINE_PCM)
|
|
FetchContent_GetProperties(mcclib BINARY_DIR mcclib_bindir)
|
|
# to fix libfitpack_project.a target path issue
|
|
# file(CREATE_LINK ${mcclib_bindir}/fitpack fitpack SYMBOLIC)
|
|
endif()
|
|
|
|
set(ASIBFM700_LIB_SRC
|
|
asibfm700_common.h
|
|
asibfm700_servocontroller.h
|
|
asibfm700_servocontroller.cpp
|
|
)
|
|
|
|
set(ASIBFM700_LIB asibfm700mount)
|
|
add_library(
|
|
${ASIBFM700_LIB}
|
|
STATIC
|
|
${ASIBFM700_LIB_SRC}
|
|
asibfm700_mount.h
|
|
asibfm700_mount.cpp
|
|
asibfm700_configfile.h
|
|
asibfm700_netserver.cpp
|
|
asibfm700_netserver.h
|
|
)
|
|
|
|
# add_dependencies(${ASIBFM700_LIB} mcc)
|
|
|
|
target_include_directories(${ASIBFM700_LIB} PUBLIC ${CMAKE_BINARY_DIR}) # LibSidServo headers
|
|
# target_link_libraries(${ASIBFM700_LIB} PUBLIC mcc spdlog ${ERFA_LIBFILE})
|
|
# target_link_libraries(${ASIBFM700_LIB} PUBLIC mcclib sidservo)
|
|
target_link_libraries(${ASIBFM700_LIB} PUBLIC mcc sidservo atomic)
|
|
if(USE_BSPLINE_PCM)
|
|
target_compile_definitions(${ASIBFM700_LIB} PRIVATE USE_BSPLINE_PCM)
|
|
endif()
|
|
|
|
set(ASIBFM700_NETSERVER_APP asibfm700_netserver)
|
|
add_executable(${ASIBFM700_NETSERVER_APP} asibfm700_netserver_main.cpp)
|
|
target_link_libraries(
|
|
${ASIBFM700_NETSERVER_APP}
|
|
PUBLIC cxxopts::cxxopts ${ASIBFM700_LIB}
|
|
)
|
|
|
|
# include(CMakePrintHelpers)
|
|
# cmake_print_properties(
|
|
# TARGETS ${ASIBFM700_LIB}
|
|
# PROPERTIES
|
|
# INCLUDE_DIRECTORIES
|
|
# INTERFACE_INCLUDE_DIRECTORIES
|
|
# LINK_INTERFACE_LIBRARIES
|
|
# )
|
|
|
|
# get_target_property(TARGET_INCLUDES ${ASIBFM700_LIB} INCLUDE_DIRECTORIES)
|
|
# message(STATUS "${TARGET_INCLUDES}")
|
|
|
|
include(GNUInstallDirs)
|
|
install(
|
|
TARGETS ${ASIBFM700_NETSERVER_APP}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
)
|