Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Run does not recognize root path #15

Closed
chriztheanvill opened this issue Oct 21, 2021 · 10 comments
Closed

Run does not recognize root path #15

chriztheanvill opened this issue Oct 21, 2021 · 10 comments
Labels
bug Something isn't working

Comments

@chriztheanvill
Copy link

Bug description

Using :Cmake run or :CMake Build_and_run does not recognize the root path. Because my assets are in the rootpath. But if I made this "./build/linux-debug/bin/program_name it works excellent.

Steps to reproduce
:Cmake run or :CMake Build_and_run

Just installed the plugin.

Expected behavior

Run the program, loading the rootpath.

Screenshots

Environment

  • OS: Kubuntu 21.10
  • Desktop environment: KDE plasma 5
  • Plugins commit hash:

Additional context

For this, its the only problem, but if it could be change the settings:

  • Telescope cmake select_target
  • Telescope cmake select_build_type
    This settings could be also available in :CMake menu? Like :CMake select_target
@chriztheanvill chriztheanvill added the bug Something isn't working label Oct 21, 2021
@Shatur
Copy link
Owner

Shatur commented Oct 21, 2021

Steps to reproduce
:Cmake run or :CMake Build_and_run
Just installed the plugin.

Can't reproduce.

@chriztheanvill
Copy link
Author

chriztheanvill commented Oct 21, 2021

This is with :CMake run, and also occurs with :CMake build_and_run:
image

This is from terminal:
image

Also, if is the possibility when open an external terminal to see the output of the program.

@Shatur
Copy link
Owner

Shatur commented Oct 21, 2021

This is with :CMake run, and also occurs with :CMake build_and_run:

So the program runs correctly. The issue is that you can't load resources. Are they located at the source directory?

@chriztheanvill
Copy link
Author

My project dir is:
image

This is the root dir:

  • 0000 is where the source code is

Note: It has the .vscode and vscode_workspace, it is just copy paste and I lazy to delete them.

@Shatur
Copy link
Owner

Shatur commented Oct 21, 2021

My project dir is:

This tells me nothing. But I assume that you load resources from the source directory. You shouldn't. You need to configure CMake to copy all your data to your build directory automatically.

@chriztheanvill
Copy link
Author

I've moved the assets to build, build/linux-debug/ and nothing.
image

@Shatur
Copy link
Owner

Shatur commented Oct 21, 2021

I've moved the assets to build, build/linux-debug/ and nothing.

No, you should locate the resources at the bin folder. Or you can specify runDir in your neovim.json to run the application from you build directory (by default it runs in your application build directory, build/linux-debug/bin in your case). Read more about configuration here.

@chriztheanvill
Copy link
Author

chriztheanvill commented Oct 21, 2021

I moved to bin and works. To specify or config cmake to copy the assets folder to build/linux-debug/bin, How it could be?
Really thank you, I am still learning about cmake.

Edit: Also edited the neovim.json with runDir: ".." and works without moving the assets to bin.
But I prefer the solution that you propose.

@chriztheanvill
Copy link
Author

I made it, with

file(COPY assets DESTINATION ${CMAKE_BINARY_DIR}/bin)

@Shatur
Copy link
Owner

Shatur commented Oct 21, 2021

I made it, with

Great. Yes, this is how it usually done.

@Shatur Shatur closed this as completed Oct 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants