🔨 Use first g++ in path for 'native' targets
This commit is contained in:
parent
81f403025c
commit
6112277f9b
@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
import subprocess,os,re
|
import subprocess,os,re
|
||||||
|
|
||||||
|
nocache = 1
|
||||||
verbose = 0
|
verbose = 0
|
||||||
|
|
||||||
def blab(str):
|
def blab(str):
|
||||||
@ -50,7 +51,7 @@ def run_preprocessor(env, fn=None):
|
|||||||
#
|
#
|
||||||
def search_compiler(env):
|
def search_compiler(env):
|
||||||
|
|
||||||
ENV_BUILD_PATH = os.path.join(env.Dictionary('PROJECT_BUILD_DIR'), env['PIOENV'])
|
ENV_BUILD_PATH = os.path.join(env['PROJECT_BUILD_DIR'], env['PIOENV'])
|
||||||
GCC_PATH_CACHE = os.path.join(ENV_BUILD_PATH, ".gcc_path")
|
GCC_PATH_CACHE = os.path.join(ENV_BUILD_PATH, ".gcc_path")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -60,14 +61,17 @@ def search_compiler(env):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if os.path.exists(GCC_PATH_CACHE):
|
# Warning: The cached .gcc_path will obscure a newly-installed toolkit
|
||||||
|
if not nocache and os.path.exists(GCC_PATH_CACHE):
|
||||||
blab("Getting g++ path from cache")
|
blab("Getting g++ path from cache")
|
||||||
with open(GCC_PATH_CACHE, 'r') as f:
|
with open(GCC_PATH_CACHE, 'r') as f:
|
||||||
return f.read()
|
return f.read()
|
||||||
|
|
||||||
# Find the current platform compiler by searching the $PATH
|
# Find a platform compiler by searching $PATH items
|
||||||
# which will be in a platformio toolchain bin folder
|
# A native target will search all PATH bin folders.
|
||||||
path_regex = re.escape(env['PROJECT_PACKAGES_DIR'])
|
# Others look only within $HOME/.platformio.
|
||||||
|
path_regex = "" if env.GetProjectOption('platform') == 'native' else re.escape(env['PROJECT_PACKAGES_DIR'])
|
||||||
|
|
||||||
gcc = "g++"
|
gcc = "g++"
|
||||||
if env['PLATFORM'] == 'win32':
|
if env['PLATFORM'] == 'win32':
|
||||||
path_separator = ';'
|
path_separator = ';'
|
||||||
@ -87,7 +91,7 @@ def search_compiler(env):
|
|||||||
# Use entire path to not rely on env PATH
|
# Use entire path to not rely on env PATH
|
||||||
filepath = os.path.sep.join([pathdir, filepath])
|
filepath = os.path.sep.join([pathdir, filepath])
|
||||||
# Cache the g++ path to no search always
|
# Cache the g++ path to no search always
|
||||||
if os.path.exists(ENV_BUILD_PATH):
|
if not nocache and os.path.exists(ENV_BUILD_PATH):
|
||||||
blab("Caching g++ for current env")
|
blab("Caching g++ for current env")
|
||||||
with open(GCC_PATH_CACHE, 'w+') as f:
|
with open(GCC_PATH_CACHE, 'w+') as f:
|
||||||
f.write(filepath)
|
f.write(filepath)
|
||||||
|
@ -63,12 +63,12 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags}
|
|||||||
#
|
#
|
||||||
# Simulator for macOS (MacPorts)
|
# Simulator for macOS (MacPorts)
|
||||||
#
|
#
|
||||||
# sudo port install gcc10 gdb glm libsdl2 libsdl2_net freetype
|
# sudo port install gcc11 gdb glm libsdl2 libsdl2_net freetype
|
||||||
# sudo port install ld64 @3_3 +ld64_xcode
|
# sudo port install ld64 @3_3 +ld64_xcode
|
||||||
#
|
#
|
||||||
# cd /opt/local/bin
|
# cd /opt/local/bin
|
||||||
# sudo rm -f gcc g++ cc
|
# sudo rm -f gcc g++ cc
|
||||||
# sudo ln -s gcc-mp-10 gcc ; sudo ln -s g++-mp-10 g++ ; sudo ln -s g++ cc
|
# sudo ln -s gcc-mp-11 gcc ; sudo ln -s g++-mp-11 g++ ; sudo ln -s g++ cc
|
||||||
# This step may be obsolete:
|
# This step may be obsolete:
|
||||||
# sudo port uninstall ld64 ld64-latest
|
# sudo port uninstall ld64 ld64-latest
|
||||||
#
|
#
|
||||||
@ -79,7 +79,6 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags}
|
|||||||
#
|
#
|
||||||
[simulator_macos]
|
[simulator_macos]
|
||||||
build_unflags = -lGL
|
build_unflags = -lGL
|
||||||
custom_verbose = 0
|
|
||||||
build_flags =
|
build_flags =
|
||||||
-I/opt/local/include
|
-I/opt/local/include
|
||||||
-I/opt/local/include/freetype2
|
-I/opt/local/include/freetype2
|
||||||
@ -93,11 +92,15 @@ build_flags =
|
|||||||
extends = env:simulator_linux_debug
|
extends = env:simulator_linux_debug
|
||||||
build_flags = ${env:simulator_linux_debug.build_flags} ${simulator_macos.build_flags} -ggdb -Og -D_THREAD_SAFE
|
build_flags = ${env:simulator_linux_debug.build_flags} ${simulator_macos.build_flags} -ggdb -Og -D_THREAD_SAFE
|
||||||
build_unflags = ${simulator_macos.build_unflags}
|
build_unflags = ${simulator_macos.build_unflags}
|
||||||
|
custom_verbose = 0
|
||||||
|
custom_gcc = g++
|
||||||
|
|
||||||
[env:simulator_macos_release]
|
[env:simulator_macos_release]
|
||||||
extends = env:simulator_linux_release
|
extends = env:simulator_linux_release
|
||||||
build_flags = ${env:simulator_linux_release.build_flags} ${simulator_macos.build_flags}
|
build_flags = ${env:simulator_linux_release.build_flags} ${simulator_macos.build_flags}
|
||||||
build_unflags = ${simulator_macos.build_unflags}
|
build_unflags = ${simulator_macos.build_unflags}
|
||||||
|
custom_verbose = 0
|
||||||
|
custom_gcc = g++
|
||||||
|
|
||||||
#
|
#
|
||||||
# Simulator for Windows 10
|
# Simulator for Windows 10
|
||||||
|
Loading…
Reference in New Issue
Block a user