Skip to content

Add binonly option for target install#6669

Closed
star-hengxing wants to merge 2 commits intoxmake-io:devfrom
star-hengxing:patch-1
Closed

Add binonly option for target install#6669
star-hengxing wants to merge 2 commits intoxmake-io:devfrom
star-hengxing:patch-1

Conversation

@star-hengxing
Copy link
Contributor

@waruqi
Copy link
Member

waruqi commented Aug 4, 2025

这个有啥用

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


What's the use of this

@SirLynix
Copy link
Member

SirLynix commented Aug 4, 2025

I have a game compiled with xmake that I want to distribute, as it's a game I only need to install its binaries.

@waruqi
Copy link
Member

waruqi commented Aug 4, 2025

I have a game compiled with xmake that I want to distribute, as it's a game I only need to install its binaries.

Why do not remove add_headerfiles for this target?

@SirLynix
Copy link
Member

SirLynix commented Aug 4, 2025

I have a game compiled with xmake that I want to distribute, as it's a game I only need to install its binaries.

Why do not remove add_headerfiles for this target?

Because they're useful for vs/vsxmake project generation. Also my game has libraries (it has multiple executables) and I don't need them to be installed.

Project for reference: https://github.com/DigitalPulseSoftware/ThisSpaceOfMine

@star-hengxing
Copy link
Contributor Author

star-hengxing commented Aug 4, 2025

  • cli tools
  • Plugins or language bindings, they only require shared libraries

@waruqi
Copy link
Member

waruqi commented Aug 4, 2025

We should use policy instead of adding new --binonly option whenever possible, which supports both cli and target configuration in xmake.lua

xmake f --policies=install.binary_only and set_policy("install.binary_only", true)

@SirLynix
Copy link
Member

SirLynix commented Aug 4, 2025

A policy requires a full reconfiguration of the project where the xmake install command can just skip folders, I'm not sure it's more interesting.

Also because in some cases you may be interested in the binaries and in other you may want the headers/libs as well for the same project, for example if python/curl/openssl/etc. were to use xmake it could be interesting to be able to only get the binaries in some cases and the binaries/include/libs in other.

@waruqi
Copy link
Member

waruqi commented Aug 4, 2025

We need to consider more extensibility, otherwise there will be --libonly, --headeronly in the future.

@SirLynix
Copy link
Member

SirLynix commented Aug 4, 2025

what about --no-headers --no-libraries instead?

@waruqi
Copy link
Member

waruqi commented Aug 5, 2025

Because they're useful for vs/vsxmake project generation.

you should use add_extrafiles instead of add_headerfiles, if you do not want to install them. it's only for project generation

what about --no-headers --no-libraries instead?

Just for personal preference, I don't like using too many --no-xxx, --without-xx, and --with-xxx options; it's just too cluttered.

Currently, install already has a --nopkgs option, but I'm not very satisfied with it. Now there are other styles of --no-xxx options, which makes it even more confusing.

It would be much better if a single option could be used to handle them, like --policies

@SirLynix
Copy link
Member

SirLynix commented Aug 5, 2025

you should use add_extrafiles instead of add_headerfiles, if you do not want to install them. it's only for project generation

This is not a solution, as it wouldn't prevent libraries generation (that would still be installed) and is mostly a hack, some rules (even user-defined) may differentiate headers and extra files.

It also doesn't fix the issue of libraries with standalone binaries where you may want only binaries in some cases and headers in other.

It would be much better if a single option could be used to handle them, like --policies

--without-headers and --without-libs options allows for composition which is more flexible than --only-bins or equivalent, it's also possible to make an --install=bins,libs,includes filter like option.

I don't think we should use policies for this kind of problem as it's independent of project configuration, you may want to install only binaries or everything for the same project, changing policies isn't straighforward in commandline (it's not easy to enable as you have to list every other policy as well) and requires a full config step.

@waruqi
Copy link
Member

waruqi commented Aug 5, 2025

--without-headers and --without-libs options allows for composition which is more flexible than --only-bins or equivalent, it's also possible to make an --install=bins,libs,includes filter like option.

I don't like the --without-, --no- and --with- prefixes.

or we can use --headers/binaries/libraries options, and they will be enabled by default.

if we want to only install binaries, you can pass --headers=n to disable it.

xmake install --headers=n
xmake install --headers=[y/n] --binaries=[y/n] --libraries=[y/n]

@waruqi
Copy link
Member

waruqi commented Aug 10, 2025

try this patch. #6688

@waruqi waruqi closed this Aug 10, 2025
@star-hengxing star-hengxing deleted the patch-1 branch August 10, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants