Skip to content

Commit

Permalink
Make compiler_flags setting take precedence over the compiler flag en…
Browse files Browse the repository at this point in the history
…v var
  • Loading branch information
MalachiTimothyPhillips committed Sep 19, 2022
1 parent 2e576e6 commit e29dce9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/occa/internal/modes/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ namespace occa {
compiler = "nvcc";
}

if (env::var("OCCA_CUDA_COMPILER_FLAGS").size()) {
compilerFlags = env::var("OCCA_CUDA_COMPILER_FLAGS");
} else if (kernelProps.get<std::string>("compiler_flags").size()) {
if (kernelProps.get<std::string>("compiler_flags").size()) {
compilerFlags = (std::string) kernelProps["compiler_flags"];
} else if (env::var("OCCA_CUDA_COMPILER_FLAGS").size()) {
compilerFlags = env::var("OCCA_CUDA_COMPILER_FLAGS");
} else {
compilerFlags = "-O3";
}
Expand Down
6 changes: 3 additions & 3 deletions src/occa/internal/modes/hip/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ namespace occa {
compiler = "hipcc";
}

if (env::var("OCCA_HIP_COMPILER_FLAGS").size()) {
compilerFlags = env::var("OCCA_HIP_COMPILER_FLAGS");
} else if (kernelProps.get<std::string>("compiler_flags").size()) {
if (kernelProps.get<std::string>("compiler_flags").size()) {
compilerFlags = (std::string) kernelProps["compiler_flags"];
} else if (env::var("OCCA_HIP_COMPILER_FLAGS").size()) {
compilerFlags = env::var("OCCA_HIP_COMPILER_FLAGS");
} else {
compilerFlags = "-O3";
}
Expand Down
6 changes: 3 additions & 3 deletions src/occa/internal/modes/opencl/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ namespace occa {
std::string compilerFlags;

// Use "-cl-opt-disable" for debug-mode
if (env::var("OCCA_OPENCL_COMPILER_FLAGS").size()) {
compilerFlags = env::var("OCCA_OPENCL_COMPILER_FLAGS");
} else if (kernelProps.has("compiler_flags")) {
if (kernelProps.has("compiler_flags")) {
compilerFlags = (std::string) kernelProps["compiler_flags"];
} else if (env::var("OCCA_OPENCL_COMPILER_FLAGS").size()) {
compilerFlags = env::var("OCCA_OPENCL_COMPILER_FLAGS");
}

std::string ocl_c_ver = "2.0";
Expand Down
6 changes: 3 additions & 3 deletions src/occa/internal/modes/serial/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ namespace occa {
#endif
}

if (compilerLanguageFlag == sys::language::CPP && env::var("OCCA_CXXFLAGS").size()) {
if (kernelProps.get<std::string>("compiler_flags").size()) {
compilerFlags = (std::string) kernelProps["compiler_flags"];
} else if (compilerLanguageFlag == sys::language::CPP && env::var("OCCA_CXXFLAGS").size()) {
compilerFlags = env::var("OCCA_CXXFLAGS");
} else if (compilerLanguageFlag == sys::language::C && env::var("OCCA_CFLAGS").size()) {
compilerFlags = env::var("OCCA_CFLAGS");
} else if (kernelProps.get<std::string>("compiler_flags").size()) {
compilerFlags = (std::string) kernelProps["compiler_flags"];
} else if (compilerLanguageFlag == sys::language::CPP && env::var("CXXFLAGS").size()) {
compilerFlags = env::var("CXXFLAGS");
} else if (compilerLanguageFlag == sys::language::C && env::var("CFLAGS").size()) {
Expand Down

0 comments on commit e29dce9

Please sign in to comment.