change default cc on mac to clang

This commit is contained in:
lzhengning 2021-06-11 14:03:53 +08:00
parent 7702715944
commit 72c22c1216
3 changed files with 10 additions and 4 deletions

View File

@ -706,7 +706,7 @@ def get_full_path_of_executable(name):
def compile_extern():
# compile llvm passes
if cc_type != "clang":
if cc_type != "clang" or platform.system() != 'Linux':
return
global kernel_opt_flags
cache_path_llvm = os.path.join(cache_path, "llvm")
@ -909,7 +909,7 @@ if "cc_flags" in os.environ:
cc_flags += os.environ["cc_flags"] + ' '
link_flags = " -lstdc++ -ldl -shared "
if platform.system() == 'Darwin':
# TODO: if not using apple clang, no need to add -lomp
# TODO: if not using apple clang, there is no need to add -lomp
link_flags += "-undefined dynamic_lookup -lomp "
core_link_flags = ""

View File

@ -99,7 +99,9 @@ void LoopToFuncPass::run() {
auto& fc = ir->children[i];
fc->attrs["loop_func"] = func->attrs["lvalue"];
}
// ir->remove_all_unused();
#ifdef __APPLE__
ir->remove_all_unused();
#endif
}
} // jittor

View File

@ -293,7 +293,11 @@ is_in_ipynb = in_ipynb()
cc = None
LOG = LogWarper()
cc_path = env_or_find('cc_path', 'g++', silent=True)
if platform.system() == 'Darwin':
default_cc = 'clang'
else:
default_cc = 'g++'
cc_path = env_or_find('cc_path', default_cc, silent=True)
os.environ["cc_path"] = cc_path
cc_type = get_cc_type(cc_path)
cache_path = find_cache_path()