From d7c8acd15c48eb11a1bf0fdba01338648116515c Mon Sep 17 00:00:00 2001
From: Lorenz Meier <lm@inf.ethz.ch>
Date: Thu, 28 Jan 2016 22:27:49 +0100
Subject: [PATCH] CMake: Add replay config

---
 cmake/configs/posix_sitl_replay.cmake   | 62 +++++++++++++++++++++++++
 posix-configs/SITL/init/rcS_replay_iris |  4 ++
 src/firmware/posix/CMakeLists.txt       |  2 +-
 3 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 cmake/configs/posix_sitl_replay.cmake
 create mode 100644 posix-configs/SITL/init/rcS_replay_iris

diff --git a/cmake/configs/posix_sitl_replay.cmake b/cmake/configs/posix_sitl_replay.cmake
new file mode 100644
index 0000000000..6ad18cf8db
--- /dev/null
+++ b/cmake/configs/posix_sitl_replay.cmake
@@ -0,0 +1,62 @@
+include(posix/px4_impl_posix)
+
+set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake)
+
+set(config_module_list
+	drivers/device
+	drivers/boards/sitl
+	platforms/common
+	platforms/posix/px4_layer
+	platforms/posix/work_queue
+	systemcmds/param
+	systemcmds/ver
+	systemcmds/perf
+	modules/uORB
+	modules/param
+	modules/systemlib
+	modules/ekf2
+	modules/ekf2_replay
+	modules/sdlog2
+	modules/controllib
+	lib/mathlib
+	lib/mathlib/math/filter
+	lib/conversion
+	lib/ecl
+	lib/external_lgpl
+	lib/geo
+	lib/geo_lookup
+	)
+
+set(config_extra_builtin_cmds
+	serdis
+	sercon
+	)
+
+set(config_sitl_rcS
+	posix-configs/SITL/init/rcS
+	CACHE FILEPATH "init script for sitl"
+	)
+
+set(config_sitl_viewer
+	replay
+	CACHE STRING "viewer for sitl"
+	)
+set_property(CACHE config_sitl_viewer
+	PROPERTY STRINGS "replay;none")
+
+set(config_sitl_debugger
+	disable
+	CACHE STRING "debugger for sitl"
+	)
+set_property(CACHE config_sitl_debugger
+	PROPERTY STRINGS "disable;gdb;lldb")
+
+
+
+add_custom_target(sercon)
+set_target_properties(sercon PROPERTIES
+	MAIN "sercon" STACK "2048")
+
+add_custom_target(serdis)
+set_target_properties(serdis PROPERTIES
+	MAIN "serdis" STACK "2048")
diff --git a/posix-configs/SITL/init/rcS_replay_iris b/posix-configs/SITL/init/rcS_replay_iris
new file mode 100644
index 0000000000..c973cd0034
--- /dev/null
+++ b/posix-configs/SITL/init/rcS_replay_iris
@@ -0,0 +1,4 @@
+uorb start
+ekf2 start --replay
+sleep 2
+ekf2_replay start replay.px4log
diff --git a/src/firmware/posix/CMakeLists.txt b/src/firmware/posix/CMakeLists.txt
index 9f0569f9c9..8aee420dd2 100644
--- a/src/firmware/posix/CMakeLists.txt
+++ b/src/firmware/posix/CMakeLists.txt
@@ -57,7 +57,7 @@ add_custom_target(run_config
 	)
 add_dependencies(run_config mainapp)
 
-foreach(viewer none jmavsim gazebo)
+foreach(viewer none jmavsim gazebo replay)
 	foreach(debugger none gdb lldb ddd valgrind)
 		foreach(model none iris iris_opt_flow tailsitter standard_vtol)
 			if (debugger STREQUAL "none")
-- 
GitLab