CMake and the propeller? Help?
DavidZemon
Posts: 2,973
Call me crazy, but I'm trying to use CMake with the Propeller. The end goal here is to build a plugin for JetBrain's new C++ IDE (which currently only supports CMake) to aid in the use of PropWare.
I'm new to CMake so pardon anything that looks completely moronic. I've created a branch of PropWare called cmake where you can see my current progress. The problem I'm having right now is with the memory model - for some reason, the variable is not being set correctly in sub-directories.
Configuration:
Eventually, I'll add two more sub-directories to the root CMakeLists.txt - one for libpropeller and one for simple. No need to worry about that yet - those libraries can be built with the release-2.0 branch and Make still. When I build from the root directory, the static libraries build correctly but then it gets to the Examples and dies. It dies because the linker command is generated as:
When I build from within /Examples/Concurrency directly, it builds just fine.
To test this for yourself, run the following:
For those wondering - yes, I got into the private EAP of the C++ IDE. It's pretty fantastic
As always, I certainly appreciate any help that's out there.
David
I'm new to CMake so pardon anything that looks completely moronic. I've created a branch of PropWare called cmake where you can see my current progress. The problem I'm having right now is with the memory model - for some reason, the variable is not being set correctly in sub-directories.
Configuration:
/CMakeLists.txt
Add two sub-directories: Examples and PropWare.
/PropWare/CMakeLists.txt
Add a sub-directory for each of the six memory models
/PropWare/<memory model>/CMakeLists.txt
Set the memory model variable (MODEL) and build a static library for PropWare sources
/Examples/CMakeLists.txt
Add a sub-directory for each example project (first in the list is Concurrency)
/Examples/Concurrency/CMakeLists.txt
Set the memory model again, a new project name, link some libraries, [fail to] build some cool stuff
Eventually, I'll add two more sub-directories to the root CMakeLists.txt - one for libpropeller and one for simple. No need to worry about that yet - those libraries can be built with the release-2.0 branch and Make still. When I build from the root directory, the static libraries build correctly but then it gets to the Examples and dies. It dies because the linker command is generated as:
/opt/parallax/bin/propeller-elf-gcc -Os -mlmm -g -Wall -m32bit-doubles -fno-threadsafe-statics -fno-rtti -std=gnu++0x -Xlinker -Map=main.rawmap CMakeFiles/Concurrency_Demo.elf.dir/Concurrency_Demo.cpp.o -o Concurrency_Demo.elf ../../PropWare/cog/libPropWare_cog.a ../../simple/cog/libSimple_cog.a ../../libpropeller/source/cog/libLibpropeller_cog.a -ltinyNow what good is that!? The source file was built with lmm but it's trying to link to cog libraries? I can't figure out how to fix this.
When I build from within /Examples/Concurrency directly, it builds just fine.
To test this for yourself, run the following:
export PROPWARE_PATH=<current path>/PropWare export PROPGCC_PREFIX=/opt/parallax # or whatever the path is to your PropGCC installation git clone https://github.com/SwimDude0614/PropWare.git cd PropWare/util python propwareImporter.py cd .. make git checkout cmake cmake . make VERBOSE=1 # After this, you'll see the failed attempt at building Concurrency_Demo.elf cd Examples/Concurrency make clean && cmake . && make VERBOSE=1
For those wondering - yes, I got into the private EAP of the C++ IDE. It's pretty fantastic
As always, I certainly appreciate any help that's out there.
David
Comments
I got CMake working for PropGCC a long time ago. Mainly you just need to setup the cross compiler tool chain. I would just emulate what Arduino Cmake does and port it to the propeller. That will likely save you a lot of time.
https://github.com/queezythegreat/arduino-cmake
I broke my CMake build system a long time ago. So, I don't think you could use any of it.
I was able to get the cross compiler tool chain setup (mostly), so that's good at least. I haven't checked to see if the files are built correctly or not, but they do at least build (under the right circumstances).
I seem to have run into a generic CMake problem though that I don't know how to get around. HOWEVER, that link you provided looks fantastic and I will be sure to check it out as soon as I get home. For one, that just looks plain cool, and might provide a way to use Arduino with JetBrain's new IDE as well! But mostly, I bet I'll be able to find an example that the arduino cmake code that explains how to fix my problem!
Thanks for the info!
David