It is better to use Bash on Ubuntu on Windows only from build 15063 (Creators Update).
- If not already installed, please install chocolatey
- If not already installed, please install an X server with this procedure: open Powershell with Administrator privileges and write
PS \> cinst -y vcxsrv
- Run VcXsrv (it is necessary to keep it open whenever you need any graphical process inside Bash!)
- If it not already enabled, turn on UoW following the official guide
- Open Ubuntu and enable the graphics through VcXsrv with this command
echo -e "\n export DISPLAY=localhost:0.0 \n" >> ~/.bashrc
- Close the Bash and follow now the Ubuntu guide
- Define a work folder, which we will call WORKSPACE in this tutorial: this could be a "Code" folder in our home, a "c++" folder on our desktop, whatever you want. Create it if you don't already have, using your favourite method (mkdir in bash, or from the graphical interface of your distribution). We will now define an environment variable to tell the system where our folder is. Please note down the full path of this folder, which will look like
/home/$(whoami)/code/
- Open a Bash terminal and type the following commands (replace
/full/path/to/my/folder
with the previous path noted down)
echo -e "\n export WORKSPACE=/full/path/to/my/folder \n" >> ~/.bashrc
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install -y g++ cmake make git dos2unix ninja-build
git config --global core.autocrlf input
git clone https://github.com/physycom/sysconfig
sudo apt-get install -y libboost-all-dev libfltk1.3-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev libxinerama-dev libjpeg-dev libxi-dev libxmu-dev libcurl4-openssl-dev
- Open a Bash terminal and type the following command
cmake --version
If the cmake
installed version is lower than 3.1, it is necessary to manually update it to be able to build the code. Otherwise, your procedure is finished.
- Open a Bash terminal and type these commands (if you use a 32 bit linux, copy from the second block)
Linux 64 bit
cd $WORKSPACE
export CMAKE_FULL_VERSION="cmake-3.10.0-Linux-x86_64"
export CMAKE_VERSION="v3.10"
mkdir cmake
cd cmake
wget https://cmake.org/files/${CMAKE_VERSION}/${CMAKE_FULL_VERSION}.tar.gz
tar zxvf ${CMAKE_FULL_VERSION}.tar.gz
echo -e "\n export PATH=${WORKSPACE}/cmake/${CMAKE_FULL_VERSION}/bin:\$PATH \n" >> ~/.bashrc
Linux 32 bit
cd $WORKSPACE
export CMAKE_FULL_VERSION="cmake-3.6.0-Linux-i386.tar.gz"
export CMAKE_VERSION="v3.6"
mkdir cmake
cd cmake
wget https://cmake.org/files/${CMAKE_VERSION}/${CMAKE_FULL_VERSION}.tar.gz
tar zxvf ${CMAKE_FULL_VERSION}.tar.gz
echo -e "\n export PATH=${WORKSPACE}/cmake/${CMAKE_FULL_VERSION}/bin:\$PATH \n" >> ~/.bashrc
- If not already installed, install the XCode Command Line Tools, typing this command in a terminal:
xcode-select --install
- If not already installed, install Homebrew following the official guide.
- Open the terminal and type these commands
brew update
brew upgrade
brew install cmake make git dos2unix ninja
git config --global core.autocrlf input
git clone https://github.com/physycom/sysconfig
brew install fltk boost freeglut
- Define a work folder, which we will call WORKSPACE in this tutorial: this could be a "Code" folder in our home, a "c++" folder on our desktop, whatever you want. Create it if you don't already have, using your favourite method (mkdir in bash, or from the graphical interface in Finder). We will now define an environment variable to tell the system where our folder is. Please note down the full path of this folder, which will look like
/home/$(whoami)/code/
- Open a Terminal and type the following command (replace
/full/path/to/my/folder
with the previous path noted down)
echo -e "\n export WORKSPACE=/full/path/to/my/folder \n" >> ~/.bash_profile
- Install or update Visual Studio to at least version 2017, making sure to have it fully patched (run again the installer if not sure to automatically update to latest version). If you need to install from scratch, download VS from here: Visual Studio 2017 Community
- If not already installed, please install chocolatey using the official guide
- If you are not sure about having them updated, or even installed, please install
git
,cmake
and an updatedPowershell
. To do so, open your Powershell with Administrator privileges and type
PS \> cinst -y git cmake powershell ninja
- Restart the PC if required by chocolatey after the latest step
- Open your Powershell with Administrator privileges, type the following command and confirm it:
PS \> Set-ExecutionPolicy unrestricted
- Define a work folder, which we will call WORKSPACE in this tutorial: this could be a "Code" folder in our home, a "cpp" folder on our desktop, whatever you want. Create it if you don't already have, using your favourite method (mkdir in Powershell, or from the graphical interface in explorer). We will now define an environment variable to tell the system where our folder is. Please note down its full path. Open a Powershell (as a standard user) and type
PS \> rundll32 sysdm.cpl,EditEnvironmentVariables
- In the upper part of the window that pops-up, we have to create three new environment variables: one with name
WORKSPACE
and value the full path noted down before, one with nameVCPKG_ROOT
and value%WORKSPACE%\vcpkg
and finally one with nameVCPKG_DEFAULT_TRIPLET
and valuex64-windows-physycom
. If it not already in thePATH
(this is possible only if you did it before), we also need to modify the "Path" variable adding the following string (on Windows 10 you need to add a new line to insert it, on Windows Windows 7/8 it is necessary to append it using a;
as a separator between other records):
%PROGRAMFILES%\CMake\bin
- Open a Powershell (as a standard user) and type
PS \> cd $env:WORKSPACE
PS Code> git config --global core.autocrlf input
PS Code> git clone https://github.com/physycom/sysconfig.git
- If
vcpkg
is not installed, please follow the next procedure, otherwise please jump to #10
PS \> cd $env:WORKSPACE
PS Code> git clone https://github.com/Microsoft/vcpkg.git
PS Code> cd vcpkg
PS Code> cp ..\sysconfig\cmake\x64-windows-physycom.cmake .\triplets\
PS Code\vcpkg> .\bootstrap-vcpkg.bat
- Open a Powershell with Administrator privileges and type
PS \> cd $env:WORKSPACE
PS Code> cd vcpkg
PS Code\vcpkg> .\vcpkg integrate install
- Open a Powershell (as a standard user) and type (the last command requires a confirmation and is used to clean up unnecessary files)
PS \> cd $env:WORKSPACE
PS Code> cd vcpkg
PS Code\vcpkg> .\vcpkg install fltk fltk:x86-windows-static boost boost:x86-windows-static freeglut freeglut:x86-windows-static opengl opengl:x86-windows-static
PS Code\vcpkg> rmdir .\buildtrees\
PS Code\vcpkg> cd ([Environment]::GetFolderPath("mydocuments"))
PS \> mkdir WindowsPowerShell -Force
PS \> cd WindowsPowerShell
PS WindowsPowerShell\> explorer .
- In the folder that is open now, please copy the file
Microsoft.PowerShell_profile.ps1
from this repository
- To update software installed with Chocolatey, open a Powershell with Administrator privileges and type
PS \> cup all -y
- To update libraries installed with vcpkg, open a Powershell (as a standard user), type these commands and follow on-screen instructions
PS \> cd $env:WORKSPACE
PS Code> cd vcpkg
PS Code> git pull
PS Code> .\bootstrap-vcpkg.bat
PS Code> .\vcpkg update
PS Code> .\vcpkg upgrade --no-dry-run
- If not already installed, please install chocolatey using the official guide
- Open a Powershell with Administrator privileges and type
PS \> cinst -y cygwin
- Define a work folder, which we will call WORKSPACE in this tutorial: this could be a "Code" folder in our home, a "cpp" folder on our desktop, whatever you want. Create it if you don't already have, using your favourite method (mkdir in Powershell, or from the graphical interface in explorer). We will now define an environment variable to tell the system where our folder is. Please note down its full path. Open a Powershell (as a standard user) and type
PS \> rundll32 sysdm.cpl,EditEnvironmentVariables
- In the upper part of the window that pops-up, create a new variable with name WORKSPACE and value the full path noted down before
- Open a Powershell (as a standard user) and type (remove the
_x64
suffix in the second line if your operating system is 32 bit)
PS \> cd $env:WORKSPACE
PS Code> Invoke-WebRequest https://cygwin.com/setup-x86_64.exe -OutFile $env:WORKSPACE\cygwin-setup.exe
PS Code> .\cygwin-setup --quiet-mode --no-shortcuts --no-startmenu --no-desktop --upgrade-also --packages gcc-g++,cmake,git,dos2unix,libboost-devel,libfltk-devel,libglut-devel,libGL-devel,libGLU-devel,fluid,libjpeg-devel,libXi-devel,libXmu-devel
PS Code> git clone https://github.com/physycom/sysconfig.git