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

Override compiler options in sw.cpp #52

Closed
ollydev opened this issue Sep 15, 2020 · 5 comments
Closed

Override compiler options in sw.cpp #52

ollydev opened this issue Sep 15, 2020 · 5 comments
Labels
question Further information is requested

Comments

@ollydev
Copy link

ollydev commented Sep 15, 2020

Sorry for being a pain, but is there any way to override options that are added in the projects sw.cpp from the command line?
For example, I don't want this libtesseract.CompileOptions.push_back("-arch:AVX2");

Or is it designed to manually change sw.cpp if you need to change options?

@ollydev ollydev added the question Further information is requested label Sep 15, 2020
@egorpugin
Copy link
Contributor

but is there any way to override options that are added in the projects sw.cpp from the command line?

No, option passing to deep deps is in TODO list.
Currently the only way (IIRC) is to comment it.

Actually, sw has a way to do this, but I did not investigate UX questions - cli options etc.
In other words, how user will pass it to tesseract library.

@egorpugin
Copy link
Contributor

Sorry for being a pain

It's ok. :) More users' requests - more features.

@ollydev
Copy link
Author

ollydev commented Sep 15, 2020

Just a random thought, not too familar with the project so this might not make sense

-buildoptions TESSERACT_USE_AVX2

if (libtesseract.getBuildSettings().hasOption("TESSERACT_USE_AVX2")) {
    libtesseract.CompileOptions.push_back("-arch:AVX2");
}

@egorpugin
Copy link
Contributor

egorpugin commented Sep 16, 2020

Yes. The second part (code) is very correct and even exists in sw (and works and even more features there).
https://github.com/SoftwareNetwork/sw/blob/master/src/sw/driver/dependency.h#L40

The first part is what I called UX - the way how you pass that option through whole sw to the target package (org....libtesseract in your case). It is not done yet. It is one of the core features of sw that is not implemented yet (research part is almost done there).

@egorpugin
Copy link
Contributor

One more thing.

What happens under the hood if you override something?
Sw will create (compile, build) separate version of binaries of changed package and all dependent packages in the graph.
So, when you enable default avx2 flag (on or off), you'll re-use binary packages previously built.
This is very cool property of sw and it is already there too.

(I'm not talking about disk space, because binaries later won't be built on your pc and will be downloaded like in usual package managers - securily of course and with check of gpg or any other signature. So no object files in this case. And when you explicitly ask for binary package with different options and there's no such binary on the web - package will be build on your system.)

@ollydev ollydev closed this as completed Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants