Skip to content

[Question] Generate and use libmodm.a+headers only? (no linking to main) #551

@mfp20

Description

@mfp20

Is there a proper way to build the static library, and a folder for headers, only?

Without a main function, the library gets generated and all the modm generated source code (hpp+cpp) is in a subfolder. It stops at 'undefined reference to main' when linking to build the firmware.

What about using the library then?

If I cd in avr logger example and try to manually build it

avr-g++ -o logger.elf -Imodm/ext/gcc/libstdc++/include -Imodm/src -L../../../build/avr/logger/release/modm -lmodm -std=c++20 main.cpp

results in a huge scroll of errors filling up my terminal history. Looks like all the PORTx PINy definitions missing and more.
And scons doesn't help much in figuring out the proper build flags because those are in variables; if I build with scons --debug presub all I get are rows similar to this one

$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES

and I don't know how to expand those variables. Looks like scons doesn't give a flag for that. Do I have to disable the generation of SConstruct and mod it?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions