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

feat: add a pixi file and split into two envs (host & build) #2744

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
**/*.py -text
# GitHub syntax highlighting
pixi.lock linguist-language=YAML

# GitHub syntax highlighting
pixi.lock linguist-language=YAML linguist-generated=true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,7 @@ integration_tests/expr_12.c

# Interactive Shell
input
# pixi environments
.pixi
*.egg-info

31 changes: 26 additions & 5 deletions build1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,36 @@
set -e
set -x

cmake \
SRCDIR=`pwd`
CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH_LPYTHON;$CONDA_PREFIX"

# if we are in a pixi project, use the pixi "host" environment for the dependencies
if [[ ! -z $PIXI_PROJECT_ROOT ]]; then
CMAKE_PREFIX_PATH=$PIXI_PROJECT_ROOT/.pixi/envs/host/
OUTOFTREE=false

if [[ ! -f src/libasr/asr.h ]]; then
pixi run build_0
fi
fi

# if the outoftree env var is set to true, create a build directory
if [[ "$OUTOFTREE" == "true" ]]; then
mkdir -p build
cd build
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed for pixi build? If so, why not just move this logic to pixi.toml itself? That way this simple script can stay build system independent.



cmake $SRCDIR \
-GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_LLVM=yes \
-DLPYTHON_BUILD_ALL=yes \
-DWITH_STACKTRACE=yes \
-DWITH_RUNTIME_STACKTRACE=yes \
-DWITH_LSP=no \
-DWITH_LFORTRAN_BINARY_MODFILES=no \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH_LPYTHON;$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \
.
cmake --build . -j16 --target install
-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst

cmake --build . -j --target install
1 change: 1 addition & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ dependencies:
- zstd=1.5.6
- ninja=1.11.0
- rapidjson=1.1.0
- ninja
# - bison=3.4 [not win]
# - m2-bison=3.4 [win]
2 changes: 1 addition & 1 deletion environment_unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- git
- pip
- make
- ninja
- re2c
- toml
- zlib
Expand Down
1 change: 1 addition & 0 deletions integration_tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def main():

# Setup
global DEFAULT_THREADS_TO_USE, fast_tests, python_libs_req

os.environ["PATH"] = LPYTHON_PATH + os.pathsep + os.environ["PATH"]
# delete previously created directories (if any)
for backend in SUPPORTED_BACKENDS:
Expand Down
5,235 changes: 5,235 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[project]
name = "lp"
version = "0.1.0"
description = "Add a short description here"
authors = ["Wolf Vollprecht <[email protected]>"]
channels = ["conda-forge"]
platforms = ["osx-arm64", "linux-64", "win-64", "osx-64"]

[feature.host.tasks]
build_0 = "sh build0.sh"

start = { cmd = "build/src/bin/lpython -I build/src/runtime" }
clean = "rm -rf ./inst && rm -rf ./build"

[feature.host.dependencies]
git = "*"
pip = "*"
re2c = "*"
toml = "*"
zlib = "*"
numpy = "*"
flake8 = "*"
setuptools = "*"
python = "3.10.2.*"
llvmdev = "11.0.1.*"
zstd-static = "1.5.5.*"

[feature.host.target.unix.dependencies]
bison = "3.4.*"

[feature.host.target.win.dependencies]
m2-bison = "3.0.4"

[feature.compiler.dependencies]
cxx-compiler = "*"
cmake = "*"
ninja = "*"
python = "3.10.2.*"

[feature.compiler.tasks]
build_1 = { cmd = "sh build1.sh" }
build = { depends-on = ["build_0", "build_1"] }
test = { cmd = "python ./integration_tests/run_tests.py"}


[environments]
compiler = ["compiler"]
host = ["host"]
Loading