Skip to content

Commit

Permalink
Add Simulation mode to flight software (#32)
Browse files Browse the repository at this point in the history
* Prototype

* Simplify

* Reorder variables

* Update

* Remove accdient files
  • Loading branch information
gabekole authored Sep 29, 2024
1 parent f0fbebe commit 72bd1ec
Show file tree
Hide file tree
Showing 8 changed files with 796 additions and 4 deletions.
26 changes: 22 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,41 @@ project(Ferda C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)

# Add parameters for the Simulation build type
set(SIM_LOCAL_PORT "8002" CACHE STRING "Local port for simulation")
set(SIM_SERVER_PORT "8003" CACHE STRING "Server port for simulation")
set(SIM_SERVER_IP "127.0.0.1" CACHE STRING "Server IP for simulation")

if(CMAKE_BUILD_TYPE STREQUAL Debug)
FILE(GLOB EXTRA_CODE hardware_test/*.cpp)
elseif(CMAKE_BUILD_TYPE STREQUAL Simulation)
FILE(GLOB EXTRA_CODE hardware_simulation/*.cpp)
else()
FILE(GLOB EXTRA_CODE hardware/*.cpp)
endif()

FILE(GLOB CppSources src/*.cpp)

find_package (Eigen3 REQUIRED NO_MODULE)

find_package(Eigen3 REQUIRED NO_MODULE)

add_executable(Ferda ${CppSources} ${EXTRA_CODE})

target_include_directories(Ferda PRIVATE include)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
target_link_libraries (Ferda Eigen3::Eigen)
target_link_libraries(Ferda Eigen3::Eigen)
elseif(CMAKE_BUILD_TYPE STREQUAL Simulation)
target_link_libraries(Ferda Eigen3::Eigen)
target_compile_definitions(Ferda PRIVATE
SIMULATION_MODE
SIM_LOCAL_PORT=${SIM_LOCAL_PORT}
SIM_SERVER_PORT=${SIM_SERVER_PORT}
SIM_SERVER_IP="${SIM_SERVER_IP}"
)
else()
target_link_libraries (Ferda Eigen3::Eigen pigpio)
target_link_libraries(Ferda Eigen3::Eigen pigpio)
endif()

# Add threading library
find_package(Threads REQUIRED)
target_link_libraries(Ferda Threads::Threads)
Loading

0 comments on commit 72bd1ec

Please sign in to comment.