cmake-nuttx nuttx linking/compiling

[ 83%] Building C object CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/src/examples/px4_simple_app/px4_simple_app.c.obj
/home/jgoppert/gcc-arm-none-eabi-4_7-2014q2/bin/arm-none-eabi-gcc  -DCLOCK_MONOTONIC=1 -D__EXPORT="" -D__PX4_LINUX -D__PX4_POSIX -Dnoreturn_function="" -std=gnu99 -fno-common -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Werror=unused-but-set-variable -Werror=unused-variable -Werror=double-promotion -Werror=reorder -Wbad-function-cast -Wstrict-prototypes -Wold-style-declaration -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -I/home/jgoppert/git/px4/cmake-Firmware/src -I/home/jgoppert/git/px4/cmake-Firmware/src/include -I/home/jgoppert/git/px4/cmake-Firmware/src/lib/eigen -I/home/jgoppert/git/px4/cmake-Firmware/src/lib -I/home/jgoppert/git/px4/cmake-Firmware/src/platforms -I/home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/include -I/home/jgoppert/git/px4/cmake-Firmware/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/build_arm -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules/px4_messages -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/platforms/posix/px4_messages -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/arch/chip -I/home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app    -o CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/src/examples/px4_simple_app/px4_simple_app.c.obj   -c /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c
In file included from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/sys/types.h:43:0,
                 from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/unistd.h:43,
                 from /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c:41:
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/nuttx/config.h:129:0: warning: "CONFIG_NFILE_STREAMS" redefined [enabled by default]
In file included from /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c:40:0:
/home/jgoppert/git/px4/cmake-Firmware/src/platforms/px4_config.h:48:0: note: this is the location of the previous definition
In file included from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/sys/types.h:43:0,
                 from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/unistd.h:43,
                 from /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c:41:
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/nuttx/config.h:278:0: warning: "CONFIG_SCHED_WORKPERIOD" redefined [enabled by default]
In file included from /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c:40:0:
/home/jgoppert/git/px4/cmake-Firmware/src/platforms/px4_config.h:55:0: note: this is the location of the previous definition
In file included from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/sys/types.h:44:0,
                 from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/unistd.h:43,
                 from /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c:41:
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/nuttx/compiler.h:82:0: warning: "noreturn_function" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/sched.h:47:0,
                 from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/stdio.h:47,
                 from /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c:42:
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/nuttx/sched.h:513:22: error: field 'xcp' has incomplete type

well looks like i need to fix my definitions, will try that, let me see if you see something else

Fixing the definitions didn't change the compile error, but didn't eliminate some of the warnings:
[ 83%] Building C object CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/src/examples/px4_simple_app/px4_simple_app.c.obj
/home/jgoppert/gcc-arm-none-eabi-4_7-2014q2/bin/arm-none-eabi-gcc  -D__PX4_NUTTX -std=gnu99 -fno-common -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Werror=unused-but-set-variable -Werror=unused-variable -Werror=double-promotion -Werror=reorder -Wbad-function-cast -Wstrict-prototypes -Wold-style-declaration -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -I/home/jgoppert/git/px4/cmake-Firmware/src -I/home/jgoppert/git/px4/cmake-Firmware/src/include -I/home/jgoppert/git/px4/cmake-Firmware/src/lib/eigen -I/home/jgoppert/git/px4/cmake-Firmware/src/lib -I/home/jgoppert/git/px4/cmake-Firmware/src/platforms -I/home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/include -I/home/jgoppert/git/px4/cmake-Firmware/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/build_arm -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules/px4_messages -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/platforms/posix/px4_messages -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/arch/chip -I/home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app    -o CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/src/examples/px4_simple_app/px4_simple_app.c.obj   -c /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c
In file included from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/sched.h:47:0,
                 from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/stdio.h:47,
                 from /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c:42:
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/nuttx/sched.h:513:22: error: field 'xcp' has incomplete type

I digged a bit. I would say header inclusion order issue?

I'm going into the file makefiles/nuttx/toolchain_gnu-arm-eabi.mk and grabbing more of the flags etc. Hope this gets me somewhere.

Ah, possible, will compare with the existing build.

The xcp chunk of code in nuttx/sched.h that is failing to build is wrapped with an ifdef that is set via nuttx defconfig. I think I need to grab all of the defconfig flags and import them into the cmake build.

That was the wrong approach. The flags are all set in nuttx/include/config.h. Will look at include order again.

OK, found it, a posix directory was being included in nuttx build,  moving onto the next error, linking the startup lib on nuttx:
/home/jgoppert/gcc-arm-none-eabi-4_7-2014q2/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: cannot find -lstartup
/home/jgoppert/gcc-arm-none-eabi-4_7-2014q2/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: cannot find -lstartup
collect2: error: ld returned 1 exit status
make[2]: *** [px4fmu-v2-default] Error 1
make[1]: *** [CMakeFiles/px4fmu-v2-default.dir/all] Error 2
make: *** [all] Error 2

@davids5 Any insights to the startup lib?

That was more of a cmake issue. I had a library that is only created if it sees startup objects. I think I resolved it, next issue is finally linking:
[ 83%] Built target px4_simple_app-px4fmu-v2-default
Linking C executable px4fmu-v2-default
/home/jgoppert/gcc-arm-none-eabi-4_7-2014q2/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: error: /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-exit.o) uses VFP register arguments, px4fmu-v2-default does not
/home/jgoppert/gcc-arm-none-eabi-4_7-2014q2/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld: failed to merge target specific data of file /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-exit.o)

This looks like I'm missing some more flags to get the nuttx binary and cmake binary to be compatible.
-mfloat-abi=hard

I have to see if I missed anything else important.

Note that your GCC Is pretty outdated as well. But it should not hit you here.

I've updated my GCC, here are the next set of linker errors after resolving the last by setting the flags correctly for each cmake target:
Re-run cmake no build system arguments
System is unknown to cmake, create:
Platform/Arm to use this system, please send your config file to<EMAIL_ADDRESS>so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please send that file to<EMAIL_ADDRESS>-- platform:
	os: posix
	libs: pthread
	main src: src/platforms/posix/main.cpp
	depends: posix_apps;msg_files
-- platform:
	os: nuttx
	libs:
	main src: cmake/builtin_commands.c
	depends: msg_files;git_nuttx
-- firmware:
	label: px4fmu-v2-default
	os: nuttx
	board: px4fmu-v2
-- 	px4_simple_app
		label:
		path:	src/examples/px4_simple_app
		stack:	1024
		main:	px4_simple_app_main
		srcs:	px4_simple_app.c
