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

Installing a specific target doesn't install it's dependencies #5788

Open
01Pollux opened this issue Nov 4, 2024 · 6 comments
Open

Installing a specific target doesn't install it's dependencies #5788

01Pollux opened this issue Nov 4, 2024 · 6 comments
Labels

Comments

@01Pollux
Copy link

01Pollux commented Nov 4, 2024

Xmake Version

xmake v2.9.6+HEAD.abd15c255

Operating System Version and Architecture

Windows 11 23H2

Describe Bug

Installing a target with xmake install -o install <target> doesn't install the dependencies related to <target>.

Expected Behavior

Installing the target should implicitly install all dependencies down the tree.

Project Configuration

set_languages("cxxlatest")

add_rules("mode.debug")

target("library")
    set_kind("shared")
    add_files("*.cpp")
    on_install(function(target)
        print("installing library")
    end)
target_end()

target("console_app")
    set_kind("binary")
    add_files("*.cpp")
    add_deps("library")
    on_install(function(target)
        print("installing console_app")
    end)
target_end()

Additional Information and Error Logs

PS C:\...> xmake install -o install 
checking for Microsoft Visual Studio (x64) version ... 2022
checking for Microsoft C/C++ Compiler (x64) version ... 19.42.34432
installing library
installing console_app
install ok!
PS C:\...> xmake install -o install console_app
installing console_app
install ok!
@01Pollux 01Pollux added the bug label Nov 4, 2024
@waruqi
Copy link
Member

waruqi commented Nov 5, 2024

     on_install(function(target)
        print("installing console_app")
    end)

because you rewrited on_install

@01Pollux
Copy link
Author

01Pollux commented Nov 5, 2024

The issue persists despite removing on_install for console_app

@waruqi
Copy link
Member

waruqi commented Nov 6, 2024

The issue persists despite removing on_install for console_app

it works for me.

set_languages("cxxlatest")

add_rules("mode.debug")

target("library")
    set_kind("shared")
    add_files("src/*.cpp")
    on_install(function(target)
        print("installing library")
    end)
target_end()

target("console_app")
    set_kind("binary")
    add_files("src/*.cpp")
    add_deps("library")
ruki-2:test ruki$ xmake install -o /tmp/test1
installing library <-------------------------------
installing console_app ..
installing console_app to /tmp/test1 ..
install ok!

@01Pollux
Copy link
Author

01Pollux commented Nov 6, 2024

But using xmake install -o ... installs all targets, can't we build and install only one target and its dependencies?

set_languages("cxxlatest")

add_rules("mode.debug")

target("library")
    set_kind("static")
    add_files("src/*.cpp")
    on_install(function(target)
        print("installing library")
    end)
target_end()

target("console_app1")
    set_kind("binary")
    add_files("src/*.cpp")
    add_deps("library")
target_end()

target("console_app2")
    set_kind("binary")
    add_files("src/*.cpp")
    add_deps("library")
target_end()

To run xmake install -o /tmp/test1, one must build everything at first.
My suggestion was to only build and install console_app1 and its dependencies (library)

@waruqi
Copy link
Member

waruqi commented Nov 6, 2024

it will install console_app1 and its dep libraries, but it will not call library's on_install.

ruki-2:test ruki$ xmake install -o /tmp/foo console_app
installing console_app ..
installing console_app to /tmp/foo ..
install ok!
ruki-2:test ruki$ tree /tmp/foo
/tmp/foo
├── bin
│   └── console_app
└── lib
    └── liblibrary.dylib

@01Pollux
Copy link
Author

01Pollux commented Nov 7, 2024

Shouldn't it call it? it's possible that library's on_install installs/copies assets for example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants