How to have two build environments on windows? - windows

I am using windows XP at my office and have set the development environment for building the embedded mobile projects of the company i am working for. I had set up the linux environment using cygwin but after that linux environment works fine, but the command line donot recognise the build commands(build mypath, build , build link) for my embedded projects. Is there any way to have both the environments working simultaneously ?

CMD or BAT file for fixing your PATH and other environment variable to match the target build environment.
cmd.exe can take a "/k" option to run your BAT file
Desktop shortcut to launch cmd.exe with the /k option start a command shell with the script that configures your environment.

Related

How can I run a robot test suite with Windows environment variable using pycharm terminal?

I setup an environment variable in Windows 10 called ROBOT_HOME and it points to my D:\Robot
When I run the test in my PyCharm terminal I use the following command -
robot --test "Example" %ROBOT_HOME%/test-cases
I require these environment variables as it is used company wide and they all call the same ROBOT_HOME and it needs to be defined in each Windows machine locally for it to work.
I am using the Intellibot#master.dev plugin in PyCharm.
It used to work until yesterday (as part of the robot course I'm going through, we used a diff robot framework plugin for PyCharm and now, even reverting back to the previous plugin, it won't work).
I keep getting "File Or Directory does not exist".
When I run the same command in command prompt, it works.
It used to work in the PyCharm terminal as well, not anymore.
In case it's worth mentioning, the PyCharm terminal is Windows Powershell.
In order to call an environment variable from the Powershell terminal in PyCharm, I needed to use the powershell env variable call -
$env:ROBOT_HOME
To see existing variable, can use the following command -
dir env:

Kicking off a WSL bash-based build from Visual Studio 2015

I recently started using the Windows Subsystem for Linux (WSL) to see if my Linux Makefile & arm-none-eabi-gcc based microcontroller project would build "natively" in Windows. To my surprise, the tool chain and Linux based development tools installed and worked perfectly on first go, without any modifications to the Makefile.
So that got me thinking to try doing all my code editing in Visual Studio using the IDE features while doing the actual build in the Linux & bash environment provided in WSL.
Unfortunately, when specifying a "Build Command Line" in the NMake options for my Visual Studio project, putting in "C:\Windows\System32\bash.exe build.sh" doesn't work because:
'C:\Windows\System32\bash.exe' is not recognized as an internal or external command,
operable program or batch file.
This is strange to me because I specified the full path and it couldn't find the WSL bash executable, and also attempting to add it as an "External Tool" doesn't seem to work because the executable doesn't show up in the selection window despite being able to see other executables in the same directory.
Some off topic opinion: If Microsoft can make Visual Studio and WSL work together seamlessly then I would likely switch from my Ubuntu virtual machine setup for a WSL based development environment.
Here's how you have to do it:
Nmake is not a 64-bit application, so when it tries to use Windows utilities and system32, WoW64 tricks it into looking in a different location.
The way you have to launch it from a 32-bit application is:
%windir%\sysnative\bash.exe
However, your command is also malformed. You will need to do it like this:
%windir%\sysnative\bash.exe -c "sh build.sh"
or maybe
%windir%\sysnative\bash.exe -c "./build.sh"
if DriveFS permissions allow execution.
otherwise it will attempt to execute build.sh as a command in your linux user's $PATH.
Source:
https://github.com/Microsoft/BashOnWindows/issues/870
This is what I have in my Build Command Line setting. It works fine.
start /WAIT %windir%\sysnative\bash.exe -c "cd /mnt/d/Projects/IoT/ESP8266/;./gen.sh -m DEBUG; read -n 1; exit;"

Continuous integration with microcontrollers

Just learning about CI and jenkins and wanted to take this concept to the embedded (basically microcontroller) world. The first step is just making sure builds don't break, but then I realized, I don't have a way to execute a build from a shell script on a linux machine (ubuntu server) for a build that usually happens with an IDE on a windows 7 VM. How can I automate opening up a Windows 7 VM and then building an MPLABX project for example.
I'm doing the same thing; a Jenkins server running on Ubuntu, and builds need to happen on Windows with some toolchains that don't always work well for automated builds (IAR in my case).
You can set up a Windows machine/VM with the right tools (incl. Java and git or whatever SCM you use), and install a Jenkins slave agent on it (see https://wiki.jenkins-ci.org/display/JENKINS/Step+by+step+guide+to+set+up+master+and+slave+machines).
Connect it to the Jenkins server as node/slave.
Now create a job that uses the "Windows batch command" build step. Your IDE probably has some way to build a project from command line.
Add a post-build step to archive artifacts, i.e. the built files you care about.
-> You can connect your Windows VM as jenkins node and activate Jenkins as service in it.
-> Try to build or run your project from command line. (windows cmd prompt)
-> If your tool has own prompt then invoke your prompt by using normal windows prompt and use.
-> After this you can run your commands in Jenkins using "Windows batch command"

The scope and when to run the SetEnv.Cmd of Windows SDK

Sorry about being a newbie for this issue... But I'd really like to know the scope and when to run the SetEnv.Cmd under the Bin folder of the Windows SDK.
Since I only ran it in a command prompt, isn't the environment variable settings I did their only local to that session? Do I need to re-run it after I close that session? I tried and it seems to be that I don't need to, but... Why is this all done in a local session?
Sorry about the naive question,
Shawn
The SDK build tools require environment variables to be configured for the include path, library path, exe path, etc. Each version of the SDK has its own include files, etc. so each version requires different values for the variables. Hence the variables cannot be configured as permanent variables for the user (or system).
Instead, each SDK version provides the SetEnv.cmd batch file to configure the environment for that version of the SDK, and the variables are local to the current command-prompt.
When you install the SDK you get a shortcut created in the Start Menu that opens a command-prompt and runs SetEnv.cmd for you. For example, on my computer I have "Windows SDK 7.1 Command Prompt".

How to include PATH executable in visual studio post-build

I'm trying to run a web app build process from Visual Studio and I got trouble running my scripts as the executable from the PATH config aren't included in the runned scripts.
Is there a way I can make sure the script is executed in a normal command line process? Or is there a way I can load these executable so they're available in the post/pre build script?
I'm using ruby and node.js in the build process (managed via Grunt). I can get Grunt to run easily by specifying the full absolute path, but then it fails when it tries to access Ruby commands.
So I found a solution working for me, I just launch the command in the cmd.exe process like so:
start cmd /C myCommand
With grunt, the full command can be this if someone is wondering:
start cmd /C %USERPROFILE%\AppData\Roaming\npm\grunt.cmd release --no-color > grunt_output.txt

Resources