64 lines
1.5 KiB
CMake
64 lines
1.5 KiB
CMake
cmake_minimum_required(VERSION 3.28)
|
|
project(sdrpi-fpv-control)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
option(ENABLE_GROUND_BUILD "Enable build ground station" OFF)
|
|
option(ENABLE_AIR_BUILD "Enable build air" ON)
|
|
|
|
if(WIN32)
|
|
set(PORT_SPECIFIC_FILES
|
|
lib/port/win/poller.cpp
|
|
lib/port/win/uart.cpp
|
|
lib/port/win/udp.cpp
|
|
)
|
|
else ()
|
|
set(PORT_SPECIFIC_FILES
|
|
lib/port/unix/poller.cpp
|
|
lib/port/unix/uart.cpp
|
|
lib/port/unix/udp.cpp
|
|
)
|
|
endif()
|
|
|
|
set(LIB_FILES
|
|
${PORT_SPECIFIC_FILES}
|
|
lib/crsf.cpp
|
|
lib/crsf.h
|
|
lib/port/poller-general.cpp
|
|
lib/port/poller.h
|
|
lib/port/uart.h
|
|
lib/port/udp.h
|
|
)
|
|
|
|
if (ENABLE_GROUND_BUILD)
|
|
message("Enabled ground build!")
|
|
|
|
# Настройки для Windows
|
|
if(WIN32)
|
|
add_definitions(-DWIN32_LEAN_AND_MEAN)
|
|
set(EXTRA_LIBS ws2_32)
|
|
if (MSVC)
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
endif()
|
|
endif()
|
|
|
|
add_executable(${PROJECT_NAME}-ground
|
|
ground/main.cpp
|
|
${LIB_FILES}
|
|
)
|
|
|
|
target_link_libraries(${PROJECT_NAME}-ground ${EXTRA_LIBS})
|
|
target_include_directories(${PROJECT_NAME}-ground PRIVATE ground/ lib/)
|
|
endif()
|
|
|
|
if (ENABLE_AIR_BUILD)
|
|
message("Enabled air build!")
|
|
|
|
add_executable(${PROJECT_NAME}-air
|
|
air/main.cpp
|
|
${LIB_FILES}
|
|
)
|
|
target_include_directories(${PROJECT_NAME}-air PRIVATE air/ lib/)
|
|
endif()
|
|
|