Run Windows batch script in POST_BUILD command even when generating on Linux machine - linux

I'm using Visual Studio 2019 combined with CMake to cross compile my project on both PC environment (generating .sln file) and remote Linux machine (Generating Makefile file). I'm switching between the environments using Visual Studio's Cross Compilation feature.
Is it somehow possible to run a Windows batch script on POST_BUILD command even when I'm generating CMake on the Linux environment ?
I want this (or any other solution which will achieve the same) to work even when generating on Linux:
add_custom_command(
POST_BUILD
myTarget
COMMAND cmd /c H:/pathToMyCommand/myCommand.bat
)
(remember that I'm in Windows enviroment as Visual Studio is invoking CMake on the remote Linux machine)
I currently adding a custom command which run a shell script directly from the Linux machine and connecting to the Windows environment, but I prefer to run a batch directly from Windows.
Is it possible?

Related

Gradle exec PATH in Android Studio doesn't match command line

I'm running a Gradle script that needs to exec a few commands. (In my example, it's node.)
In my Terminal, node is on my PATH, so I can type node --version and it just works. My Gradle script works fine on the command line.
But when I try to run the Gradle build in Android Studio, it says:
> A problem occurred starting process 'command 'node''
Cause: error=2, No such file or directory
Unfortunately, the way this script runs on various machines, I can't be sure what the path to node will be; I need to use the PATH environment from the user's machine. (On macOS, node might be in /usr/local/bin or /opt/homebrew/bin or ~/n/bin or something else entirely.)
How do I make this work?
EDIT: To clarify, our developers will launch Android Studio via the OS launcher, e.g. by double-clicking it in Finder on macOS, or from the Start menu in Windows.
My hunch would be that the PATH in Android Studio depends on how Android Studio is started. If I start it from a Linux shell, then it uses the same PATH which is set in that shell. If you use an OS-specific launcher, then I suppose the PATH depends on what this launcher used – which may be different from the one that you set explicitly/implicitly for your shell (e.g., in a ~/.bashrc file).
I doubt that you can get this to work reliably without manually making sure on all user machines that the PATH is always set correctly for Android Studio – or that you manually make sure that all node installations end up on the “most system-wide” PATH that is available for each OS installation.

VSCode execute node script on remote linux or windows machine

Using VSCode, is it possible to execute a node.js script on a remote linux or windows system without setting up a full Visual Studio Code Remote Development Environment?
Assume the following:
VSCode installed on client (Windows)
remote system is a virtual machine running on the client. It has access to the project folder (including the script to be executed and the node modules) on the client. Node is installed on the remote system.
Actually I just need something like a launch configuration which executes an SSH command for linux, for windows maybe something else. With these assumptions (shared project folder between remote system and client), is that possible without setting up a full Visual Studio Code Remote Development Environment? I don't need remote editing or debugging.

How to run a command in Developer command prompt 2019 using Python

I'm trying to do build in Developer Command Prompt of VS 2019 using Python script.
Here is piece of code i'm using:
import os
os.system('start /wait C:/Windows/System32/cmd.exe "msbuild C:/Users/Desktop/Project/Project.sln"')
os.system("pause")
But it is not working.Developer command prompt is appearing for just 1sec and disappearing .
When i took variable to check if command was succesful or not ,it is giving variable result as zero,which means command is successful but i'm not able to see it in Developer command prompt.
result= os.system('start /wait C:/Windows/System32/cmd.exe /k ipconfig')
print (result)
Whereas when i'm trying the same command in windows command prompt it's working fine.
How to run a command in Developer command prompt 2019 using Python
Developer command prompt 2019 is a tool which is integrated into VS2019 IDE and provides environment parameters for various development modules.
However, the CMD.exe does not have these environment variables for these, so you cannot just use CMD.exe directly. Sorry that I am not familiar with python code and script. I suggest you could configure Developer command prompt 2019 into System environment variable PATHand then call cmd.exe which integrates the related variables to build your projects without any errors.
Suggestion
First, if you build your project on another new agent, you should install one of tool from step 1.
1) If you install VS2019 IDE in your local agent,please make sure that your local agent has VS2019 IDE and install the related workload about your project type.
Besides, if you install Build Tool for VS2019, please also install the related workload.
2) set the below path under System environment variable PATH
VS2019 IDE:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
Build Tool for VS2019:
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
3) Then you can call your python script as you described to build your projects.
Any feedback and concern will be expected.

How to set environment variables on remote linux host in a visual studio crossplatform cmake project

I'm using Visual Studio 2017 to edit a cmake project according to this tutorial
However, my environment is of 64bit, and I need to build a 32bit program. And yes I have all the i386 dev libs on my machine.
I can achieve this on linux simply by typing CC="gcc -m32" CXX="g++ -m32" cmake .. But I just cannot find how to specify remote environment variables in vs' CMakeSettings.json or any other way.
I have tried exporting environment variables on linux .profile, but this won't work on vs. Running the same command directly on ssh works fine.
Also have tried setting cmakeExecutable variable in CMakeSettings.json with prefixed CC=..., and got rejected by vs.
Okay, not familiar with cmake, it seems just set cmakeCommandArgs would work.
In CMakeSettings.json, "cmakeCommandArgs": "-D CMAKE_C_FLAGS=\"-m32\" -D CMAKE_CXX_FLAGS=\"-m32\""

linux eclipse Remote-system shell

I am trying to run commands on my local system (Ubuntu 12.04) through the Remote Systems view in Eclipse (Juno) as explained here: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.rse.doc.user%2Ftasks%2Ftruncmdsview.html&cp=58_4_0
I open the local shell, but no command is executed after I press enter. Am I missing some configuration steps? I installed Eclipse by downloading and uncompressing the program, not through repositories.

Resources