-- module os flags: -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
-- exe os flags: -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jgoppert/git/px4/cmake-Firmware/build_arm
/usr/bin/cmake -H/home/jgoppert/git/px4/cmake-Firmware -B/home/jgoppert/git/px4/cmake-Firmware/build_arm --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make -f CMakeFiles/nuttx_patch.dir/build.make CMakeFiles/nuttx_patch.dir/depend
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/nuttx_patch.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make -f CMakeFiles/nuttx_patch.dir/build.make CMakeFiles/nuttx_patch.dir/build
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make[2]: Nothing to be done for `CMakeFiles/nuttx_patch.dir/build'.
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
/usr/bin/cmake -E cmake_progress_report /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles
[  0%] Built target nuttx_patch
make -f CMakeFiles/nuttx_copy_px4fmu-v2.dir/build.make CMakeFiles/nuttx_copy_px4fmu-v2.dir/depend
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/nuttx_copy_px4fmu-v2.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make -f CMakeFiles/nuttx_copy_px4fmu-v2.dir/build.make CMakeFiles/nuttx_copy_px4fmu-v2.dir/build
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make[2]: Nothing to be done for `CMakeFiles/nuttx_copy_px4fmu-v2.dir/build'.
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
/usr/bin/cmake -E cmake_progress_report /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles  15
[ 16%] Built target nuttx_copy_px4fmu-v2
make -f CMakeFiles/NuttX_px4fmu-v2.dir/build.make CMakeFiles/NuttX_px4fmu-v2.dir/depend
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/NuttX_px4fmu-v2.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make -f CMakeFiles/NuttX_px4fmu-v2.dir/build.make CMakeFiles/NuttX_px4fmu-v2.dir/build
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make[2]: Nothing to be done for `CMakeFiles/NuttX_px4fmu-v2.dir/build'.
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
/usr/bin/cmake -E cmake_progress_report /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles  1 2
[ 50%] Built target NuttX_px4fmu-v2
make -f CMakeFiles/msg_files.dir/build.make CMakeFiles/msg_files.dir/depend
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/msg_files.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make -f CMakeFiles/msg_files.dir/build.make CMakeFiles/msg_files.dir/build
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
/usr/bin/cmake -E cmake_progress_report /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles 12
[ 66%] Generating uORB topic headers
cd /home/jgoppert/git/px4/cmake-Firmware && Tools/px_generate_uorb_topic_headers.py -d msg -o /home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules/uORB/topics -e msg/templates/uorb -t /home/jgoppert/git/px4/cmake-Firmware/build_arm/topics_temporary
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
/usr/bin/cmake -E cmake_progress_report /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles  12
[ 66%] Built target msg_files
make -f CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/build.make CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/depend
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make -f CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/build.make CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/build
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make[2]: Nothing to be done for `CMakeFiles/px4_simple_app-px4fmu-v2-default.dir/build'.
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
/usr/bin/cmake -E cmake_progress_report /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles  53
[ 83%] Built target px4_simple_app-px4fmu-v2-default
make -f CMakeFiles/px4fmu-v2-default.dir/build.make CMakeFiles/px4fmu-v2-default.dir/depend
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/px4fmu-v2-default.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make -f CMakeFiles/px4fmu-v2-default.dir/build.make CMakeFiles/px4fmu-v2-default.dir/build
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
Linking C executable px4fmu-v2-default
/usr/bin/cmake -E cmake_link_script CMakeFiles/px4fmu-v2-default.dir/link.txt --verbose=1
/home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-gcc  -std=gnu99 -fno-common -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Werror=unused-but-set-variable -Werror=unused-variable -Werror=double-promotion -Werror=reorder -Wbad-function-cast -Wstrict-prototypes -Wold-style-declaration -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs  -Wl,-gc-sections -Wl,--warn-common -Wl,--gc-sections -T/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export//build/ld.script -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard CMakeFiles/px4fmu-v2-default.dir/cmake/builtin_commands.c.obj  -o px4fmu-v2-default  -L/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs  -lapps libpx4_simple_app-px4fmu-v2-default.a -lnuttx -lapps -lnuttx
libpx4_simple_app-px4fmu-v2-default.a(px4_simple_app.c.obj): In function `px4_simple_app_main':
px4_simple_app.c:(.text+0x1a): undefined reference to `orb_subscribe'
px4_simple_app.c:(.text+0x2a): undefined reference to `orb_set_interval'
px4_simple_app.c:(.text+0x44): undefined reference to `orb_advertise'
px4_simple_app.c:(.text+0x102): undefined reference to `orb_copy'
px4_simple_app.c:(.text+0x172): undefined reference to `orb_publish'
px4_simple_app.c:(.text+0x19c): undefined reference to `__orb_sensor_combined'
px4_simple_app.c:(.text+0x1a0): undefined reference to `__orb_vehicle_attitude'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(arch-stm32_start.o): In function `__start':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/arch/arm/src/chip/stm32_start.c:254: undefined reference to `stm32_boardinitialize'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-task_terminate.o): In function `task_terminate':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/task_terminate.c:183: undefined reference to `sched_note_stop'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(arch-stm32_otgfsdev.o): In function `stm32_resumeinterrupt':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/arch/arm/src/chip/stm32_otgfsdev.c:3032: undefined reference to `stm32_usbsuspend'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(arch-stm32_otgfsdev.o): In function `stm32_suspendinterrupt':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/arch/arm/src/chip/stm32_otgfsdev.c:3094: undefined reference to `stm32_usbsuspend'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-sched_addreadytorun.o): In function `sched_addreadytorun':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/sched_addreadytorun.c:128: undefined reference to `sched_note_switch'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-sched_mergepending.o): In function `sched_mergepending':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/sched_mergepending.c:138: undefined reference to `sched_note_switch'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-sched_removereadytorun.o): In function `sched_removereadytorun':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/sched_removereadytorun.c:109: undefined reference to `sched_note_switch'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-task_activate.o): In function `task_activate':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/task_activate.c:104: undefined reference to `sched_note_stop'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/task_activate.c:111: undefined reference to `sched_note_start'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libapps.a(nsh_main.o): In function `nsh_main':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/apps/examples/nsh/nsh_main.c:119: undefined reference to `up_cxxinitialize'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libapps.a(nsh_init.o): In function `nsh_initialize':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/apps/nshlib/nsh_init.c:96: undefined reference to `nsh_archinitialize'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libapps.a(nsh_romfsetc.o): In function `nsh_romfsetc':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/apps/nshlib/nsh_romfsetc.c:121: undefined reference to `romfs_img_len'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/apps/nshlib/nsh_romfsetc.c:121: undefined reference to `romfs_img'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(fs-fs_mkfatfs.o): In function `mkfatfs':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/fs/fat/fs_mkfatfs.c:281: undefined reference to `fat_dma_alloc'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/fs/fat/fs_mkfatfs.c:306: undefined reference to `fat_dma_free'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(fs-fs_fat32.o): In function `fat_unbind':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/fs/fat/fs_fat32.c:1842: undefined reference to `fat_dma_free'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(fs-fs_fat32.o): In function `fat_dup':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/fs/fat/fs_fat32.c:1355: undefined reference to `fat_dma_alloc'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(fs-fs_fat32.o): In function `fat_close':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/fs/fat/fs_fat32.c:423: undefined reference to `fat_dma_free'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(fs-fs_fat32.o): In function `fat_open':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/fs/fat/fs_fat32.c:318: undefined reference to `fat_dma_alloc'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(fs-fs_fat32util.o): In function `fat_mount':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/fs/fat/fs_fat32util.c:546: undefined reference to `fat_dma_alloc'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/fs/fat/fs_fat32util.c:672: undefined reference to `fat_dma_free'
collect2: error: ld returned 1 exit status
make[2]: *** [px4fmu-v2-default] Error 1
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make[1]: *** [CMakeFiles/px4fmu-v2-default.dir/all] Error 2
make[1]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make: *** [all] Error 2

I don't get that far. When I checkout cmake-nuttx and run cmake from a new build dir I get:
$ mkdir build
$ cd build
$ cmake ../
-- platform:
os: posix
libs: pthread
main src: src/platforms/posix/main.cpp
depends: posix_apps;msg_files
-- platform:
os: nuttx
libs:
main src: cmake/builtin_commands.c
depends: msg_files;git_nuttx
-- firmware:
label: sim-posix-default
os: posix
board: sim
-- 	px4_simple_app
label:
path:	src/examples/px4_simple_app
stack:	1024
main:	px4_simple_app_main
srcs:	px4_simple_app.c
-- module os flags:
-- exe os flags:
-- Configuring done
CMake Warning (dev) at CMakeLists.txt:84 (add_dependencies):
Policy CMP0046 is not set: Error on non-existent dependency in
add_dependencies.  Run "cmake --help-policy CMP0046" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
The dependency target "nuttx_clone" of target "nuttx_patch" does not exist.
This warning is for project developers.  Use -Wno-dev to suppress it.
CMake Warning (dev) at cmake/px4_utils.cmake:210 (add_dependencies):
Policy CMP0046 is not set: Error on non-existent dependency in
add_dependencies.  Run "cmake --help-policy CMP0046" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
The dependency target "msg_multi_files" of target
"px4_simple_app-sim-posix-default" does not exist.
Call Stack (most recent call first):
CMakeLists.txt:439 (add_firmware)
This warning is for project developers.  Use -Wno-dev to suppress it.
-- Generating done
-- Build files have been written to: /home/mcharleb/work/Dronecode/PX4/cmake/Firmware

Looks like cmake 3.0 throws an error on a non-existing dep. I'm running 14.04 on this box with cmake 2.8 so I didn't see it. I will set the policy as suggested and also fix those extra deps lying around.

@mcharleb Fix is now up.

It also appears that those were just warnings before, and if you typed make, it might have built the target.

Here are the commands to get the host version up and running from scratch after a git clean -dxf.
$ git clean -dxf
$ ./cmake/test_host.sh > out
$ ./build_host/sim-posix-default
INFO  Shell id is<PHONE_NUMBER>55136
WARN  1          starting task wkr_high (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146)
WARN  146        starting task wkr_low (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146)
WARN  392        starting task wkr_hrt (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146)
App name: mainapp
Enter a command and its args:

You can also use: ./cmake/test_arm.sh
To speed up the cross-compilation setup, here are the contents of those files:
test_host.sh
#!/bin/bash
d=$PWD && \
mkdir -p $d/build_host && cd $d/build_host && cmake .. && make && ctest && cpack -G ZIP

test_arm.sh
d=$PWD && \
mkdir -p $d/build_arm && cd $d/build_arm && cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-arm-none-eabi.cmake .. && make && ctest  && cpack -G ZIP

I'm trying to compile the uorb module now to resolve the linking issues there, but the sources for the uorb module are OS conditional. So I'm going to refactor the cmake building a bit so that the OS is a parameter to the build, similar to how make was set up, instead of attempting to build all OS's for a given compiler at once.

I also think that one monolithic cmake file may be too scary with all the conditonal sources, so I might just break it out into per module cmake files like Make is currently setup.

@jgoppert  What branch are you using? When I do what you describe above I get very different results when using the cmake-nuttx branch:
$ git clean -dxf
$ ./cmake/test_host.sh > out
make[2]: *** [src/platforms/posix/px4_messages/mc_att_ctrl_status.msg] Error 1
make[1]: *** [CMakeFiles/msg_files-posix.dir/all] Error 2
make: *** [all] Error 2

nuttx, posix, and ROS builds all have different dependencies and a build of any should not hopefully require the superset of all dependencies.

The branch is "jgoppert/cmake-nuttx"
The dependencies are all taken care of by cmake and they are minimal for each build. For instance if NuttX is needed, it will clone and export it, otherwise for a sim build etc., none of that is done.
I just pushed my latest refactoring. I'm using cmake 3.2.2 now.
With the latest changes:
goppert@gnubox:~/git/px4/cmake-Firmware$ git clean -dxf
Removing build_host/
jgoppert@gnubox:~/git/px4/cmake-Firmware$ ./cmake/test_host.sh
-- The CXX compiler identification is GNU 4.8.4
-- The C compiler identification is GNU 4.8.4
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- module: px4_simple_app, stack: 1024
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jgoppert/git/px4/cmake-Firmware/build_host
Scanning dependencies of target msg_files_multi
[  3%] Generating uORB topic multi headers for posix
Generating headers from msg/mc_virtual_rates_setpoint.msg
Generating headers from msg/vehicle_control_mode.msg
Generating headers from msg/wind_estimate.msg
Generating headers from msg/camera_trigger.msg
Generating headers from msg/encoders.msg
Generating headers from msg/navigation_capabilities.msg
Generating headers from msg/actuator_controls_1.msg
Generating headers from msg/vehicle_attitude_setpoint.msg
Generating headers from msg/actuator_controls_0.msg
Generating headers from msg/rc_channels.msg
Generating headers from msg/vehicle_rates_setpoint.msg
Generating headers from msg/vehicle_global_velocity_setpoint.msg
Generating headers from msg/vtol_vehicle_status.msg
Generating headers from msg/multirotor_motor_limits.msg
Generating headers from msg/actuator_controls_virtual_fw.msg
Generating headers from msg/differential_pressure.msg
Generating headers from msg/esc_status.msg
Generating headers from msg/vehicle_local_position_setpoint.msg
Generating headers from msg/telemetry_status.msg
Generating headers from msg/sensor_accel.msg
Generating headers from msg/battery_status.msg
Generating headers from msg/airspeed.msg
Generating headers from msg/vehicle_status.msg
Generating headers from msg/vehicle_global_position.msg
Generating headers from msg/debug_key_value.msg
Generating headers from msg/parameter_update.msg
Generating headers from msg/home_position.msg
Generating headers from msg/actuator_controls_2.msg
Generating headers from msg/vehicle_local_position.msg
Generating headers from msg/servorail_status.msg
Generating headers from msg/system_power.msg
Generating headers from msg/vehicle_land_detected.msg
Generating headers from msg/vehicle_force_setpoint.msg
Generating headers from msg/filtered_bottom_flow.msg
Generating headers from msg/pwm_input.msg
Generating headers from msg/actuator_outputs.msg
Generating headers from msg/test_motor.msg
Generating headers from msg/actuator_controls.msg
Generating headers from msg/actuator_controls_3.msg
Generating headers from msg/geofence_result.msg
Generating headers from msg/position_setpoint_triplet.msg
Generating headers from msg/safety.msg
Generating headers from msg/satellite_info.msg
Generating headers from msg/mission.msg
Generating headers from msg/input_rc.msg
Generating headers from msg/actuator_armed.msg
Generating headers from msg/vehicle_attitude.msg
Generating headers from msg/offboard_control_mode.msg
Generating headers from msg/vision_position_estimate.msg
Generating headers from msg/position_setpoint.msg
Generating headers from msg/sensor_gyro.msg
Generating headers from msg/fence_vertex.msg
Generating headers from msg/vehicle_command.msg
Generating headers from msg/actuator_controls_virtual_mc.msg
Generating headers from msg/sensor_combined.msg
Generating headers from msg/fw_virtual_rates_setpoint.msg
Generating headers from msg/att_pos_mocap.msg
Generating headers from msg/mission_result.msg
Generating headers from msg/sensor_mag.msg
Generating headers from msg/fence.msg
Generating headers from msg/esc_report.msg
Generating headers from msg/rc_parameter_map.msg
Generating headers from msg/manual_control_setpoint.msg
Generating headers from msg/hil_sensor.msg
Generating headers from msg/output_pwm.msg
Generating headers from msg/tecs_status.msg
Generating headers from msg/subsystem_info.msg
Generating headers from msg/actuator_direct.msg
Generating headers from msg/distance_sensor.msg
Generating headers from msg/vehicle_gps_position.msg
Generating headers from msg/optical_flow.msg
Generating headers from msg/mc_att_ctrl_status.msg
Generating headers from msg/estimator_status.msg
Generating headers from msg/time_offset.msg
Generating headers from msg/sensor_baro.msg
mission_result.h: new header file
actuator_direct.h: new header file
actuator_controls_1.h: new header file
actuator_controls_virtual_mc.h: new header file
wind_estimate.h: new header file
time_offset.h: new header file
optical_flow.h: new header file
pwm_input.h: new header file
sensor_combined.h: new header file
actuator_controls_virtual_fw.h: new header file
actuator_controls.h: new header file
sensor_accel.h: new header file
safety.h: new header file
output_pwm.h: new header file
vehicle_local_position_setpoint.h: new header file
vehicle_gps_position.h: new header file
offboard_control_mode.h: new header file
actuator_controls_3.h: new header file
home_position.h: new header file
tecs_status.h: new header file
estimator_status.h: new header file
manual_control_setpoint.h: new header file
multirotor_motor_limits.h: new header file
sensor_baro.h: new header file
vehicle_command.h: new header file
hil_sensor.h: new header file
mission.h: new header file
vehicle_global_velocity_setpoint.h: new header file
esc_report.h: new header file
vehicle_rates_setpoint.h: new header file
subsystem_info.h: new header file
actuator_outputs.h: new header file
vtol_vehicle_status.h: new header file
vehicle_attitude_setpoint.h: new header file
camera_trigger.h: new header file
battery_status.h: new header file
actuator_armed.h: new header file
fence_vertex.h: new header file
filtered_bottom_flow.h: new header file
telemetry_status.h: new header file
position_setpoint_triplet.h: new header file
satellite_info.h: new header file
position_setpoint.h: new header file
rc_channels.h: new header file
vehicle_attitude.h: new header file
mc_att_ctrl_status.h: new header file
vehicle_global_position.h: new header file
actuator_controls_0.h: new header file
vehicle_land_detected.h: new header file
vehicle_local_position.h: new header file
test_motor.h: new header file
att_pos_mocap.h: new header file
vehicle_status.h: new header file
differential_pressure.h: new header file
fence.h: new header file
vision_position_estimate.h: new header file
encoders.h: new header file
navigation_capabilities.h: new header file
esc_status.h: new header file
actuator_controls_2.h: new header file
debug_key_value.h: new header file
parameter_update.h: new header file
sensor_mag.h: new header file
mc_virtual_rates_setpoint.h: new header file
airspeed.h: new header file
rc_parameter_map.h: new header file
sensor_gyro.h: new header file
vehicle_force_setpoint.h: new header file
geofence_result.h: new header file
distance_sensor.h: new header file
fw_virtual_rates_setpoint.h: new header file
input_rc.h: new header file
vehicle_control_mode.h: new header file
system_power.h: new header file
servorail_status.h: new header file
[  3%] Built target msg_files_multi
Scanning dependencies of target posix_apps
[  6%] Generating posix apps
[  6%] Built target posix_apps
Scanning dependencies of target msg_files
[  9%] Generating uORB topic headers
Generating headers from msg/mc_virtual_rates_setpoint.msg
Generating headers from msg/vehicle_control_mode.msg
Generating headers from msg/wind_estimate.msg
Generating headers from msg/camera_trigger.msg
Generating headers from msg/encoders.msg
Generating headers from msg/navigation_capabilities.msg
Generating headers from msg/actuator_controls_1.msg
Generating headers from msg/vehicle_attitude_setpoint.msg
Generating headers from msg/actuator_controls_0.msg
Generating headers from msg/rc_channels.msg
Generating headers from msg/vehicle_rates_setpoint.msg
Generating headers from msg/vehicle_global_velocity_setpoint.msg
Generating headers from msg/vtol_vehicle_status.msg
Generating headers from msg/multirotor_motor_limits.msg
Generating headers from msg/actuator_controls_virtual_fw.msg
Generating headers from msg/differential_pressure.msg
Generating headers from msg/esc_status.msg
Generating headers from msg/vehicle_local_position_setpoint.msg
Generating headers from msg/telemetry_status.msg
Generating headers from msg/sensor_accel.msg
Generating headers from msg/battery_status.msg
Generating headers from msg/airspeed.msg
Generating headers from msg/vehicle_status.msg
Generating headers from msg/vehicle_global_position.msg
Generating headers from msg/debug_key_value.msg
Generating headers from msg/parameter_update.msg
Generating headers from msg/home_position.msg
Generating headers from msg/actuator_controls_2.msg
Generating headers from msg/vehicle_local_position.msg
Generating headers from msg/servorail_status.msg
Generating headers from msg/system_power.msg
Generating headers from msg/vehicle_land_detected.msg
Generating headers from msg/vehicle_force_setpoint.msg
Generating headers from msg/filtered_bottom_flow.msg
Generating headers from msg/pwm_input.msg
Generating headers from msg/actuator_outputs.msg
Generating headers from msg/test_motor.msg
Generating headers from msg/actuator_controls.msg
Generating headers from msg/actuator_controls_3.msg
Generating headers from msg/geofence_result.msg
Generating headers from msg/position_setpoint_triplet.msg
Generating headers from msg/safety.msg
Generating headers from msg/satellite_info.msg
Generating headers from msg/mission.msg
Generating headers from msg/input_rc.msg
Generating headers from msg/actuator_armed.msg
Generating headers from msg/vehicle_attitude.msg
Generating headers from msg/offboard_control_mode.msg
Generating headers from msg/vision_position_estimate.msg
Generating headers from msg/position_setpoint.msg
Generating headers from msg/sensor_gyro.msg
Generating headers from msg/fence_vertex.msg
Generating headers from msg/vehicle_command.msg
Generating headers from msg/actuator_controls_virtual_mc.msg
Generating headers from msg/sensor_combined.msg
Generating headers from msg/fw_virtual_rates_setpoint.msg
Generating headers from msg/att_pos_mocap.msg
Generating headers from msg/mission_result.msg
Generating headers from msg/sensor_mag.msg
Generating headers from msg/fence.msg
Generating headers from msg/esc_report.msg
Generating headers from msg/rc_parameter_map.msg
Generating headers from msg/manual_control_setpoint.msg
Generating headers from msg/hil_sensor.msg
Generating headers from msg/output_pwm.msg
Generating headers from msg/tecs_status.msg
Generating headers from msg/subsystem_info.msg
Generating headers from msg/actuator_direct.msg
Generating headers from msg/distance_sensor.msg
Generating headers from msg/vehicle_gps_position.msg
Generating headers from msg/optical_flow.msg
Generating headers from msg/mc_att_ctrl_status.msg
Generating headers from msg/estimator_status.msg
Generating headers from msg/time_offset.msg
Generating headers from msg/sensor_baro.msg
mission_result.h: new header file
actuator_direct.h: new header file
actuator_controls_1.h: new header file
actuator_controls_virtual_mc.h: new header file
wind_estimate.h: new header file
time_offset.h: new header file
optical_flow.h: new header file
pwm_input.h: new header file
sensor_combined.h: new header file
actuator_controls_virtual_fw.h: new header file
actuator_controls.h: new header file
sensor_accel.h: new header file
safety.h: new header file
output_pwm.h: new header file
vehicle_local_position_setpoint.h: new header file
vehicle_gps_position.h: new header file
offboard_control_mode.h: new header file
actuator_controls_3.h: new header file
home_position.h: new header file
tecs_status.h: new header file
estimator_status.h: new header file
manual_control_setpoint.h: new header file
multirotor_motor_limits.h: new header file
sensor_baro.h: new header file
vehicle_command.h: new header file
hil_sensor.h: new header file
mission.h: new header file
vehicle_global_velocity_setpoint.h: new header file
esc_report.h: new header file
vehicle_rates_setpoint.h: new header file
subsystem_info.h: new header file
actuator_outputs.h: new header file
vtol_vehicle_status.h: new header file
vehicle_attitude_setpoint.h: new header file
camera_trigger.h: new header file
battery_status.h: new header file
actuator_armed.h: new header file
fence_vertex.h: new header file
filtered_bottom_flow.h: new header file
telemetry_status.h: new header file
position_setpoint_triplet.h: new header file
satellite_info.h: new header file
position_setpoint.h: new header file
rc_channels.h: new header file
vehicle_attitude.h: new header file
mc_att_ctrl_status.h: new header file
vehicle_global_position.h: new header file
actuator_controls_0.h: new header file
vehicle_land_detected.h: new header file
vehicle_local_position.h: new header file
test_motor.h: new header file
att_pos_mocap.h: new header file
vehicle_status.h: new header file
differential_pressure.h: new header file
fence.h: new header file
vision_position_estimate.h: new header file
encoders.h: new header file
navigation_capabilities.h: new header file
esc_status.h: new header file
actuator_controls_2.h: new header file
debug_key_value.h: new header file
parameter_update.h: new header file
sensor_mag.h: new header file
mc_virtual_rates_setpoint.h: new header file
airspeed.h: new header file
rc_parameter_map.h: new header file
sensor_gyro.h: new header file
vehicle_force_setpoint.h: new header file
geofence_result.h: new header file
distance_sensor.h: new header file
fw_virtual_rates_setpoint.h: new header file
input_rc.h: new header file
vehicle_control_mode.h: new header file
system_power.h: new header file
servorail_status.h: new header file
[  9%] Built target msg_files
Scanning dependencies of target platform
[ 12%] Building C object CMakeFiles/platform.dir/src/platforms/common/px4_log.c.o
[ 16%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/ringbuffer.cpp.o
[ 19%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/vfile.cpp.o
[ 22%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/vdev.cpp.o
[ 25%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/device_posix.cpp.o
[ 29%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/i2c_posix.cpp.o
[ 32%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/sim.cpp.o
[ 35%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/vdev_posix.cpp.o
[ 38%] Building C object CMakeFiles/platform.dir/src/platforms/posix/px4_layer/drv_hrt.c.o
[ 41%] Building C object CMakeFiles/platform.dir/src/platforms/posix/px4_layer/lib_crc32.c.o
[ 45%] Building CXX object CMakeFiles/platform.dir/src/platforms/posix/px4_layer/px4_posix_impl.cpp.o
[ 48%] Building CXX object CMakeFiles/platform.dir/src/platforms/posix/px4_layer/px4_posix_tasks.cpp.o
[ 51%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/dq_addlast.c.o
[ 54%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/dq_rem.c.o
[ 58%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/dq_remfirst.c.o
[ 61%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/hrt_queue.c.o
[ 64%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/hrt_thread.c.o
[ 67%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/hrt_work_cancel.c.o
[ 70%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/queue.c.o
[ 74%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/sq_addafter.c.o
[ 77%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/sq_addlast.c.o
[ 80%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/sq_remfirst.c.o
[ 83%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/work_cancel.c.o
[ 87%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/work_lock.c.o
[ 90%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/work_queue.c.o
[ 93%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/work_thread.c.o
Linking CXX static library libplatform.a
[ 93%] Built target platform
Scanning dependencies of target px4_simple_app
[ 96%] Building C object src/examples/px4_simple_app/CMakeFiles/px4_simple_app.dir/px4_simple_app.c.o
Linking C static library libpx4_simple_app.a
[ 96%] Built target px4_simple_app
Scanning dependencies of target main
[100%] Building CXX object CMakeFiles/main.dir/src/platforms/posix/main.cpp.o
Linking CXX executable main
[100%] Built target main
Test project /home/jgoppert/git/px4/cmake-Firmware/build_host
    Start 1: test_main
1/1 Test #1: test_main ........................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.00 sec
CPack: Create package using ZIP
CPack: Install projects
CPack: - Run preinstall target for: px4
CPack: - Install project: px4
CPack: Create package
CPack: - package: /home/jgoppert/git/px4/cmake-Firmware/build_host/px4-0.1.2-Linux.zip generated.
jgoppert@gnubox:~/git/px4/cmake-Firmware$ git commit
On branch cmake-nuttx
Your branch is up-to-date with 'origin/cmake-nuttx'.

nothing to commit, working directory clean
jgoppert@gnubox:~/git/px4/cmake-Firmware$ ./cmake/test_host.sh
-- module: px4_simple_app, stack: 1024
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jgoppert/git/px4/cmake-Firmware/build_host
[  3%] Generating uORB topic multi headers for posix
[  3%] Built target msg_files_multi
[  6%] Generating uORB topic headers
[  6%] Built target msg_files
[  9%] Built target posix_apps
[ 93%] Built target platform
[ 96%] Built target px4_simple_app
[100%] Built target main
Test project /home/jgoppert/git/px4/cmake-Firmware/build_host
    Start 1: test_main
1/1 Test #1: test_main ........................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.00 sec
CPack: Create package using ZIP
CPack: Install projects
CPack: - Run preinstall target for: px4
CPack: - Install project: px4
CPack: Create package
CPack: - package: /home/jgoppert/git/px4/cmake-Firmware/build_host/px4-0.1.2-Linux.zip generated.
jgoppert@gnubox:~/git/px4/cmake-Firmware$ git clean -dxf
Removing build_host/
jgoppert@gnubox:~/git/px4/cmake-Firmware$ ./cmake/test_host.sh
-- The CXX compiler identification is GNU 4.8.4
-- The C compiler identification is GNU 4.8.4
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- module: px4_simple_app, stack: 1024
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jgoppert/git/px4/cmake-Firmware/build_host
Scanning dependencies of target msg_files_multi
[  3%] Generating uORB topic multi headers for posix
Generating headers from msg/mc_virtual_rates_setpoint.msg
Generating headers from msg/vehicle_control_mode.msg
Generating headers from msg/wind_estimate.msg
Generating headers from msg/camera_trigger.msg
Generating headers from msg/encoders.msg
Generating headers from msg/navigation_capabilities.msg
Generating headers from msg/actuator_controls_1.msg
Generating headers from msg/vehicle_attitude_setpoint.msg
Generating headers from msg/actuator_controls_0.msg
Generating headers from msg/rc_channels.msg
Generating headers from msg/vehicle_rates_setpoint.msg
Generating headers from msg/vehicle_global_velocity_setpoint.msg
Generating headers from msg/vtol_vehicle_status.msg
Generating headers from msg/multirotor_motor_limits.msg
Generating headers from msg/actuator_controls_virtual_fw.msg
Generating headers from msg/differential_pressure.msg
Generating headers from msg/esc_status.msg
Generating headers from msg/vehicle_local_position_setpoint.msg
Generating headers from msg/telemetry_status.msg
Generating headers from msg/sensor_accel.msg
Generating headers from msg/battery_status.msg
Generating headers from msg/airspeed.msg
Generating headers from msg/vehicle_status.msg
Generating headers from msg/vehicle_global_position.msg
Generating headers from msg/debug_key_value.msg
Generating headers from msg/parameter_update.msg
Generating headers from msg/home_position.msg
Generating headers from msg/actuator_controls_2.msg
Generating headers from msg/vehicle_local_position.msg
Generating headers from msg/servorail_status.msg
Generating headers from msg/system_power.msg
Generating headers from msg/vehicle_land_detected.msg
Generating headers from msg/vehicle_force_setpoint.msg
Generating headers from msg/filtered_bottom_flow.msg
Generating headers from msg/pwm_input.msg
Generating headers from msg/actuator_outputs.msg
Generating headers from msg/test_motor.msg
Generating headers from msg/actuator_controls.msg
Generating headers from msg/actuator_controls_3.msg
Generating headers from msg/geofence_result.msg
Generating headers from msg/position_setpoint_triplet.msg
Generating headers from msg/safety.msg
Generating headers from msg/satellite_info.msg
Generating headers from msg/mission.msg
Generating headers from msg/input_rc.msg
Generating headers from msg/actuator_armed.msg
Generating headers from msg/vehicle_attitude.msg
Generating headers from msg/offboard_control_mode.msg
Generating headers from msg/vision_position_estimate.msg
Generating headers from msg/position_setpoint.msg
Generating headers from msg/sensor_gyro.msg
Generating headers from msg/fence_vertex.msg
Generating headers from msg/vehicle_command.msg
Generating headers from msg/actuator_controls_virtual_mc.msg
Generating headers from msg/sensor_combined.msg
Generating headers from msg/fw_virtual_rates_setpoint.msg
Generating headers from msg/att_pos_mocap.msg
Generating headers from msg/mission_result.msg
Generating headers from msg/sensor_mag.msg
Generating headers from msg/fence.msg
Generating headers from msg/esc_report.msg
Generating headers from msg/rc_parameter_map.msg
Generating headers from msg/manual_control_setpoint.msg
Generating headers from msg/hil_sensor.msg
Generating headers from msg/output_pwm.msg
Generating headers from msg/tecs_status.msg
Generating headers from msg/subsystem_info.msg
Generating headers from msg/actuator_direct.msg
Generating headers from msg/distance_sensor.msg
Generating headers from msg/vehicle_gps_position.msg
Generating headers from msg/optical_flow.msg
Generating headers from msg/mc_att_ctrl_status.msg
Generating headers from msg/estimator_status.msg
Generating headers from msg/time_offset.msg
Generating headers from msg/sensor_baro.msg
mission_result.h: new header file
actuator_direct.h: new header file
actuator_controls_1.h: new header file
actuator_controls_virtual_mc.h: new header file
wind_estimate.h: new header file
time_offset.h: new header file
optical_flow.h: new header file
pwm_input.h: new header file
sensor_combined.h: new header file
actuator_controls_virtual_fw.h: new header file
actuator_controls.h: new header file
sensor_accel.h: new header file
safety.h: new header file
output_pwm.h: new header file
vehicle_local_position_setpoint.h: new header file
vehicle_gps_position.h: new header file
offboard_control_mode.h: new header file
actuator_controls_3.h: new header file
home_position.h: new header file
tecs_status.h: new header file
estimator_status.h: new header file
manual_control_setpoint.h: new header file
multirotor_motor_limits.h: new header file
sensor_baro.h: new header file
vehicle_command.h: new header file
hil_sensor.h: new header file
mission.h: new header file
vehicle_global_velocity_setpoint.h: new header file
esc_report.h: new header file
vehicle_rates_setpoint.h: new header file
subsystem_info.h: new header file
actuator_outputs.h: new header file
vtol_vehicle_status.h: new header file
vehicle_attitude_setpoint.h: new header file
camera_trigger.h: new header file
battery_status.h: new header file
actuator_armed.h: new header file
fence_vertex.h: new header file
filtered_bottom_flow.h: new header file
telemetry_status.h: new header file
position_setpoint_triplet.h: new header file
satellite_info.h: new header file
position_setpoint.h: new header file
rc_channels.h: new header file
vehicle_attitude.h: new header file
mc_att_ctrl_status.h: new header file
vehicle_global_position.h: new header file
actuator_controls_0.h: new header file
vehicle_land_detected.h: new header file
vehicle_local_position.h: new header file
test_motor.h: new header file
att_pos_mocap.h: new header file
vehicle_status.h: new header file
differential_pressure.h: new header file
fence.h: new header file
vision_position_estimate.h: new header file
encoders.h: new header file
navigation_capabilities.h: new header file
esc_status.h: new header file
actuator_controls_2.h: new header file
debug_key_value.h: new header file
parameter_update.h: new header file
sensor_mag.h: new header file
mc_virtual_rates_setpoint.h: new header file
airspeed.h: new header file
rc_parameter_map.h: new header file
sensor_gyro.h: new header file
vehicle_force_setpoint.h: new header file
geofence_result.h: new header file
distance_sensor.h: new header file
fw_virtual_rates_setpoint.h: new header file
input_rc.h: new header file
vehicle_control_mode.h: new header file
system_power.h: new header file
servorail_status.h: new header file
[  3%] Built target msg_files_multi
Scanning dependencies of target posix_apps
[  6%] Generating posix apps
[  6%] Built target posix_apps
Scanning dependencies of target msg_files
[  9%] Generating uORB topic headers
Generating headers from msg/mc_virtual_rates_setpoint.msg
Generating headers from msg/vehicle_control_mode.msg
Generating headers from msg/wind_estimate.msg
Generating headers from msg/camera_trigger.msg
Generating headers from msg/encoders.msg
Generating headers from msg/navigation_capabilities.msg
Generating headers from msg/actuator_controls_1.msg
Generating headers from msg/vehicle_attitude_setpoint.msg
Generating headers from msg/actuator_controls_0.msg
Generating headers from msg/rc_channels.msg
Generating headers from msg/vehicle_rates_setpoint.msg
Generating headers from msg/vehicle_global_velocity_setpoint.msg
Generating headers from msg/vtol_vehicle_status.msg
Generating headers from msg/multirotor_motor_limits.msg
Generating headers from msg/actuator_controls_virtual_fw.msg
Generating headers from msg/differential_pressure.msg
Generating headers from msg/esc_status.msg
Generating headers from msg/vehicle_local_position_setpoint.msg
Generating headers from msg/telemetry_status.msg
Generating headers from msg/sensor_accel.msg
Generating headers from msg/battery_status.msg
Generating headers from msg/airspeed.msg
Generating headers from msg/vehicle_status.msg
Generating headers from msg/vehicle_global_position.msg
Generating headers from msg/debug_key_value.msg
Generating headers from msg/parameter_update.msg
Generating headers from msg/home_position.msg
Generating headers from msg/actuator_controls_2.msg
Generating headers from msg/vehicle_local_position.msg
Generating headers from msg/servorail_status.msg
Generating headers from msg/system_power.msg
Generating headers from msg/vehicle_land_detected.msg
Generating headers from msg/vehicle_force_setpoint.msg
Generating headers from msg/filtered_bottom_flow.msg
Generating headers from msg/pwm_input.msg
Generating headers from msg/actuator_outputs.msg
Generating headers from msg/test_motor.msg
Generating headers from msg/actuator_controls.msg
Generating headers from msg/actuator_controls_3.msg
Generating headers from msg/geofence_result.msg
Generating headers from msg/position_setpoint_triplet.msg
Generating headers from msg/safety.msg
Generating headers from msg/satellite_info.msg
Generating headers from msg/mission.msg
Generating headers from msg/input_rc.msg
Generating headers from msg/actuator_armed.msg
Generating headers from msg/vehicle_attitude.msg
Generating headers from msg/offboard_control_mode.msg
Generating headers from msg/vision_position_estimate.msg
Generating headers from msg/position_setpoint.msg
Generating headers from msg/sensor_gyro.msg
Generating headers from msg/fence_vertex.msg
Generating headers from msg/vehicle_command.msg
Generating headers from msg/actuator_controls_virtual_mc.msg
Generating headers from msg/sensor_combined.msg
Generating headers from msg/fw_virtual_rates_setpoint.msg
Generating headers from msg/att_pos_mocap.msg
Generating headers from msg/mission_result.msg
Generating headers from msg/sensor_mag.msg
Generating headers from msg/fence.msg
Generating headers from msg/esc_report.msg
Generating headers from msg/rc_parameter_map.msg
Generating headers from msg/manual_control_setpoint.msg
Generating headers from msg/hil_sensor.msg
Generating headers from msg/output_pwm.msg
Generating headers from msg/tecs_status.msg
Generating headers from msg/subsystem_info.msg
Generating headers from msg/actuator_direct.msg
Generating headers from msg/distance_sensor.msg
Generating headers from msg/vehicle_gps_position.msg
Generating headers from msg/optical_flow.msg
Generating headers from msg/mc_att_ctrl_status.msg
Generating headers from msg/estimator_status.msg
Generating headers from msg/time_offset.msg
Generating headers from msg/sensor_baro.msg
mission_result.h: new header file
actuator_direct.h: new header file
actuator_controls_1.h: new header file
actuator_controls_virtual_mc.h: new header file
wind_estimate.h: new header file
time_offset.h: new header file
optical_flow.h: new header file
pwm_input.h: new header file
sensor_combined.h: new header file
actuator_controls_virtual_fw.h: new header file
actuator_controls.h: new header file
sensor_accel.h: new header file
safety.h: new header file
output_pwm.h: new header file
vehicle_local_position_setpoint.h: new header file
vehicle_gps_position.h: new header file
offboard_control_mode.h: new header file
actuator_controls_3.h: new header file
home_position.h: new header file
tecs_status.h: new header file
estimator_status.h: new header file
manual_control_setpoint.h: new header file
multirotor_motor_limits.h: new header file
sensor_baro.h: new header file
vehicle_command.h: new header file
hil_sensor.h: new header file
mission.h: new header file
vehicle_global_velocity_setpoint.h: new header file
esc_report.h: new header file
vehicle_rates_setpoint.h: new header file
subsystem_info.h: new header file
actuator_outputs.h: new header file
vtol_vehicle_status.h: new header file
vehicle_attitude_setpoint.h: new header file
camera_trigger.h: new header file
battery_status.h: new header file
actuator_armed.h: new header file
fence_vertex.h: new header file
filtered_bottom_flow.h: new header file
telemetry_status.h: new header file
position_setpoint_triplet.h: new header file
satellite_info.h: new header file
position_setpoint.h: new header file
rc_channels.h: new header file
vehicle_attitude.h: new header file
mc_att_ctrl_status.h: new header file
vehicle_global_position.h: new header file
actuator_controls_0.h: new header file
vehicle_land_detected.h: new header file
vehicle_local_position.h: new header file
test_motor.h: new header file
att_pos_mocap.h: new header file
vehicle_status.h: new header file
differential_pressure.h: new header file
fence.h: new header file
vision_position_estimate.h: new header file
encoders.h: new header file
navigation_capabilities.h: new header file
esc_status.h: new header file
actuator_controls_2.h: new header file
debug_key_value.h: new header file
parameter_update.h: new header file
sensor_mag.h: new header file
mc_virtual_rates_setpoint.h: new header file
airspeed.h: new header file
rc_parameter_map.h: new header file
sensor_gyro.h: new header file
vehicle_force_setpoint.h: new header file
geofence_result.h: new header file
distance_sensor.h: new header file
fw_virtual_rates_setpoint.h: new header file
input_rc.h: new header file
vehicle_control_mode.h: new header file
system_power.h: new header file
servorail_status.h: new header file
[  9%] Built target msg_files
Scanning dependencies of target platform
[ 12%] Building C object CMakeFiles/platform.dir/src/platforms/common/px4_log.c.o
[ 16%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/ringbuffer.cpp.o
[ 19%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/vfile.cpp.o
[ 22%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/vdev.cpp.o
[ 25%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/device_posix.cpp.o
[ 29%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/i2c_posix.cpp.o
[ 32%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/sim.cpp.o
[ 35%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/vdev_posix.cpp.o
[ 38%] Building C object CMakeFiles/platform.dir/src/platforms/posix/px4_layer/drv_hrt.c.o
[ 41%] Building C object CMakeFiles/platform.dir/src/platforms/posix/px4_layer/lib_crc32.c.o
[ 45%] Building CXX object CMakeFiles/platform.dir/src/platforms/posix/px4_layer/px4_posix_impl.cpp.o
[ 48%] Building CXX object CMakeFiles/platform.dir/src/platforms/posix/px4_layer/px4_posix_tasks.cpp.o
[ 51%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/dq_addlast.c.o
[ 54%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/dq_rem.c.o
[ 58%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/dq_remfirst.c.o
[ 61%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/hrt_queue.c.o
[ 64%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/hrt_thread.c.o
[ 67%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/hrt_work_cancel.c.o
[ 70%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/queue.c.o
[ 74%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/sq_addafter.c.o
[ 77%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/sq_addlast.c.o
[ 80%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/sq_remfirst.c.o
[ 83%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/work_cancel.c.o
[ 87%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/work_lock.c.o
[ 90%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/work_queue.c.o
[ 93%] Building C object CMakeFiles/platform.dir/src/platforms/posix/work_queue/work_thread.c.o
Linking CXX static library libplatform.a
[ 93%] Built target platform
Scanning dependencies of target px4_simple_app
[ 96%] Building C object src/examples/px4_simple_app/CMakeFiles/px4_simple_app.dir/px4_simple_app.c.o
Linking C static library libpx4_simple_app.a
[ 96%] Built target px4_simple_app
Scanning dependencies of target main
[100%] Building CXX object CMakeFiles/main.dir/src/platforms/posix/main.cpp.o
Linking CXX executable main
[100%] Built target main
Test project /home/jgoppert/git/px4/cmake-Firmware/build_host
    Start 1: test_main
1/1 Test #1: test_main ........................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.00 sec
CPack: Create package using ZIP
CPack: Install projects
CPack: - Run preinstall target for: px4
CPack: - Install project: px4
CPack: Create package
CPack: - package: /home/jgoppert/git/px4/cmake-Firmware/build_host/px4-0.1.2-Linux.zip generated.
jgoppert@gnubox:~/git/px4/cmake-Firmware$

After the latest refactoring, for the arm build I get a curious compile error, that looks like the includes may be incorrect:
[ 46%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/ringbuffer.cpp.obj
/home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-g++   -DCONFIG_ARCH_BOARD_PX4FMU_V2 -D__PX4_NUTTX -fno-exceptions -fno-rtti -std=gnu++0x -fno-threadsafe-statics -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Werror=unused-but-set-variable -Werror=unused-variable -Werror=double-promotion -Werror=reorder -Wno-missing-field-initializers -I/home/jgoppert/git/px4/cmake-Firmware/src -I/home/jgoppert/git/px4/cmake-Firmware/src/platforms -I/home/jgoppert/git/px4/cmake-Firmware/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/src/include -I/home/jgoppert/git/px4/cmake-Firmware/src/lib/eigen -I/home/jgoppert/git/px4/cmake-Firmware/src/lib -I/home/jgoppert/git/px4/cmake-Firmware/build_arm -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules/px4_messages -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/arch/chip    -o CMakeFiles/platform.dir/src/drivers/device/ringbuffer.cpp.obj -c /home/jgoppert/git/px4/cmake-Firmware/src/drivers/device/ringbuffer.cpp
In file included from /home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/stddef.h:43:0,
                 from /home/jgoppert/git/px4/cmake-Firmware/src/drivers/device/ringbuffer.h:42,
                 from /home/jgoppert/git/px4/cmake-Firmware/src/drivers/device/ringbuffer.cpp:40:
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/sys/types.h:179:22: error: redeclaration of C++ built-in type 'wchar_t' [-fpermissive]
 typedef uint16_t     wchar_t;

I was able to hack this by setting CXX_FLAGS = CONFIG_WCHAR_BUILTIN, but this seems wrong.

There is nothing in the Tools/genmsg directory after I do a fresh clone:
$ git clone https://github.com/jgoppert/Firmware.git
$ cd Firmware
$ git checkout cmake-nuttx
$ ./cmake/test_host.sh
-- module: px4_simple_app, stack: 1024
-- Configuring done
-- Generating done
-- Build files have been written to: /local2/mnt/workspace/cmake/Firmware/build_host
Scanning dependencies of target posix_apps
[  3%] Generating posix apps
[  3%] Built target posix_apps
Scanning dependencies of target msg_files
[  6%] Generating uORB topic headers
python import error:  No module named genmsg.template_tools
Required python packages not installed.
On a Debian/Ubuntu system please run:
sudo apt-get install python-empy
sudo pip install catkin_pkg
On MacOS please run:
sudo pip install empy catkin_pkg
On Windows please run:
easy_install empy catkin_pkg
CMakeFiles/msg_files.dir/build.make:199: recipe for target 'src/modules/uORB/topics/geofence_result.msg' failed
make[2]: *** [src/modules/uORB/topics/geofence_result.msg] Error 1
CMakeFiles/Makefile2:375: recipe for target 'CMakeFiles/msg_files.dir/all' failed
make[1]: *** [CMakeFiles/msg_files.dir/all] Error 2
Makefile:106: recipe for target 'all' failed
make: *** [all] Error 2

Tools/px_generate_uorb_topic_headers.py includes the line:
import genmsg.template_tools
The file template_tools.py does not exist when I manually do a
git submodule init
git submodule update
If I don't call these manually, then Tools/genmsg is empty.

@mcharleb  Good catch. I use this machine as a ros dev environment so I already had those installed at the system level. It should be fixed now.

Clearing dependencies in "/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/examples/px4_simple_app/CMakeFiles/px4_simple_app.dir/depend.make".
Scanning dependencies of target px4_simple_app
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make -f src/examples/px4_simple_app/CMakeFiles/px4_simple_app.dir/build.make src/examples/px4_simple_app/CMakeFiles/px4_simple_app.dir/build
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
/usr/bin/cmake -E cmake_progress_report /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles 24
[ 94%] Building C object src/examples/px4_simple_app/CMakeFiles/px4_simple_app.dir/px4_simple_app.c.obj
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm/src/examples/px4_simple_app && /home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-gcc  -DCONFIG_ARCH_BOARD_PX4FMU_V2 -D__PX4_NUTTX -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Werror=unused-but-set-variable -Werror=unused-variable -Werror=double-promotion -Werror=reorder -Werror=uninitialized -Werror=init-self -Wbad-function-cast -Wstrict-prototypes -Wold-style-declaration -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Os -g3 -std=gnu99 -fno-common -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fvisibility=hidden -include /home/jgoppert/git/px4/cmake-Firmware/src/include/visibility.h -I/home/jgoppert/git/px4/cmake-Firmware/src -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src -I/home/jgoppert/git/px4/cmake-Firmware/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/src/include -I/home/jgoppert/git/px4/cmake-Firmware/src/lib -I/home/jgoppert/git/px4/cmake-Firmware/src/platforms -I/home/jgoppert/git/px4/cmake-Firmware/src/drivers/boards -I/home/jgoppert/git/px4/cmake-Firmware/src/lib/eigen -I/home/jgoppert/git/px4/cmake-Firmware/build_arm -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules/px4_messages -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/cxx -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/arch/chip -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/arch/common    -o CMakeFiles/px4_simple_app.dir/px4_simple_app.c.obj   -c /home/jgoppert/git/px4/cmake-Firmware/src/examples/px4_simple_app/px4_simple_app.c
Linking C static library libpx4_simple_app.a
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm/src/examples/px4_simple_app && /usr/bin/cmake -P CMakeFiles/px4_simple_app.dir/cmake_clean_target.cmake
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm/src/examples/px4_simple_app && /usr/bin/cmake -E cmake_link_script CMakeFiles/px4_simple_app.dir/link.txt --verbose=1
/home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-ar cq libpx4_simple_app.a  CMakeFiles/px4_simple_app.dir/px4_simple_app.c.obj
/home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-ranlib libpx4_simple_app.a
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
/usr/bin/cmake -E cmake_progress_report /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles  24
[ 94%] Built target px4_simple_app
make -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/depend
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
cd /home/jgoppert/git/px4/cmake-Firmware/build_arm && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/main.dir/DependInfo.cmake --color=
Dependee "px4fmu-v2/NuttX/nuttx-export/include/nuttx/config.h" is newer than depends file "/home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/main.dir/depend.internal".
Clearing dependencies in "/home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles/main.dir/depend.make".
Scanning dependencies of target main
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
make -f CMakeFiles/main.dir/build.make CMakeFiles/main.dir/build
make[2]: Entering directory `/home/jgoppert/git/px4/cmake-Firmware/build_arm'
/usr/bin/cmake -E cmake_progress_report /home/jgoppert/git/px4/cmake-Firmware/build_arm/CMakeFiles 12
[100%] Building C object CMakeFiles/main.dir/cmake/builtin_commands.c.obj
/home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-gcc  -DCONFIG_ARCH_BOARD_PX4FMU_V2 -D__PX4_NUTTX -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Werror=unused-but-set-variable -Werror=unused-variable -Werror=double-promotion -Werror=reorder -Werror=uninitialized -Werror=init-self -Wbad-function-cast -Wstrict-prototypes -Wold-style-declaration -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Os -g3 -std=gnu99 -fno-common -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fvisibility=hidden -include /home/jgoppert/git/px4/cmake-Firmware/src/include/visibility.h -I/home/jgoppert/git/px4/cmake-Firmware/src -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src -I/home/jgoppert/git/px4/cmake-Firmware/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/src/include -I/home/jgoppert/git/px4/cmake-Firmware/src/lib -I/home/jgoppert/git/px4/cmake-Firmware/src/platforms -I/home/jgoppert/git/px4/cmake-Firmware/src/drivers/boards -I/home/jgoppert/git/px4/cmake-Firmware/src/lib/eigen -I/home/jgoppert/git/px4/cmake-Firmware/build_arm -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules/px4_messages -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/include/cxx -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/arch/chip -I/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/arch/common    -o CMakeFiles/main.dir/cmake/builtin_commands.c.obj   -c /home/jgoppert/git/px4/cmake-Firmware/cmake/builtin_commands.c
Linking C executable main
/usr/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-gcc  -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Werror=unused-but-set-variable -Werror=unused-variable -Werror=double-promotion -Werror=reorder -Werror=uninitialized -Werror=init-self -Wbad-function-cast -Wstrict-prototypes -Wold-style-declaration -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Os -g3 -std=gnu99 -fno-common -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fvisibility=hidden -include /home/jgoppert/git/px4/cmake-Firmware/src/include/visibility.h  -Wl,-gc-sections -Wl,--warn-common -Wl,--gc-sections -T/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/build/ld.script -Wl,-Map=/home/jgoppert/git/px4/cmake-Firmware/build_arm/main.map CMakeFiles/main.dir/cmake/builtin_commands.c.obj  -o main  -L/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs  src/examples/px4_simple_app/libpx4_simple_app.a -lapps -lnuttx -lc -lm
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(arch-stm32_start.o): In function `__start':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/arch/arm/src/chip/stm32_start.c:254: undefined reference to `stm32_boardinitialize'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-os_bringup.o): In function `os_bringup':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/os_bringup.c:244: undefined reference to `nsh_main'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-task_terminate.o): In function `task_terminate':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/task_terminate.c:183: undefined reference to `sched_note_stop'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(arch-stm32_otgfsdev.o): In function `stm32_resumeinterrupt':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/arch/arm/src/chip/stm32_otgfsdev.c:3032: undefined reference to `stm32_usbsuspend'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(arch-stm32_otgfsdev.o): In function `stm32_suspendinterrupt':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/arch/arm/src/chip/stm32_otgfsdev.c:3094: undefined reference to `stm32_usbsuspend'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-sched_addreadytorun.o): In function `sched_addreadytorun':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/sched_addreadytorun.c:128: undefined reference to `sched_note_switch'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-sched_mergepending.o): In function `sched_mergepending':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/sched_mergepending.c:138: undefined reference to `sched_note_switch'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-sched_removereadytorun.o): In function `sched_removereadytorun':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/sched_removereadytorun.c:109: undefined reference to `sched_note_switch'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-task_activate.o): In function `task_activate':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/task_activate.c:104: undefined reference to `sched_note_stop'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/task_activate.c:111: undefined reference to `sched_note_start'
collect2: error: ld returned 1 exit status
make[2]: *** [main] Error 1

Several of the previous errors were just do to unbuilt modules. I'm making more progress after adding stm32 drivers and systemlib modules, I did break the host build in the meantime, but going to finish getting nuttx up first:
20%] Built target msg_files
[ 23%] Building C object src/drivers/stm32/CMakeFiles/stm32_drivers.dir/drv_pwm_servo.c.obj
Linking C static library libstm32_drivers.a
[ 25%] Built target stm32_drivers
Scanning dependencies of target git_eigen
[ 28%] Generating git_eigen.stamp
[ 28%] Built target git_eigen
Scanning dependencies of target platform
[ 30%] Building C object CMakeFiles/platform.dir/src/platforms/common/px4_log.c.obj
[ 33%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/ringbuffer.cpp.obj
[ 35%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/cdev.cpp.obj
[ 38%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/device_nuttx.cpp.obj
[ 41%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/i2c_nuttx.cpp.obj
[ 43%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/pio.cpp.obj
[ 46%] Building CXX object CMakeFiles/platform.dir/src/drivers/device/spi.cpp.obj
Linking CXX static library libplatform.a
[ 46%] Built target platform
Scanning dependencies of target systemlib
[ 48%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/perf_counter.c.obj
[ 51%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/param/param.c.obj
[ 53%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/conversions.c.obj
[ 56%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/cpuload.c.obj
[ 58%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/pid/pid.c.obj
[ 61%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/airspeed.c.obj
[ 64%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/system_params.c.obj
[ 66%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/mavlink_log.c.obj
[ 69%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/rc_check.c.obj
[ 71%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/otp.c.obj
[ 74%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/board_serial.c.obj
[ 76%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/pwm_limit/pwm_limit.c.obj
[ 79%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/mcu_version.c.obj
[ 82%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/bson/tinybson.c.obj
[ 84%] Building CXX object src/modules/systemlib/CMakeFiles/systemlib.dir/circuit_breaker.cpp.obj
[ 87%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/circuit_breaker_params.c.obj
[ 89%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/err.c.obj
[ 92%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/printload.c.obj
[ 94%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/up_cxxinitialize.c.obj
Linking CXX static library libsystemlib.a
[ 94%] Built target systemlib
Scanning dependencies of target px4_simple_app
[ 97%] Building C object src/examples/px4_simple_app/CMakeFiles/px4_simple_app.dir/px4_simple_app.c.obj
Linking C static library libpx4_simple_app.a
[ 97%] Built target px4_simple_app
Scanning dependencies of target main
[100%] Building C object CMakeFiles/main.dir/cmake/builtin_commands.c.obj
Linking CXX executable main
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(arch-stm32_start.o): In function `__start':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/arch/arm/src/chip/stm32_start.c:254: undefined reference to `stm32_boardinitialize'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-os_bringup.o): In function `os_bringup':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/os_bringup.c:244: undefined reference to `nsh_main'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(arch-stm32_otgfsdev.o): In function `stm32_resumeinterrupt':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/arch/arm/src/chip/stm32_otgfsdev.c:3032: undefined reference to `stm32_usbsuspend'
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(arch-stm32_otgfsdev.o): In function `stm32_suspendinterrupt':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/arch/arm/src/chip/stm32_otgfsdev.c:3094: undefined reference to `stm32_usbsuspend'

