Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add details related to testing in docs #2596

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 89 additions & 90 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,114 +27,113 @@ LFortran, see that project for a list of sponsors.
Follow the steps below to install and run LPython on Linux, Windows or macOS.

## Prerequisites
- ### Install Conda
Follow the instructions provided [here](https://github.com/conda-forge/miniforge/#download) to install Conda on your platform (Linux, macOS and Windows) using a conda-forge distribution called Miniforge.

For Windows, these are additional requirements:
- Miniforge Prompt
- Visual Studio (with "Desktop Development with C++" workload)

- ### Set up your system
- Linux
- Run the following command to install some global build dependencies:

```bash
sudo apt-get install build-essential binutils-dev clang zlib1g-dev
```
- Windows
- Download and install [Microsoft Visual Studio Community](https://visualstudio.microsoft.com/downloads/) for free.

- Run the Visual Studio Installer. Download and install the "Desktop Development with C++" workload which will install the Visual C++ Compiler (MSVC).

- Launch the Miniforge prompt from the Desktop. It is recommended to use MiniForge instead of Powershell as the main terminal to build and write code for LPython. In the MiniForge Prompt, initialize the MSVC compiler using the below command:

```bash
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd" -arch=x64
```

You can optionally test MSVC via:

```bash
cl /?
link /?
```

Both commands must print several pages of help text.

- Windows with WSL
- Install Miniforge Prompt and add it to path:
```bash
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/conda_root
export PATH="$HOME/conda_root/bin:$PATH"
conda init bash # (shell name)
```
- Open a new terminal window and run the following commands to install dependencies:
```bash
conda create -n lp -c conda-forge llvmdev=11.0.1 bison=3.4 re2c python cmake make toml clangdev git
```

- Optionally, you can change the directory to a Windows location using `cd /mnt/[drive letter]/[windows location]`. For e.g. - `cd mnt/c/Users/name/source/repos/`.
### Install Conda
Follow the instructions provided [here](https://github.com/conda-forge/miniforge/#download) to install Conda on your platform (Linux, macOS and Windows) using a conda-forge distribution called Miniforge.


- ### Clone the LPython repository
Make sure you have `git` installed. Type the following command to clone the repository:
For Windows, these are the additional requirements:
- Miniforge Prompt
- Visual Studio (with "Desktop Development with C++" workload)

### Set up your system
#### Linux
Run the following command to install some global build dependencies:
```bash
sudo apt-get install build-essential binutils-dev clang zlib1g-dev
```
#### Windows
- Download and install [Microsoft Visual Studio Community](https://visualstudio.microsoft.com/downloads/) for free.

- Run the Visual Studio Installer. Download and install the "Desktop Development with C++" workload which will install the Visual C++ Compiler (MSVC).

- Launch the Miniforge prompt from the Desktop. It is recommended to use MiniForge instead of Powershell as the main terminal to build and write code for LPython. In the MiniForge Prompt, initialize the MSVC compiler using the below command:

```bash
call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd" -arch=x64
```

You can optionally test MSVC via:

```bash
git clone https://github.com/lcompilers/lpython.git
cd lpython
cl /?
link /?
```

Both commands must print several pages of help text.

#### Windows with WSL
- Install Miniforge Prompt and add it to path:
```bash
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/conda_root
export PATH="$HOME/conda_root/bin:$PATH"
conda init bash # (shell name)
```
- Open a new terminal window and run the following commands to install dependencies:
```bash
conda create -n lp -c conda-forge llvmdev=11.0.1 bison=3.4 re2c python cmake make toml clangdev git
```

- Optionally, you can change the directory to a Windows location using `cd /mnt/[drive letter]/[windows location]`. For e.g. - `cd mnt/c/Users/name/source/repos/`.


You may also use GitHub Desktop to do the same.
### Clone the LPython repository
Make sure you have `git` installed. Type the following command to clone the repository:

```bash
git clone https://github.com/lcompilers/lpython.git
cd lpython
```

You may also use GitHub Desktop to do the same.

## Building LPython
- ### Linux and macOS
- Create a Conda environment:
### Linux and macOS
- Create a Conda environment:

```bash
conda env create -f environment_unix.yml
conda activate lp
```
```bash
conda env create -f environment_unix.yml
conda activate lp
```

- Generate the prerequisite files and build in Debug Mode:
- Generate the prerequisite files and build in Debug Mode:

```bash
# if you are developing on top of a forked repository; please run following command first
# ./generate_default_tag.sh
```bash
# If you are developing on top of a forked repository, please run following command first - ./generate_default_tag.sh


./build0.sh
./build1.sh
```
./build0.sh
./build1.sh
```

- ### Windows
- Create a Conda environment using the pre-existing file:
### Windows
- Create a Conda environment using the pre-existing file:

```bash
conda env create -f environment_win.yml
conda activate lp
```
```bash
conda env create -f environment_win.yml
conda activate lp
```

- Generate the prerequisite files and build in Release Mode:
- Generate the prerequisite files and build in Release Mode:

```bash
call build0.bat
call build1.bat
```
- ### Windows with WSL
```bash
call build0.bat
call build1.bat
```
### Windows with WSL

- Activate the Conda environment:
```bash
conda activate lp
```
- Activate the Conda environment:
```bash
conda activate lp
```

- Run the following commands to build the project:
```bash
./build0.sh
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_LLVM=yes -DCMAKE_INSTALL_PREFIX=`pwd`/inst .\
make -j8
```

- Run the following commands to build the project:
```bash
./build0.sh
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_LLVM=yes -DCMAKE_INSTALL_PREFIX=`pwd`/inst .\
make -j8
```
Check the [installation-docs](./doc/src/installation.md) for more.
Check the [installation-docs](./doc/src/installation.md) for more information like testing.

## Contributing

Expand Down
Loading
Loading