Steps to configure built artifacts
Hello,
I'm trying to understand if there's a way to configure what is being built by sw, in order to miniize size of generated artifacts. From https://software-network.org/client/sw.pdf , I can see that you have taken at CPPAN the zero-conf and "all or nothing" route, so maybe it's just not designed for this.
I tried in my sw.cpp to undefined some variables that would typically be configured by a configure script, but it doesn't seem to make any difference:
auto &ocr = s.addLibrary("xxx");
{
auto &t = ocr;
t += cppstd;
t += "OCR_API"_api;
t +=
//
;
t += "org.sw.demo.intel.opencv.imgcodecs-4.11.0"_dep;
t += "org.sw.demo.intel.opencv.imgproc-4.11.0"_dep;
t += "org.sw.demo.google.tesseract.libtesseract-5.4.0"_dep;
t.CompileOptions.erase("-DHAVE_CURL");
t.CompileOptions.erase("-DHAVE_LIBCURL");
t.CompileOptions.erase("-DFRMT_derived");
t.CompileOptions.erase("-DFRMT_gtiff");
t.CompileOptions.erase("-DFRMT_hfa");
t.CompileOptions.erase("-DFRMT_libgeotiff");
t.CompileOptions.erase("-DFRMT_vrt");
t.CompileOptions.erase("-DUSE_NGHTTP2");
t.CompileOptions.push_back("-fdeclspec");
t.CompileOptions.push_back("-O2");
}
Do you know how I can replicate for instance the result of applying --with-curl=no of a configure script to a sw build?
Hi,
There is possible way: sw build -Dvarname=value
https://github.com/SoftwareNetwork/sw/blob/b0.4.5/sw.cpp#L392
To minimize size of binaries:
- Add options as you do (won't affect deps though).
- Try to build minimum size release config
sw build -config msr
Upd.: It may be not very convenient at the moment, but should be improved in the future sw2.
Thanks for the update!
So if I understand correctly, I can use the variables passed from sw build -D to make conditional changes to builds in sw.cpp, however the "best I can do" is define variables for compilers (via CompileOptions.push_back)?
In that case I'll try the release config and call it an upgrade for sw2!
--with-curl=no
And if you want to exclude something, it is only possible if supported by underlying script with those conditions.
Also it is not possible to affect predefined config options at the moment (like removing flags). But I have this in mind for the future version.