forked from Archive/PX4-Autopilot
cmake: fixes for apps.h generation for posix and qurt
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
dbc60d99c5
commit
b561215017
|
@ -22,9 +22,10 @@ static int list_topics_main(int argc, char *argv[]);
|
||||||
static int sleep_main(int argc, char *argv[]);
|
static int sleep_main(int argc, char *argv[]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static map<string,px4_main_t> app_map(void)
|
||||||
void init_app_map(map<string,px4_main_t> &apps)
|
|
||||||
{
|
{
|
||||||
|
static map<string,px4_main_t> apps;
|
||||||
|
|
||||||
${builtin_apps_string}
|
${builtin_apps_string}
|
||||||
apps["shutdown"] = shutdown_main;
|
apps["shutdown"] = shutdown_main;
|
||||||
apps["list_tasks"] = list_tasks_main;
|
apps["list_tasks"] = list_tasks_main;
|
||||||
|
@ -32,13 +33,17 @@ ${builtin_apps_string}
|
||||||
apps["list_devices"] = list_devices_main;
|
apps["list_devices"] = list_devices_main;
|
||||||
apps["list_topics"] = list_topics_main;
|
apps["list_topics"] = list_topics_main;
|
||||||
apps["sleep"] = sleep_main;
|
apps["sleep"] = sleep_main;
|
||||||
|
|
||||||
|
return apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
void list_builtins(map<string,px4_main_t> &apps)
|
map<string,px4_main_t> apps = app_map();
|
||||||
|
|
||||||
|
static void list_builtins(void)
|
||||||
{
|
{
|
||||||
printf("Builtin Commands:\\n");
|
cout << "Builtin Commands:" << endl;
|
||||||
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
|
for (map<string,px4_main_t>::iterator it=apps.begin(); it!=apps.end(); ++it)
|
||||||
printf("\\t%s\\n", (it->first).c_str());
|
cout << '\t' << it->first << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int shutdown_main(int argc, char *argv[])
|
static int shutdown_main(int argc, char *argv[])
|
||||||
|
@ -64,21 +69,20 @@ static int list_topics_main(int argc, char *argv[])
|
||||||
px4_show_topics();
|
px4_show_topics();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int list_files_main(int argc, char *argv[])
|
static int list_files_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
px4_show_files();
|
px4_show_files();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sleep_main(int argc, char *argv[])
|
static int sleep_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
PX4_WARN( "Usage: sleep <seconds>" );
|
cout << "Usage: sleep <seconds>" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
sleep(atoi(argv[1]));
|
||||||
unsigned long usecs = ( (unsigned long) atol( argv[1] ) ) * 1000 * 1000;
|
return 0;
|
||||||
PX4_WARN("Sleeping for %s, %ld",argv[1],usecs);
|
|
||||||
usleep( usecs );
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ function(px4_posix_generate_builtin_commands)
|
||||||
math(EXPR command_count "${command_count}+1")
|
math(EXPR command_count "${command_count}+1")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/posix/builtin_commands.cpp_in
|
configure_file(${CMAKE_SOURCE_DIR}/cmake/posix/apps.h_in
|
||||||
${OUT})
|
${OUT})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ function(px4_qurt_generate_builtin_commands)
|
||||||
math(EXPR command_count "${command_count}+1")
|
math(EXPR command_count "${command_count}+1")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/qurt/builtin_commands.cpp_in
|
configure_file(${CMAKE_SOURCE_DIR}/cmake/qurt/apps.h_in
|
||||||
${OUT})
|
${OUT})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ message(STATUS "module list: ${module_dir_list}")
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
add_custom_command(OUTPUT apps.h
|
#add_custom_command(OUTPUT apps.h
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/posix_apps.py > apps.h)
|
# COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Tools/posix_apps.py > apps.h)
|
||||||
|
|
||||||
foreach(directory ${module_dir_list})
|
foreach(directory ${module_dir_list})
|
||||||
message(STATUS "directory: ${directory}")
|
message(STATUS "directory: ${directory}")
|
||||||
|
@ -17,13 +17,13 @@ foreach(directory ${module_dir_list})
|
||||||
${mangled_name})
|
${mangled_name})
|
||||||
endforeach()
|
endforeach()
|
||||||
px4_posix_generate_builtin_commands(
|
px4_posix_generate_builtin_commands(
|
||||||
OUT builtin_commands.cpp
|
OUT apps.h
|
||||||
MODULE_LIST ${module_list})
|
MODULE_LIST ${module_list})
|
||||||
|
|
||||||
add_executable(mainapp
|
add_executable(mainapp
|
||||||
${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp
|
${CMAKE_SOURCE_DIR}/src/platforms/posix/main.cpp
|
||||||
apps.h
|
apps.h
|
||||||
builtin_commands.cpp)
|
)
|
||||||
|
|
||||||
set(main_link_flags
|
set(main_link_flags
|
||||||
"-T${CMAKE_SOURCE_DIR}/cmake/posix/ld.script"
|
"-T${CMAKE_SOURCE_DIR}/cmake/posix/ld.script"
|
||||||
|
|
|
@ -16,7 +16,7 @@ foreach(directory ${module_dir_list})
|
||||||
${mangled_name})
|
${mangled_name})
|
||||||
endforeach()
|
endforeach()
|
||||||
px4_qurt_generate_builtin_commands(
|
px4_qurt_generate_builtin_commands(
|
||||||
OUT builtin_commands.cpp
|
OUT apps.h
|
||||||
MODULE_LIST ${module_list})
|
MODULE_LIST ${module_list})
|
||||||
|
|
||||||
# FIXME @jgoppert - how to work around issues like this?
|
# FIXME @jgoppert - how to work around issues like this?
|
||||||
|
@ -25,7 +25,10 @@ px4_qurt_generate_builtin_commands(
|
||||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||||
|
|
||||||
add_library(mainapp builtin_commands.cpp)
|
add_library(mainapp
|
||||||
|
${CMAKE_SOURCE_DIR}/src/platforms/qurt/px4_layer/main.cpp
|
||||||
|
apps.h)
|
||||||
|
|
||||||
target_link_libraries(mainapp
|
target_link_libraries(mainapp
|
||||||
-Wl,--whole-archive
|
-Wl,--whole-archive
|
||||||
${module_list}
|
${module_list}
|
||||||
|
|
Loading…
Reference in New Issue