Current host build issue:
[ 66%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/board_serial.c.o
cd /home/jgoppert/git/px4/cmake-Firmware/build_host/src/modules/systemlib && /usr/bin/cc  -DCLOCK_MONOTONIC=1 -D__EXPORT="" -D__PX4_LINUX -D__PX4_POSIX -Dnoreturn_function="" -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Werror=unused-but-set-variable -Werror=unused-variable -Werror=double-promotion -Werror=reorder -Werror=uninitialized -Werror=init-self -Wbad-function-cast -Wstrict-prototypes -Wold-style-declaration -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs -Os -g3 -std=gnu99 -fno-common -I/home/jgoppert/git/px4/cmake-Firmware/src -I/home/jgoppert/git/px4/cmake-Firmware/build_host/src -I/home/jgoppert/git/px4/cmake-Firmware/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/src/include -I/home/jgoppert/git/px4/cmake-Firmware/src/lib -I/home/jgoppert/git/px4/cmake-Firmware/src/platforms -I/home/jgoppert/git/px4/cmake-Firmware/src/drivers/boards/sim -I/home/jgoppert/git/px4/cmake-Firmware/src/lib/eigen -I/home/jgoppert/git/px4/cmake-Firmware/build_host -I/home/jgoppert/git/px4/cmake-Firmware/build_host/src/modules/px4_messages -I/home/jgoppert/git/px4/cmake-Firmware/build_host/src/modules -I/home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/include    -Os -Wno-sign-compare -o CMakeFiles/systemlib.dir/board_serial.c.o   -c /home/jgoppert/git/px4/cmake-Firmware/src/modules/systemlib/board_serial.c
In file included from /usr/include/unistd.h:217:0,
                 from /home/jgoppert/git/px4/cmake-Firmware/src/modules/systemlib/otp.h:56,
                 from /home/jgoppert/git/px4/cmake-Firmware/src/modules/systemlib/board_serial.c:43:
/usr/include/x86_64-linux-gnu/bits/types.h:30:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
 typedef unsigned char __u_char;
 ^
compilation terminated due to -Wfatal-errors.
make[2]: *** [src/modules/systemlib/CMakeFiles/systemlib.dir/board_serial.c.o] Error 1
make[2]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_host'
make[1]: *** [src/modules/systemlib/CMakeFiles/systemlib.dir/all] Error 2
make[1]: Leaving directory `/home/jgoppert/git/px4/cmake-Firmware/build_host'

I fixed the host build now. It was some incorrect build flags.

I have unit testing up and running with cmake. Here is an example of a test I setup to fail on sitl.
jgoppert@gnubox:~/git/px4/cmake-Firmware/build_host$ ctest -V
UpdateCTestConfiguration  from :/home/jgoppert/git/px4/cmake-Firmware/build_host/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/jgoppert/git/px4/cmake-Firmware/build_host/DartConfiguration.tcl
Test project /home/jgoppert/git/px4/cmake-Firmware/build_host
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 1
    Start 1: test_main

1: Test command: /home/jgoppert/git/px4/cmake-Firmware/cmake/test_compare.py "--command" "/home/jgoppert/git/px4/cmake-Firmware/build_host/main" "--stdout" "/home/jgoppert/git/px4/cmake-Firmware/build_host/test/test1_output.txt" "--stdin" "/home/jgoppert/git/px4/cmake-Firmware/cmake/test/test1_input.txt" "--check" "/home/jgoppert/git/px4/cmake-Firmware/cmake/test/test1_correct.txt" "--start" "4" "--stop" "-1"
1: Test timeout computed to be: 9.99988e+06
1: output:
1:  App name: mainapp
1: Enter a command and its args:
1: ----------------------------------
1: Running: sleep
1: Returning: sleep
1: Enter a command and its args:
1: ----------------------------------
1: Running: shutdown
1:
1: check:
1:  App name: mainapp
1: Enter a command and its args:
1: ----------------------------------
1: Running: shutdown
1:
1/1 Test #1: test_main ........................***Failed    1.07 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   1.07 sec

The following tests FAILED:
	  1 - test_main (Failed)
Errors while running CTest

The main part remaining is porting the rest of the base modules to get a minimal nuttx example running. The current status of the host build is broken, waiting for me to add the correct modules. The nuttx build is also broken in a similar fashion, but should work once I add the minimal subset of modules.
https://github.com/jgoppert/Firmware/blob/cmake-nuttx/cmake_port_status

@LorenzMeier @mcharleb If you guys could take a look at this and make sure you like the general direction I'm going while I get some sleep I'd appreciate it. And if you have any idea of the minimal module set I need to get online, want to help write them, that would be great too.

@LorenzMeier I have asked Mike to have a look at it since he is more familiar with cmake. I'll have a look at it tomorrow and provide comments (11pm here).

@mcharleb  Thanks.
I now have added enough modules for the host build to be fixed, you can test it with
./cmake/test_host.sh

Very close to getting both and host and nuttx versions bulidings, here is the nuttx build error for latest commit:
[  1%] Generating uORB topic multi headers for nuttx
[  1%] Built target msg_files_multi
[  3%] Built target git_nuttx
[  3%] Built target nuttx_patch
[  4%] Built target nuttx_copy_px4fmu-v2
[  8%] Built target NuttX_px4fmu-v2
[  9%] Built target git_gencpp
[ 11%] Built target git_genmsg
[ 13%] Generating uORB topic headers
[ 13%] Built target msg_files
[ 14%] Built target platform_common
[ 45%] Built target systemlib
[ 47%] Built target perf
[ 57%] Built target px4fmu-v2
[ 59%] Built target led
[ 68%] Built target device
[ 78%] Built target mixerlib
[ 81%] Built target stm32_drivers
[ 83%] Built target platform_nuttx
[ 85%] Built target platform_nuttx_px4_layer
[ 86%] Built target px4_simple_app
[ 98%] Built target uorb
Scanning dependencies of target main
Linking CXX executable main
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(cxx-libxx_cxa_atexit.o): In function `__cxa_atexit':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/libxx/libxx_cxa_atexit.cxx:144: multiple definition of `__dso_handle'
/home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/../lib/gcc/arm-none-eabi/4.8.4/armv7e-m/fpu/crtbegin.o:(.data+0x0): first defined here
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(sched-os_bringup.o): In function `os_bringup':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/sched/os_bringup.c:244: undefined reference to `nsh_main'
collect2: error: ld returned 1 exit status
make[2]: *** [main] Error 1

I have a 14.04 machine with cmake <IP_ADDRESS>
I performed the following:
$ git clone https://github.com/jgoppert/Firmware px4_cmake
$ cd px4_cmake
$ git checkout cmake-nuttx
$ ./cmake/test_host.sh
And this is what I get:
-- The CXX compiler identification is GNU 4.8.2
-- The C compiler identification is GNU 4.8.2
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- module: led
stack:
main:
-- module: device
stack:
main:
-- module: systemlib
stack:
main:
-- module: mixerlib
stack:
main:
-- module: platform_common
stack:
main:
-- module: posix_px4_layer
stack:
main:
-- module: work_queue
stack:
main:
-- module: px4_simple_app
stack: 1024
main: px4_simple_app_main
-- module: uorb
stack: 2048
main: uorb_app_main
-- module: perf
stack: 1800
main: perf
-- Configuring done
-- Generating done
-- Build files have been written to: /local/mnt/workspace/mdevico/repo/px4_cmake/build_host
Scanning dependencies of target git_genmsg
[  1%] Generating git_genmsg.stamp
[  1%] Built target git_genmsg
Scanning dependencies of target git_gencpp
[  3%] Generating git_gencpp.stamp
[  3%] Built target git_gencpp
Scanning dependencies of target msg_files
[  4%] Generating uORB topic headers
python import error:  No module named genmsg.template_tools
Required python packages not installed.
On a Debian/Ubuntu system please run:
sudo apt-get install python-empy
sudo pip install catkin_pkg
On MacOS please run:
sudo pip install empy catkin_pkg
On Windows please run:
easy_install empy catkin_pkg
make[2]: *** [src/modules/uORB/topics/fw_virtual_rates_setpoint.msg] Error 1
make[1]: *** [CMakeFiles/msg_files.dir/all] Error 2
make: *** [all] Error 2
I know those packages are already installed, but just to make sure I tried reinstalling them:
apt-get install python-empy
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-empy is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 331 not upgraded.
pip install catkin_pkg
Requirement already satisfied (use --upgrade to upgrade): catkin-pkg in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.7 (from catkin-pkg)
Requirement already satisfied (use --upgrade to upgrade): docutils in /usr/local/lib/python2.7/dist-packages (from catkin-pkg)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python2.7/dist-packages (from catkin-pkg)
Cleaning up...
The real problem is:
python import error:  No module named genmsg.template_tools
The module definitely exists at cmake_px4/Tools/genmsg/src/genmsg/template_tools.pyc
For reference I can build a previous version of px4 tree on the same machine using the traditional makefiles just fine.
So what's wrong with my setup?

@modevico  Please try to pull. I added find_package(PythonInterp). I think I was accidentally using an environment variable to find my interpreter instead of this.

CMake will tell you which python that it found, if this version doesn't have the packages installed, it will cause errors. Also, I think I need to add the Tools directory to the python path in order for the git repo versions of the python modules to work correctly.

Seeing same issue even after the pull

OK. Those commands were using /usr/bin/env python, try it now. If it still doesn't work, I need to figure out how to set the python path in a cmake custom command, shouldn't be too bad.

@modevico let me know if it still doesn't build

Same issue... :(
I definitely think it's a PYTHONPATH issue. The traditional makefiles set it.

@modevico OK. Think I set the pythonpath now. Give it a shot.

Now I get:
CMake Error: cmake version <IP_ADDRESS>
Usage: /usr/bin/cmake -E [command] [arguments ...]
Available commands:
chdir dir cmd [args]...   - run command in a given directory
compare_files file1 file2 - check if file1 is same as file2
copy file destination     - copy file to destination (either file or directory)
copy_directory source destination   - copy directory 'source' content to directory 'destination'
copy_if_different in-file out-file  - copy file if input has changed
echo [string]...          - displays arguments as text
echo_append [string]...   - displays arguments as text but no new line
environment               - display the current environment
make_directory dir        - create a directory
md5sum file1 [...]        - compute md5sum of files
remove [-f] file1 file2 ... - remove the file(s), use -f to force it
remove_directory dir      - remove a directory and its contents
rename oldname newname    - rename a file or directory (on one volume)
tar [cxt][vfz][cvfj] file.tar [file/dir1 file/dir2 ...]
- create or extract a tar or zip archive
time command [args] ...   - run command and return elapsed time
touch file                - touch a file.
touch_nocreate file       - touch a file but do not create it.
Available on UNIX only:
create_symlink old new    - create a symbolic link new -> old
make[2]: *** [src/platforms/posix/px4_messages/fw_virtual_rates_setpoint.msg] Error 1
make[1]: *** [CMakeFiles/msg_files_multi.dir/all] Error 2
make: *** [all] Error 2

@modevico Thanks for working on this with me. Try a pull now. I think cmake -E env is now replaced by cmake -E environment.

@modevico That was incorrect, type cmake -E on your command line. If you don't see env that is used to set environment, maybe you need to update cmake. Or I need to find another way to do it.

@modevico , yeah, looks like cmake -E env was added in cmake 3.0. Just gonig to require that for now.
sudo add-apt-repository ppa:george-edison55/cmake-3.x
sudo apt-get update
sudo apt-get install cmake --upgrade

-E environment just displays the environment variables doesn't it? I believe the better way is to use the
set_target_properties function to add the PYTHONPATH to each of the affected targets as follows:
set_target_properties(msg_files PROPERTIES ENVIRONMENT PYTHONPATH=${PYTHONPATH})
set_target_properties(msg_files_multi PROPERTIES ENVIRONMENT PYTHONPATH=${PYTHONPATH})
set_target_properties(posix_apps PROPERTIES ENVIRONMENT PYTHONPATH=${PYTHONPATH})
After doing this I get further...
-- The CXX compiler identification is GNU 4.8.2
-- The C compiler identification is GNU 4.8.2
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.6")
-- module: led
stack:
main:
-- module: device
stack:
main:
-- module: systemlib
stack:
main:
-- module: mixerlib
stack:
main:
-- module: platform_common
stack:
main:
-- module: posix_px4_layer
stack:
main:
-- module: work_queue
stack:
main:
-- module: px4_simple_app
stack: 1024
main: px4_simple_app_main
-- module: uorb
stack: 2048
main: uorb_app_main
-- module: perf
stack: 1800
main: perf
-- Configuring done
-- Generating done
-- Build files have been written to: /local/mnt/workspace/mdevico/repo/px4_cmake/build_host
Scanning dependencies of target posix_apps
[  1%] Generating posix apps
[  1%] Built target posix_apps
Scanning dependencies of target git_genmsg
[  3%] Generating git_genmsg.stamp
[  3%] Built target git_genmsg
Scanning dependencies of target git_gencpp
[  4%] Generating git_gencpp.stamp
[  4%] Built target git_gencpp
Scanning dependencies of target msg_files
[  6%] Generating uORB topic headers
[  6%] Built target msg_files
Scanning dependencies of target msg_files_multi
[  7%] Generating uORB topic multi headers for posix
[  7%] Built target msg_files_multi
Scanning dependencies of target platform_common
[  9%] Building C object src/platforms/common/CMakeFiles/platform_common.dir/px4_getopt.c.o
Linking C static library libplatform_common.a
[  9%] Built target platform_common
Scanning dependencies of target systemlib
[ 10%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/perf_counter.c.o
[ 12%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/param/param.c.o
[ 13%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/conversions.c.o
[ 15%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/cpuload.c.o
[ 16%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/pid/pid.c.o
[ 18%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/airspeed.c.o
[ 20%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/system_params.c.o
[ 21%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/mavlink_log.c.o
[ 23%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/rc_check.c.o
[ 24%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/otp.c.o
[ 26%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/board_serial.c.o
[ 27%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/pwm_limit/pwm_limit.c.o
[ 29%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/mcu_version.c.o
[ 30%] Building C object src/modules/systemlib/CMakeFiles/systemlib.dir/bson/tinybson.c.o
[ 32%] Building CXX object src/modules/systemlib/CMakeFiles/systemlib.dir/circuit_breaker.cpp.o
In file included from /local/mnt/workspace/mdevico/repo/px4_cmake/src/platforms/px4_defines.h:75:0,
from /local/mnt/workspace/mdevico/repo/px4_cmake/src/modules/systemlib/circuit_breaker.cpp:46:
/local/mnt/workspace/mdevico/repo/px4_cmake/src/platforms/px4_includes.h:113:58: fatal error: platforms/posix/px4_messages/px4_rc_channels.h: No such file or directory
#include <platforms/posix/px4_messages/px4_rc_channels.h>
^
compilation terminated.
make[2]: *** [src/modules/systemlib/CMakeFiles/systemlib.dir/circuit_breaker.cpp.o] Error 1
make[1]: *** [src/modules/systemlib/CMakeFiles/systemlib.dir/all] Error 2
make: *** [all] Error 2

Nice. Yeah that looks better. I'm not sure why, but your message generation calls to the python aren't doing anything. Those headers are generated and it shows it calling the target, but no output showing they are generating correctly.

If we are assuming a dependency on a specific version of cmake then you should add:
cmake_minimum_required(VERSION major[.minor[.patch[.tweak]]]
[FATAL_ERROR])

This will force the issue

@modevico  done. We can always make it 2.8 compat. later.

Yeah, that's what I meant.

Do we really need 3.0 at this point?

I see your referencing CMP0046. What's this used for?

@modevico  That is a 3.0 policy. That is just saying that it isn't okay for a target to depend on dependencies that don't exist. Think I put a comment next to it.

@modevico  I have to head out for a bit. If you can get it buliding with 2.8 with your env fix, that is better. Just submit a pull request.

I did get it building on cloud9 now with minimal effort thanks to your help/changes, so hopefully all of the issues have been resolved with python for ubuntu at least.

Yeah, unfortunately 3.0 is part of my ubuntu repo. Even after the update is still says that 2.8 is the latest

@modevico @mcharleb was originally trying to built it with 3.0 so I migrated to that and encountered that policy issue. You can just wrap that in a conditional if verision > 3.0.

Okay, I got it to build all the way through. If you apply the following patch this should do it:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d52bf7c..3365f28 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,11 +1,10 @@
##############################################################################
PX4 Autopilot Project

-cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(px4 CXX C ASM)
-cmake_policy(SET CMP0046 NEW) # no non-existent deps
-set(ENV{PYTHONPATH} ${CMAKE_SOURCE_DIR}/Tools)
+set(PYTHONPATH "${CMAKE_SOURCE_DIR}/Tools/genmsg/src:${CMAKE_SOURCE_DIR}/Tools/gencpp/src:$ENV{PYTHONPATH}" CACHE INTERNAL "PYTHONPATH" )
##############################################################################
Parameters
@@ -149,14 +148,13 @@ list_prepend(
LIST ${MSG_FILES}
PATH ${MSG_OUT_PATH})
#message(STATUS "msg files out ${MSG_FILES_OUT}")
-set(PYTHONPATH "${CMAKE_SOURCE_DIR}/Tools/genmsg/src:${CMAKE_SOURCE_DIR}/Tools/gencpp/src:$ENV{PYTHONPATH}")
add_custom_command(OUTPUT ${MSG_FILES_OUT}

  COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHONPATH}

  ${PYTHON_EXECUTABLE} Tools/px_generate_uorb_topic_headers.py

  COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} Tools/px_generate_uorb_topic_headers.py
          -d msg
          -o ${MSG_OUT_PATH}
          -e msg/templates/uorb
          -t ${CMAKE_BINARY_DIR}/topics_temporary

   VERBATIM
  DEPENDS git_genmsg git_gencpp ${MSG_FILES_IN}
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  COMMENT "Generating uORB topic headers"

@@ -174,13 +172,13 @@ list_prepend(
PATH ${MSG_MULTI_OUT_PATH})
#message(STATUS "files out: ${MSG_MULTI_FILES_OUT}")
add_custom_command(OUTPUT ${MSG_MULTI_FILES_OUT}

  COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHONPATH}

  ${PYTHON_EXECUTABLE} Tools/px_generate_uorb_topic_headers.py

  COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} Tools/px_generate_uorb_topic_headers.py
          -d msg
          -o ${MSG_MULTI_OUT_PATH}
          -e msg/templates/px4/uorb
          -t ${CMAKE_BINARY_DIR}/multi_topics_temporary/${TARGET_OS}
          -p "px4_"

   VERBATIM
  DEPENDS ${MSG_FILES_IN}
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  COMMENT "Generating uORB topic multi headers for ${TARGET_OS}"

@@ -191,8 +189,8 @@ add_custom_target(msg_files_multi DEPENDS ${MSG_MULTI_FILES_OUT})
apps

add_custom_command(OUTPUT ${POSIX_APPS_HEADER}

  COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHONPATH}

  ${PYTHON_EXECUTABLE} Tools/posix_apps.py > ${POSIX_APPS_HEADER}

  COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE} Tools/posix_apps.py > ${POSIX_APPS_HEADER}

VERBATIM
COMMENT "Generating posix apps"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
diff --git a/src/modules/systemlib/mixer/CMakeLists.txt b/src/modules/systemlib/mixer/CMakeLists.txt
index 1523fbd..842b48c 100644
--- a/src/modules/systemlib/mixer/CMakeLists.txt
+++ b/src/modules/systemlib/mixer/CMakeLists.txt
@@ -6,8 +6,7 @@ set(BIN ${CMAKE_CURRENT_BINARY_DIR})
set(SRC ${CMAKE_CURRENT_SOURCE_DIR})

add_custom_command(OUTPUT ${BIN}/mixer_multirotor.generated.h

  COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHONPATH}

  ${PYTHON_EXECUTABLE} ./multi_tables.py > ${BIN}/mixer_multirotor.generated.h

  COMMAND ${PYTHON_EXECUTABLE} ./multi_tables.py > ${BIN}/mixer_multirotor.generated.h
  WORKING_DIRECTORY ${SRC}
  )

Works for me on 3.0 now as well. Go ahead and make sure that I didn't break anything.

Did a fresh pull and everything still works for me!

So what's the plan to include the rest of the platform/targets?

@modevico Per the discussion above on cmake 3.0; that is the default on Ubuntu 15.04.

That's fine.

@modevico  I'm still completing the build for nuttx and posix. I made a lot of progress on the posix sitl build. I think i just need to get some more modules online for this to be working. The next on the list for me is the ROS build.
jgoppert@gnubox:~/git/px4/cmake-Firmware$ ./cmake/test_host.sh
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jgoppert/git/px4/cmake-Firmware/build_host
[  1%] Built target git_gencpp
[  3%] Built target git_genmsg
[  4%] Generating uORB topic headers
[  4%] Built target msg_files
[  6%] Generating uORB topic multi headers for posix
[  6%] Built target msg_files_multi
[  7%] Built target posix_apps
[  9%] Built target platform_common
[ 20%] Built target uorb
[ 21%] Built target led
[ 32%] Built target device
[ 57%] Built target systemlib
[ 67%] Built target mixerlib
[ 75%] Built target posix_px4_layer
[ 96%] Built target work_queue
[ 98%] Built target px4_simple_app
[100%] Built target main
UpdateCTestConfiguration  from :/home/jgoppert/git/px4/cmake-Firmware/build_host/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/jgoppert/git/px4/cmake-Firmware/build_host/DartConfiguration.tcl
Test project /home/jgoppert/git/px4/cmake-Firmware/build_host
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
 What about something like:
build_nuttx, build_posix, and build_qurt directories for the target OSes? The builds for specific configs would be in the appropriate build dir. If the user ran:
make posix posix_sitl

It would make the build in the build_posix directory.
@jgoppert Is this along the lines of what you were planning?

@mcharleb I was planning to have a python script at root that would have the same targets that we currently have and have it call cmake with the correct flags passed, create a build directory etc, (similar to my bash scripts cmake/test_host.sh/ test_arm.sh), but I'm open to other ideas.  I like to be be able to nuke build directories with rm -rf build* and similarly ignore them using .gitignore: build*/

I got the posix app running and test passing:
INFO  Shell id is<PHONE_NUMBER>31808
WARN  1          starting task wkr_high (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146)
WARN  43         starting task wkr_low (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146)
WARN  103        starting task wkr_hrt (file /home/jgoppert/git/px4/cmake-Firmware/src/platforms/posix/px4_layer/px4_posix_tasks.cpp line 146)
App name: mainapp
Enter a command and its args:
----------------------------------
Running: uorb
Returning: uorb
Enter a command and its args:
----------------------------------
Running: sleep
Returning: sleep
Enter a command and its args:
----------------------------------
Running: px4_simple_app
Hello Sky!
[px4_simple_app] Accelerometer:	  0.0000	  0.0000	  0.0000
[px4_simple_app] Accelerometer:	  0.0000	  0.0000	  0.0000
[px4_simple_app] Accelerometer:	  0.0000	  0.0000	  0.0000
[px4_simple_app] Accelerometer:	  0.0000	  0.0000	  0.0000
[px4_simple_app] Accelerometer:	  0.0000	  0.0000	  0.0000
Returning: px4_simple_app
Enter a command and its args:
----------------------------------
Running: sleep
Returning: sleep
Enter a command and its args:
----------------------------------
Running: shutdown
Shutting down

To get nuttx running I need to get the app source code generation working, basically convert nuttx_romfs.mk

This could also be accomplished
with without the need for top-level Python script. We could have the one
CMakeList.txt that we could pass a list of targets to. This would create
one toplevel build folder under which
each of the individual target folders would be generated. The toplevel build folder could then be added to the .gitignore. To build a given target one would only have to cd into the toplevel build folder and type make .

On Aug 26, 2015, at 7:17 PM, James Goppert<EMAIL_ADDRESS>wrote:
@mcharleb I was planning to have a python script at root that would have the same targets that we currently have and have it call cmake with the correct flags passed, create a build directory etc, (similar to my bash scripts cmake/test_host.sh/ test_arm.sh), but I'm open to other ideas.  I like to be be able to nuke build directories with rm -rf build* and similarly ignore them using .gitignore: build*/
—
Reply to this email directly or view it on GitHub.

@jgoppert When I do a fresh clone I still have the issue that genmsg seems to be missing. When I run test_host.sh a second time it seems to fetch genmsg:
$ git clone https://github.com/jgoppert/Firmware.git
$ git checkout cmake-nuttx
$ ./cmake/test_host.sh
-- The CXX compiler identification is GNU 4.9.2
-- The C compiler identification is GNU 4.9.2
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.9")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mcharleb/work/Dronecode/PX4/cmake/Firmware/build_host
Scanning dependencies of target msg_files_multi
[  1%] Generating uORB topic multi headers for posix
python import error:  No module named genmsg.template_tools
Attempt 2
$ ./cmake/test_host.sh
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mcharleb/work/Dronecode/PX4/cmake/Firmware/build_host
Scanning dependencies of target posix_apps
[  1%] Generating posix apps
[  1%] Built target posix_apps
Scanning dependencies of target git_genmsg
[  3%] Generating git_genmsg.stamp
Submodule 'Tools/genmsg' (https://github.com/ros/genmsg.git) registered for path 'Tools/genmsg'
Cloning into 'Tools/genmsg'...
remote: Counting objects: 1660, done.
remote: Total 1660 (delta 0), reused 0 (delta 0), pack-reused 1660
Receiving objects: 100% (1660/1660), 359.56 KiB | 54.00 KiB/s, done.
Resolving deltas: 100% (876/876), done.
Checking connectivity... done.
Submodule path 'Tools/genmsg': checked out '72f0383f0e6a489214c51802ae12d6e271b1e454'
[  3%] Built target git_genmsg
(succeeds, but then failes test)
...
1/1 Test #1: test_px4_simple_app ..............***Failed    2.18 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) =   2.18 sec
The following tests FAILED:
1 - test_px4_simple_app (Failed)
Errors while running CTest

I am working on adding QuRT support. As I start getting into this I am encountering a few issues with the current design. Too many of the compiler specific flags are set in CMakeLists.txt. QuRT uses a clang based compiler and has many unique flags and paths that have to be set. These are all set in the compiler specific settings file
Setting:
set(CMAKE_SYSTEM_NAME qurt)
set(CMAKE_SYSTEM_PROCESSOR hexagon)
set(CMAKE_SYSTEM_VERSION 1)
will automatically call the file qurt-compiler-hexagon.cmake
That file contains all the compiler specific settings for CC, CXX, LD, CFLAGS, LDFLAGS, etc
If the CMakefileLists.txt file contained the following additional sets of information for a desired target, the correct compiler settings file would automatically be called:
set(CMAKE_SYSTEM_NAME nuttx)
set(CMAKE_SYSTEM_PROCESSOR arm)
calls nuttx-compler-arm.cmake
set(CMAKE_SYSTEM_NAME posix)
set(CMAKE_SYSTEM_PROCESSOR native)
calls posix-compiler-native.cmake
set(CMAKE_SYSTEM_NAME posix)
set(CMAKE_SYSTEM_PROCESSOR armv7hf)
calls posix-compiler-armv7hf

Module directories are currently set per target OS, not per configuration. We need to be able to build several different configurations of sets of modules on both linux-armv7hf and qurt-hexagon. There has to be a ways to specify several module configurations per OS target and include those based on all cmake file in a particular subdir for instance.

@mcharleb My intention was that modules be set per os or per configuration. So that we show exactly what our logic is on including a certain module. For instance, all simple configs get a px4_simple_app, but only px4fmu-v2 board gets a px4fmu-v2 app.

@mcharleb I like the idea of build flags being included from posix-gcc-native.cmake or posix-clang-native.cmake, but I think as a goal, we want to keep as many flags in common as possible, and to my point on your qurt work, maybe the if statements would be better at highlighting the differences in build flags, but I'm open to whatever seems the simplest to everyone.

@mcharleb I was able to reproduce the bug that after a fresh clone, the pythonpath was not being set. After switching back to the cmake 3.0 syntax for setting the environment in a custom command, this went away. @modevico I think for now I'm going to stick with cmake 3.0. It also seems to have better syntax checking, after the switch I found a dangling endif(). @modevico If you still can't get cmake 3.0 on your system let me know, seems odd, are you running ubuntu 14.04?

@mcharleb When your test failed, what was the output? It should be in build_host/test/px4_simple_app_output.txt

@mcharleb @modevico , I found the reason it would unreliably clone the genmsg, gencpp repos before trying to call the, it was a missing dependency of the msg_files_multi target. I rolled back so we have 2.8 compatibility now, but I'm still using cmake 3.0 for dev due to the syntax checking.

Yes. I'm running 14.04. I can always download the cmake 3.x source and build it. I've had to do that before, but do we really want to require folks not running 15.04 to have to do this?

@modevico  Agreed. It should still work with 2.8 now.

Actually, looks like they have a prebuilt binary on the cmake site now. That's new!

So are we targeting 2.8 or 3.x then? If we are targeting 2.8 then we should all be using 2.8 especially now that we still settings things up. Otherwise we run the risk of one person doing something that only works in 3.0, and the next person (running 2.8) hits the problem. I'm okay either way. I'll move to 3.1 (the absolute latest). I just want us all to be starting at the same point is all.

Actually, the latest is 3.3.1 not 3.1. My bad.

@modevico 3.0 and greater seem to be better for cmake development, so I'd recommend upgrading if you can, I think it should still be a goal to support 2.8, but we can worry about that after we finish. I'm using cmake 3.2.

Is this the default version for Ubuntu 15.04?

So you're using 3.2.0?

@modevico Yes, I'm using cmake 3.2.0.

@jgoppert Somehow I had missed the comments in this thread. I have a cmake_qurt branch that is now close to building and fixed the files and flags for QuRT. I also integrated some changes from @modevico that make it easy to share rule but generate new target makefiles independent of the other targets.

@mcharleb , Nice. Let's try to get that merged with my nuttx work soon. Here is where I am with nuttx, only one link error left:
I also still need to create the rom image and create the builtin list automatically, but this is hacking that to work right now by creating a custom builtin_commands.c.
@LorenzMeier Any ideas to get around this build error? It appears that the __dso_handle is defined twice, I must be missing something.
Linking CXX executable main
/usr/bin/cmake -E cmake_link_script CMakeFiles/main.dir/link.txt --verbose=1
/home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/arm-none-eabi-g++   -fno-exceptions -fno-rtti -std=gnu++0x -fno-threadsafe-statics -DCONFIG_WCHAR_BUILTIN -D__CUSTOM_FILE_IO__ -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wall -Wextra -Wdouble-promotion -Wshadow -Wfloat-equal -Wframe-larger-than=1024 -Wpointer-arith -Wlogical-op -Wmissing-declarations -Wpacked -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Wformat=1 -Werror=unused-but-set-variable -Werror=unused-variable -Werror=double-promotion -Werror=reorder -Werror=uninitialized -Werror=init-self -Wno-missing-field-initializers -Os -g3 -fvisibility=hidden -include /home/jgoppert/git/px4/cmake-Firmware/src/include/visibility.h  -Wl,-gc-sections -Wl,--warn-common -Wl,--gc-sections -T/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/build/ld.script -Wl,-Map=/home/jgoppert/git/px4/cmake-Firmware/build_arm/main.map CMakeFiles/main.dir/cmake/builtin_commands.c.obj  -o main  -L/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs  -lapps -lnuttx src/drivers/boards/px4fmu-v2/libpx4fmu-v2.a src/drivers/led/libled.a src/drivers/device/libdevice.a src/modules/systemlib/libsystemlib.a src/modules/systemlib/mixer/libmixerlib.a src/platforms/common/libplatform_common.a src/drivers/stm32/libstm32_drivers.a src/platforms/nuttx/libplatform_nuttx.a src/platforms/nuttx/px4_layer/libplatform_nuttx_px4_layer.a src/examples/px4_simple_app/libpx4_simple_app.a src/modules/uORB/libuorb.a -lapps -lnuttx src/drivers/boards/px4fmu-v2/libpx4fmu-v2.a src/drivers/led/libled.a src/drivers/device/libdevice.a src/modules/systemlib/libsystemlib.a src/modules/systemlib/mixer/libmixerlib.a src/platforms/common/libplatform_common.a src/drivers/stm32/libstm32_drivers.a src/platforms/nuttx/libplatform_nuttx.a src/platforms/nuttx/px4_layer/libplatform_nuttx_px4_layer.a src/examples/px4_simple_app/libpx4_simple_app.a src/modules/uORB/libuorb.a
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx-export/libs/libnuttx.a(cxx-libxx_cxa_atexit.o): In function `__cxa_atexit':
/home/jgoppert/git/px4/cmake-Firmware/build_arm/px4fmu-v2/NuttX/nuttx/libxx/libxx_cxa_atexit.cxx:144: multiple definition of `__dso_handle'
/home/jgoppert/gcc-arm-none-eabi-4_8-2014q3/bin/../lib/gcc/arm-none-eabi/4.8.4/armv7e-m/fpu/crtbegin.o:(.data+0x0): first defined here
collect2: error: ld returned 1 exit status

Note, I also just changed the build commands to test this. I hijacked the root Makefile. This will prevent us from having to change any of the wiki pages for the end user.
d=$(PWD)

px4fmu-v2_default:
	mkdir -p $d/build_arm && cd $d/build_arm && cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-arm-none-eabi.cmake .. && make && ctest -V && cpack -G ZIP

posix-sitl:
	mkdir -p $d/build_host && cd $d/build_host && cmake .. -DTARGET_OS=posix -DTARGET_BOARD=sitl -DTARGET_LABEL=simple && make && ctest -V && cpack -G ZIP

clean:
	rm -rf build_*/

.PHONY: clean

Cool! I will look into the double definition. @davids5 any insights?

@jgoppert @LorenzMeier
I would not expect NuttX you use any Tool Chain libs (or headers) - it has it's own startup code that zeros and initializes static data. It also has code to to the do the C++ static initializers.
void* __dso_handle; is defined in the code that manages C++ static constructors/destructors.  (newlib?) of the tools chain - and should not be included in a nuttx build.

@jgoppert -
I have seen a lot of conversation on this topic, I must say understand the old build system pretty well, and how to for instance add a target board / and target configuration within the scope or nuttx. I am a little lost here. I am interested in how this will affect the nuttx_next branch.
Is there a set of high level goals described somewhere as to what the expectations of this effort are? Is there a description of that is needed to add targets and drive the buil?
nuttx next is very different in that it builds nuttx 2 times if a board/target has a bootloader, once with an NSH defconfig and once with a booloader defconfig. Then there are special cases that  use a tool in Tools to "Sign" the app build for uavcan bootloading.
So I am very curios on how I would do that same sort of things.

@jgoppert Let me send you a PR that will make the NuttX, POSIX, and QuRT builds into separate build files so we can then implement each one a bit more cleanly.
You would then follow these steps:
mkdir Build
cd  Build
cmake ..
make nuttx  # or whatever target you wanted
This would then only pull in the dependencies for that target.

The NuttX Build Works!

Still need to generate  a romfs
Still need to automatically generate the list of builtins

These should be easy now that main is linked.
@david5 Thanks! The key was linking in -lnosys.
Goals

Minimize the differences between builds of the px4 autopilot, we don't want to have bug reports from 5 different code bases. By keeping as many of the flags and source files the same, we can try to ensure that the same functionality exists on all operating systems.
Use a vanilla cmake build system that many developers are familiar with.
Make it easy to extend to new platforms.
Integrate easily with ROS.

Usage
make px4fmu-v2_default : builds the px4fmu-v2_default firmware
make posix-sitl : builds the posix sitl

Extending/ NuttX New
To extend this to new boards for nuttx it should only require that you add the nuttx configuration and then include the configuration in the CMakeLists.txt file:
set(nuttx_configs px4fmu-v2 YOUR_BOARD)

below in the cmake file this is used to add the nuttx configs
add_custom_target(link_exports)
foreach(config ${nuttx_configs})
    add_nuttx_export(${config})
    add_dependencies(link_exports link_export_${config})
endforeach()

Next, add your target to the root Makefile:
YOUR_CONFIG:
	mkdir -p $d/build_host && cd $d/build_host && cmake .. -DTARGET_OS=nuttx -DTARGET_BOARD=YOUR_BOARD -DTARGET_LABEL=simple && make && ctest -V && cpack -G ZIP

To add an extra step to generate two nuttx exports you would just have to add a new rule to generate the nuttx export, see cmake/px4_utils.cmake. I've included the nuttx_export function below so you can see how it works.
function(add_nuttx_export BOARD)
	set(BOARD_NUTTX_SRC ${CMAKE_BINARY_DIR}/${BOARD}/NuttX)

	# copy
	add_custom_command(OUTPUT nuttx_copy_${BOARD}.stamp
		COMMAND mkdir -p ${CMAKE_BINARY_DIR}/${BOARD}
		COMMAND cp -r ${CMAKE_SOURCE_DIR}/NuttX ${BOARD_NUTTX_SRC}
		COMMAND rm -rf ${BOARD_NUTTX_SRC}/.git
		COMMAND touch nuttx_copy_${BOARD}.stamp)
	add_custom_target(nuttx_copy_${BOARD}
		DEPENDS nuttx_copy_${BOARD}.stamp nuttx_patch)

	# export
	add_custom_command(OUTPUT ${BOARD}.export
		COMMAND echo Configuring NuttX for ${BOARD}
		COMMAND make -C${BOARD_NUTTX_SRC}/nuttx -j${NUTTX_BUILD_THREADS}
			-r --quiet distclean
		COMMAND cp -r ${CMAKE_SOURCE_DIR}/nuttx-configs/${BOARD}
			${BOARD_NUTTX_SRC}/nuttx/configs
		COMMAND cd ${BOARD_NUTTX_SRC}/nuttx/tools &&
			./configure.sh ${BOARD}/nsh
		COMMAND echo Exporting NuttX for ${BOARD}
		COMMAND make -C ${BOARD_NUTTX_SRC}/nuttx -j${NUTTX_BUILD_THREADS}
			-r CONFIG_ARCH_BOARD=${BOARD} export
		COMMAND cp -r ${BOARD_NUTTX_SRC}/nuttx/nuttx-export.zip
			${BOARD}.export
		DEPENDS nuttx_copy_${BOARD})

	# extract
	add_custom_command(OUTPUT nuttx_export_${BOARD}.stamp
		COMMAND rm -rf ${BOARD_NUTTX_SRC}/nuttx-export
		COMMAND unzip ${BOARD}.export -d ${BOARD_NUTTX_SRC}
		COMMAND touch nuttx_export_${BOARD}.stamp
		DEPENDS ${BOARD}.export)
	add_custom_target(NuttX_${BOARD}
		DEPENDS nuttx_export_${BOARD}.stamp)

	# this symbolic linking is to allow cmake to build all of the
	# archives for the current makefile, it won't be needed in a
	# complete cmake build
	add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/Archives/${BOARD}.export
		COMMAND mkdir -p ${CMAKE_SOURCE_DIR}/Archives
		COMMAND rm -f ${CMAKE_SOURCE_DIR}/Archives/${BOARD}.export
		COMMAND ln -sf ${CMAKE_BINARY_DIR}/${BOARD}.export
		${CMAKE_SOURCE_DIR}/Archives/${BOARD}.export
		DEPENDS ${BOARD}.export)
	add_custom_target(link_export_${BOARD}
		DEPENDS ${CMAKE_SOURCE_DIR}/Archives/${BOARD}.export)
endfunction()

@mcharleb Take a look at my reorganization of the build flags. If you still think it is too messy we can separate. Since I linked all the modules twice, order no longer matters, so that simplifies things and allows us to put old non-default flags and modules in one section. We could easily put this section into another cmake file and include it if you think that is best, or have a default flag set and a set of overrides or additions for each specific os.

OK, I'll have a look. OS specific functions like the above should live in somewhere like:
Firmware/cmake/nuttx/utils.cmake