From ffe067f53dff5b4f5c1fe0947bb697bc380c6ef6 Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Sun, 26 May 2019 18:49:55 +0200 Subject: [PATCH 1/2] Include SConstruct in .editorconfig --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index ab03b8421c4f..56cc2e9c2dd2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,7 +9,7 @@ insert_final_newline = true [*.{cpp,hpp,c,h,mm}] trim_trailing_whitespace = true -[{*.{py,cs},SCsub}] +[{*.{py,cs},SConstruct,SCsub}] indent_style = space indent_size = 4 From be80b0b83c9068cf1576c0a7c909abbdd931c8fc Mon Sep 17 00:00:00 2001 From: Max Hilbrunner Date: Sun, 26 May 2019 19:05:31 +0200 Subject: [PATCH 2/2] Scons: Autodetect platform if not specified Co-authored-by: Hugo Locurcio --- SConstruct | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 88bb43fbc738..b6231e26fe13 100644 --- a/SConstruct +++ b/SConstruct @@ -226,6 +226,23 @@ if env_base['platform'] != "": elif env_base['p'] != "": selected_platform = env_base['p'] env_base["platform"] = selected_platform +else: + # Missing `platform` argument, try to detect platform automatically + if sys.platform.startswith('linux'): + selected_platform = 'linux' + elif sys.platform == 'darwin': + selected_platform = 'osx' + elif sys.platform == 'win32': + selected_platform = 'windows' + else: + print("Could not detect platform automatically. Supported platforms:") + for x in platform_list: + print("\t" + x) + print("\nPlease run SCons again and select a valid platform: platform=") + + if selected_platform != "": + print("Automatically detected platform: " + selected_platform) + env_base["platform"] = selected_platform if selected_platform in platform_list: tmppath = "./platform/" + selected_platform @@ -492,13 +509,13 @@ if selected_platform in platform_list: if (conf.CheckCHeader(header[0])): env.AppendUnique(CPPDEFINES=[header[1]]) -else: +elif selected_platform != "": - print("No valid target platform selected.") + print("Invalid target platform: " + selected_platform) print("The following platforms were detected:") for x in platform_list: print("\t" + x) - print("\nPlease run SCons again with the argument: platform=") + print("\nPlease run SCons again and select a valid platform: platform=") # The following only makes sense when the env is defined, and assumes it is if 'env' in locals():