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

Need control of C++ build process / arguments #20

Closed
jeremysawicki opened this issue Jun 30, 2020 · 2 comments
Closed

Need control of C++ build process / arguments #20

jeremysawicki opened this issue Jun 30, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@jeremysawicki
Copy link

Hard-coding the C++ compiler command line is problematic for a number of reasons:

  • It is not possible to split the source code into multiple implementation (.cpp) files.
  • It is not possible to enable compiler optimizations (e.g. -O3).
  • It is not possible to select a more modern version of the C++ standard (e.g. -std=gnu++17).
  • It is not possible to link with any libraries. For example, talking to a server via HTTP practically requires the use of a library. The gcc image includes libcurl4-openssl-dev, but using it requires linking with -lcurl.

As an alternative, I recall a past contest where teams could supply two scripts, e.g. "build" and "run". The build script can invoke the compiler with any necessary arguments, or run a tool like "make", etc. The run script can run the program with any necessary arguments, environment variables, etc. If no special arguments are needed, the run script can just be the binary itself. I would also suggest copying an entire directory rather than just a single binary. The directory might contain the run script, the compiled binary, data files, shared libraries, etc.

I'll create a pull request along these lines if you are open to it.

@elventian
Copy link

Check out this: #11 (comment)

@beevee
Copy link
Member

beevee commented Jul 1, 2020

Yes, that sounds valid. We were going to do exactly that. Thanks for your help, I'll check out your pull requests.

@beevee beevee closed this as completed Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants