diff --git a/buildroot/share/PlatformIO/scripts/preprocessor.py b/buildroot/share/PlatformIO/scripts/preprocessor.py index 6f4ed900ca..3d324bac4b 100644 --- a/buildroot/share/PlatformIO/scripts/preprocessor.py +++ b/buildroot/share/PlatformIO/scripts/preprocessor.py @@ -3,6 +3,7 @@ # import subprocess,os,re +nocache = 1 verbose = 0 def blab(str): @@ -50,7 +51,7 @@ def run_preprocessor(env, fn=None): # 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") try: @@ -60,14 +61,17 @@ def search_compiler(env): except: 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") with open(GCC_PATH_CACHE, 'r') as f: return f.read() - # Find the current platform compiler by searching the $PATH - # which will be in a platformio toolchain bin folder - path_regex = re.escape(env['PROJECT_PACKAGES_DIR']) + # Find a platform compiler by searching $PATH items + # A native target will search all PATH bin folders. + # Others look only within $HOME/.platformio. + path_regex = "" if env.GetProjectOption('platform') == 'native' else re.escape(env['PROJECT_PACKAGES_DIR']) + gcc = "g++" if env['PLATFORM'] == 'win32': path_separator = ';' @@ -87,7 +91,7 @@ def search_compiler(env): # Use entire path to not rely on env PATH filepath = os.path.sep.join([pathdir, filepath]) # 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") with open(GCC_PATH_CACHE, 'w+') as f: f.write(filepath) diff --git a/ini/native.ini b/ini/native.ini index 3d196f3436..02737a0746 100644 --- a/ini/native.ini +++ b/ini/native.ini @@ -63,12 +63,12 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # # 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 # # cd /opt/local/bin # 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: # sudo port uninstall ld64 ld64-latest # @@ -79,7 +79,6 @@ build_flags = ${simulator_linux.build_flags} ${simulator_linux.release_flags} # [simulator_macos] build_unflags = -lGL -custom_verbose = 0 build_flags = -I/opt/local/include -I/opt/local/include/freetype2 @@ -93,11 +92,15 @@ build_flags = extends = env:simulator_linux_debug build_flags = ${env:simulator_linux_debug.build_flags} ${simulator_macos.build_flags} -ggdb -Og -D_THREAD_SAFE build_unflags = ${simulator_macos.build_unflags} +custom_verbose = 0 +custom_gcc = g++ [env:simulator_macos_release] extends = env:simulator_linux_release build_flags = ${env:simulator_linux_release.build_flags} ${simulator_macos.build_flags} build_unflags = ${simulator_macos.build_unflags} +custom_verbose = 0 +custom_gcc = g++ # # Simulator for Windows 10