Code Monkey home page Code Monkey logo

Comments (5)

rohit-kumar-j avatar rohit-kumar-j commented on July 30, 2024 1

@Civitasv, I faced a similar limitation. My executable was in build/bin/Debug/exec.exe, and it is supposed to produce a data.txt file.

When CMakeRun is invoked, it produces a file in the directory from which it was run and produces outputs in the same directory (root_dir/data.txt) which is undesirable.(root_dir ~$ build/bin/Deubg/exec.exe)

On VSCode, when CMakeRun is invoked, the executable is run from its own build directory by default: (root_dir/build/bin/Deubg ~$ exec.exe) thereby not cluttering the root_dir. The output files are in (root_dir/build/bin/Debug/data.txt)

I think a conditional default option to set this behaviour would be a good idea:..

-- const.lua

const = {
    ...
    cmake_launch_from_build_dir = true,
    ...
}

from cmake-tools.nvim.

Civitasv avatar Civitasv commented on July 30, 2024

Can you give a specific example? like the file structure of your project

from cmake-tools.nvim.

TheSunCat avatar TheSunCat commented on July 30, 2024

Yes of course. I am using this project by adding DefineGameProject(Test) at the end of CMakeLists.txt, running cmake once to generate it, then running nvim Projects/Test/Test.cpp. The workring directory would ideally be $(pwd)/Projects/$project/Resources, so each project can load its own resources, but it appears to be set to the path nvim was invoked from.

from cmake-tools.nvim.

rohit-kumar-j avatar rohit-kumar-j commented on July 30, 2024

@TheSunCat, commit : a23d98 from pull #47 fixes this launch from build directory. Since there are a few more proposed upgrades in #47, it might take sometime to get tested on linux and MacOS (currently I am testing on windows with MSBuild and MSVC).

Added default option:
cmake_launch_from_built_binary_directory = true,

Edit:

Note: This does not parse the CMakePresets.json to find a specific directory per target and then launch the executable or target according to that setting (Not sure if this is what is needed here, but I'm not sure if this is even necessary... theoretically there can be infinite possible customization here😃)

from cmake-tools.nvim.

rohit-kumar-j avatar rohit-kumar-j commented on July 30, 2024

@TheSunCat, #51 does this by default. You can now test this.

from cmake-tools.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.