|
|
|
@ -455,7 +455,7 @@
|
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
"cell_type": "code", |
|
|
|
|
"execution_count": null, |
|
|
|
|
"execution_count": 111, |
|
|
|
|
"id": "e42286bc-085c-45dc-b101-234308e58269", |
|
|
|
|
"metadata": {}, |
|
|
|
|
"outputs": [], |
|
|
|
@ -482,14 +482,12 @@
|
|
|
|
|
" return \"\"\n", |
|
|
|
|
"\n", |
|
|
|
|
"def c_compiler_cmd(filename_base):\n", |
|
|
|
|
" my_platform = platform.system()\n", |
|
|
|
|
" my_compiler = []\n", |
|
|
|
|
"\n", |
|
|
|
|
" try:\n", |
|
|
|
|
" with open(\"simple.cpp\", \"w\") as f:\n", |
|
|
|
|
" f.write(simple_cpp)\n", |
|
|
|
|
"\n", |
|
|
|
|
" \n", |
|
|
|
|
" my_platform = platform.system()\n", |
|
|
|
|
" my_compiler = []\n", |
|
|
|
|
" \n", |
|
|
|
|
" \n", |
|
|
|
|
" if my_platform == \"Windows\":\n", |
|
|
|
|
" if os.path.isfile(VISUAL_STUDIO_2022_TOOLS):\n", |
|
|
|
@ -508,7 +506,7 @@
|
|
|
|
|
" if run_cmd(compile_cmd):\n", |
|
|
|
|
" if run_cmd([\"./simple\"]) == \"Hello\":\n", |
|
|
|
|
" my_compiler = [\"Windows\", \"Visual Studio 2019\", [\"cmd\", \"/c\", VISUAL_STUDIO_2019_TOOLS, \"&\", \"cl\", f\"{filename_base}.cpp\"]]\n", |
|
|
|
|
"\n", |
|
|
|
|
" \n", |
|
|
|
|
" if not my_compiler:\n", |
|
|
|
|
" if os.path.isfile(\"./simple.exe\"):\n", |
|
|
|
|
" os.remove(\"./simple.exe\")\n", |
|
|
|
@ -517,7 +515,7 @@
|
|
|
|
|
" print(\"here\")\n", |
|
|
|
|
" if run_cmd([\"./simple\"]) == \"Hello\":\n", |
|
|
|
|
" my_compiler = [\"Windows\", \"GCC\", [\"cmd\", \"/c\", \"gcc\", f\"{filename_base}.cpp\"]]\n", |
|
|
|
|
"\n", |
|
|
|
|
" \n", |
|
|
|
|
" if not my_compiler:\n", |
|
|
|
|
" my_compiler=[my_platform, \"Unavailable\", []]\n", |
|
|
|
|
" \n", |
|
|
|
@ -528,7 +526,7 @@
|
|
|
|
|
" if run_cmd(compile_cmd):\n", |
|
|
|
|
" if run_cmd([\"./simple\"]) == \"Hello\":\n", |
|
|
|
|
" my_compiler = [\"Linux\", \"GCC\", [\"gcc\", f\"{filename_base}.cpp\", \"-o\", f\"{filename_base}\"]]\n", |
|
|
|
|
"\n", |
|
|
|
|
" \n", |
|
|
|
|
" if not my_compiler:\n", |
|
|
|
|
" if os.path.isfile(\"./simple\"):\n", |
|
|
|
|
" os.remove(\"./simple\")\n", |
|
|
|
@ -539,7 +537,7 @@
|
|
|
|
|
" \n", |
|
|
|
|
" if not my_compiler:\n", |
|
|
|
|
" my_compiler=[my_platform, \"Unavailable\", []]\n", |
|
|
|
|
"\n", |
|
|
|
|
" \n", |
|
|
|
|
" elif my_platform == \"Darwin\":\n", |
|
|
|
|
" if os.path.isfile(\"./simple\"):\n", |
|
|
|
|
" os.remove(\"./simple\")\n", |
|
|
|
@ -547,10 +545,12 @@
|
|
|
|
|
" if run_cmd(compile_cmd):\n", |
|
|
|
|
" if run_cmd([\"./simple\"]) == \"Hello\":\n", |
|
|
|
|
" my_compiler = [\"Linux\", \"CLang\", [\"clang++\", \"-Ofast\", \"-std=c++17\", \"-march=armv8.5-a\", \"-mtune=apple-m1\", \"-mcpu=apple-m1\", \"-o\", f\"{filename_base}\", f\"{filename_base}.cpp\"]]\n", |
|
|
|
|
"\n", |
|
|
|
|
" \n", |
|
|
|
|
" if not my_compiler:\n", |
|
|
|
|
" my_compiler=[my_platform, \"Unavailable\", []]\n", |
|
|
|
|
"\n", |
|
|
|
|
" except:\n", |
|
|
|
|
" my_compiler=[my_platform, \"Unavailable\", []]\n", |
|
|
|
|
" \n", |
|
|
|
|
" if my_compiler:\n", |
|
|
|
|
" return my_compiler\n", |
|
|
|
|
" else:\n", |
|
|
|
|