Closed dzarda closed 2 years ago
Please use PRE script and override CC, CXX, ...
. See
@ivankravets Thank you but I'm unable to replace the compiler as env.Replace(CC="emcc")
doesn't seem to change anything:
pre_use_emcc.py:
Import("env")
print("Replacing")
env.Replace(AR="emar")
env.Replace(CC="emcc")
env.Replace(CXX="em++")
platformio.ini:
[env:emcc]
extra_scripts = pre:../scripts/pre_use_emcc.py # found successfully
platform = native # ststm32 doesn't replace compiler either
...
> pio run -vv
Processing emcc (extra_scripts: pre:../scripts/pre_use_emcc.py; platform: native; build_flags: -std=c++17, -Iinclude, -I../include, -I../lib/u8g2_font_render; src_filter: +<virtualpen.cpp>, +<../../src/statemachine.cpp>, +<../../src/graphics.cpp>, +<../../src/u8g2_font_7x13_tf.c>, +<../../src/u8g2_font_5x8_tf.c>, +<../../lib/u8g2_font_render/u8g2_font_render.c>; lib_extra_dirs: ../lib; lib_deps: u8g2_font_render)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Replacing
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 4 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <u8g2_font_render> (C:\Users\Dzarda\Documents\src\pen\lib\u8g2_font_render)
Building in release mode
gcc -o .pio\build\lib\u8g2_font_render\u8g2_font_render.o -c -DPLATFORMIO=50203 -Isrc -IC:\Users\Dzarda\.platformio\platforms\native\builder\include -IC:\Users\Dzarda\Documents\src\pen\include -IC:\Users\Dzarda\Documents\src\pen\lib\u8g2_font_render C:\Users\Dzarda\Documents\src\pen\lib\u8g2_font_render\u8g2_font_render.c
'gcc' is not recognized as an internal or external command,
operable program or batch file.
g++ -o .pio\build\src\graphics.o -c -std=c++17 -DPLATFORMIO=50203 -Isrc -IC:\Users\Dzarda\.platformio\platforms\native\builder\include -IC:\Users\Dzarda\Documents\src\pen\include -IC:\Users\Dzarda\Documents\src\pen\lib\u8g2_font_render C:\Users\Dzarda\Documents\src\pen\src\graphics.cpp
'g++' is not recognized as an internal or external command,
operable program or batch file.
Added prints:
print(env.get("CC"))
env.Replace(CC="emcc")
print(env.get("CC"))
leads to...
cc
emcc
If I use POST then this is printed (also tries compiling with gcc instead)
gcc
emcc
gcc -o .pio\build\lib\u8g2_font_render\u8g2_font_render.o -c -DPLATFORMIO=50203 -Isrc -IC:\Users\Dzarda\.platformio\platforms\native\builder\include -IC:\Users\Dzarda\Documents\src\pen\include -IC:\Users\Dzarda\Documents\src\pen\lib\u8g2_font_render C:\Users\Dzarda\Documents\src\pen\lib\u8g2_font_render\u8g2_font_render.c
'gcc' is not recognized as an internal or external command,
Note that same behaviour is seen with platform = ststm32
Please use POST script, not PRE. See https://github.com/platformio/platform-native/blob/develop/builder/main.py#L23
I'd like to invoke emcc/em++ (Emscripten) instead of GCC during
native
compilation. I cannot figure out how to do that.One possible solution should be to have an argument forwarding script named
gcc
and prepend PATH with it. This would callemcc
. What would be a cleaner solution?