Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

occa::json["compiler_flags"] should override environment variable #621

Closed
MalachiTimothyPhillips opened this issue Sep 19, 2022 · 1 comment · Fixed by #622
Closed

occa::json["compiler_flags"] should override environment variable #621

MalachiTimothyPhillips opened this issue Sep 19, 2022 · 1 comment · Fixed by #622

Comments

@MalachiTimothyPhillips
Copy link
Contributor

e.g.,

if (compilerLanguageFlag == sys::language::CPP && env::var("OCCA_CXXFLAGS").size()) {


      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()) {
        compilerFlags = env::var("CFLAGS");
      } else {
#if (OCCA_OS & (OCCA_LINUX_OS | OCCA_MACOS_OS))
        compilerFlags = "-O3";
#else
        compilerFlags = " /Ox";
#endif
      }

Why is OCCA_CXXFLAGS used to set the compiler flags, despite kernelProps["compiler_flags"] being set?
I would have thought that setting the kernelProps["compiler_flags] should have taken precedence here.

@MalachiTimothyPhillips
Copy link
Contributor Author

To be clear, this logic is also repeated across other backends, e.g.

compilerFlags = (std::string) kernelProps["compiler_flags"];
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants