-
Notifications
You must be signed in to change notification settings - Fork 105
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
Add "bare" C and C++ build tips docs #1371
base: master
Are you sure you want to change the base?
Conversation
Adds brief descriptions of how to do "bare" (no build system) C and C++ builds - just to show where things should go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me
Out of curiosity, what is the immediate motivation for this, did you have to package something for Yggdrasil were this was necessary?
# adjust your `cd` appropriately | ||
cd $WORKSPACE/srcdir/hello | ||
mkdir -p ${libdir} | ||
$CXX -shared -std=c++11 -O3 -fPIC -o ${libdir}/libhello.${dlext} src/hello.cpp # you may want to edit the `std` flag, for exampLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$CXX -shared -std=c++11 -O3 -fPIC -o ${libdir}/libhello.${dlext} src/hello.cpp # you may want to edit the `std` flag, for exampLE | |
$CXX -shared -std=c++11 -O3 -fPIC -o ${libdir}/libhello.${dlext} src/hello.cpp # you may want to edit the `std` flag, for example |
## C builds | ||
|
||
If your library has no build system like Make, CMake, Meson, or Autoconf, you may need to use the C compiler directly. The C compiler is stored in the `CC` environment variable, and you can direct output to `libdir` (shared libraries) and `bindir` (executables). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to give the impression that this are the exact commands one shall run, it's rather to give an idea (I can't say how many times people take these instructions almost verbatim rather than as indication)
As a high-level example: | |
## C++ builds | ||
|
||
Similarly to C builds, sometimes your C++ libraries will not have a build system associated with them. The C++ compiler is stored in the `CXX` environment variable. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a high-level example: | |
Adds brief descriptions of how to do "bare" (no build system) C and C++ builds - just to show where things should go.