Skip to content

Commit feea67f

Browse files
committed
Use pixi to build conda packages
1 parent 98b7248 commit feea67f

File tree

6 files changed

+120
-8
lines changed

6 files changed

+120
-8
lines changed

CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ if(GDX_IS_TOPLEVEL)
3737
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/geodynamix)
3838

3939
project(GeoDynamiX
40-
VERSION 0.14.5
40+
VERSION 0.14.6
4141
LANGUAGES C CXX
4242
)
4343
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
@@ -69,10 +69,10 @@ if(GDX_IS_TOPLEVEL)
6969
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMT")
7070
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:MSVCRT /NODEFAULTLIB:LIBCMT")
7171

72-
# Enable faster linking for debug builds
73-
# set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG:FASTLINK")
74-
# set (CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEBUG:FASTLINK")
75-
# set (CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /DEBUG:FASTLINK")
72+
# Enable faster linking for debug builds
73+
# set (CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG:FASTLINK")
74+
# set (CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEBUG:FASTLINK")
75+
# set (CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /DEBUG:FASTLINK")
7676
else()
7777
add_compile_options(
7878
-Wall -Wextra -Wpedantic -Wfatal-errors -Wno-unknown-pragmas

algorithms/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if(TARGET GEOS::geos)
5656
list(APPEND GDXALGO_PUBLIC_HEADERS include/gdx/algo/polygoncoverage.h)
5757
endif()
5858

59-
add_library(gdxalgo
59+
add_library(gdxalgo STATIC
6060
${GDXALGO_PUBLIC_HEADERS}
6161
accuflux.cpp
6262
reclass.cpp

core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ if (GDX_ENABLE_SIMD)
115115
)
116116
endif ()
117117

118-
add_library(gdxcore
118+
add_library(gdxcore STATIC
119119
${GDXCORE_PUBLIC_HEADERS}
120120
raster.cpp
121121
)

deps/infra

Submodule infra updated 135 files

justfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
set export := true
2+
3+
export GIT_COMMIT_HASH := `git rev-parse HEAD`
4+
5+
[windows]
6+
pixi_build:
7+
rm -rf ./.pixi/build
8+
rm -rf ./build/conda
9+
pixi build --output-dir=./build/conda
10+
11+
# Build conda package using pixi in a clean environment (no nix/devenv pollution)
12+
[unix]
13+
pixi_build:
14+
#!/usr/bin/env sh
15+
echo "Building pixi package in clean environment (excluding nix paths)..."
16+
# Remove existing build artifacts safely
17+
if [ -d .pixi/build/work ]; then \
18+
find .pixi/build/work -mindepth 1 -maxdepth 1 -name "urbclim-*" -exec rm -rf {} + 2>/dev/null || true; \
19+
fi
20+
# Run pixi build with minimal environment to avoid nix store pollution
21+
# We need to keep enough PATH to find pixi and basic tools
22+
env -i \
23+
HOME="$HOME" \
24+
USER="$USER" \
25+
TERM="${TERM:-xterm}" \
26+
GIT_COMMIT_HASH="$GIT_COMMIT_HASH" \
27+
PATH="/run/current-system/sw/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/.local/bin:$HOME/.pixi/bin" \
28+
sh -c 'pixi build --output-dir=./build/conda'

pixi.toml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
[workspace]
2+
channels = ["conda-forge"]
3+
platforms = ["linux-64", "osx-64", "win-64"]
4+
preview = ["pixi-build"]
5+
6+
[workspace.build-variants]
7+
python = ["3.12.*", "3.13.*", "3.14.*"]
8+
9+
[dev]
10+
# make sure the build dependencies of eif are available in all envs
11+
geodynamix = { path = "." }
12+
13+
[package]
14+
name = "geodynamix"
15+
version = "0.14.6"
16+
17+
[package.build]
18+
backend = { name = "pixi-build-cmake", version = "*", channels = ["https://prefix.dev/conda-forge"] }
19+
20+
[package.build.config]
21+
compilers = ["c", "cxx"]
22+
extra-args = [
23+
"-DBUILD_TESTING=OFF",
24+
"-DBUILD_BINDINGS=ON",
25+
"-DBUILD_PYTHON_BINDINGS=ON",
26+
"-DCMAKE_IGNORE_PATH=/nix/store",
27+
"-DPACKAGE_VERSION_COMMITHASH=$GIT_COMMIT_HASH",
28+
"-DnetCDFCxx_DIR=$PREFIX/lib/cmake/netCDF",
29+
"-DGDX_ENABLE_OPENMP=OFF",
30+
"-DGDX_AVX2=OFF",
31+
"-DGDX_ENABLE_SIMD=OFF",
32+
"-DGDX_ENABLE_TOOLS=OFF",
33+
"-DGDX_ENABLE_TESTS=OFF",
34+
"-DGDX_ENABLE_TEST_UTILS=OFF",
35+
"-DGDX_PYTHON_BINDINGS=ON",
36+
"-DINFRA_ENABLE_TESTS=OFF",
37+
"-DGDX_INSTALL_DEVELOPMENT_FILES=OFF"
38+
]
39+
40+
[package.build.target.win-64.config]
41+
extra-args = [
42+
"-DBUILD_TESTING=OFF",
43+
"-DBUILD_BINDINGS=ON",
44+
"-DBUILD_PYTHON_BINDINGS=ON",
45+
"-DCMAKE_IGNORE_PATH=/nix/store",
46+
"-DPACKAGE_VERSION_COMMITHASH=%GIT_COMMIT_HASH%",
47+
"-DnetCDFCxx_DIR=$PREFIX/lib/cmake/netCDF",
48+
"-DGDX_ENABLE_OPENMP=OFF",
49+
"-DGDX_AVX2=OFF",
50+
"-DGDX_ENABLE_SIMD=OFF",
51+
"-DGDX_ENABLE_TOOLS=OFF",
52+
"-DGDX_ENABLE_TESTS=OFF",
53+
"-DGDX_ENABLE_TEST_UTILS=OFF",
54+
"-DGDX_PYTHON_BINDINGS=ON",
55+
"-DINFRA_ENABLE_TESTS=OFF",
56+
"-DGDX_INSTALL_DEVELOPMENT_FILES=OFF"
57+
]
58+
59+
[package.build-dependencies]
60+
cmake = ">=3.27.0,<4"
61+
ninja = ">=1.11.0,<2"
62+
63+
[package.host-dependencies]
64+
python = "*"
65+
spdlog = ">=1.17.0,<2"
66+
fmt = ">=12.1.0,<13"
67+
pybind11 = ">=3.0.1,<4"
68+
libgdal = ">=3.12.1,<4"
69+
eigen = ">=3.4.0,<4"
70+
71+
[package.run-dependencies]
72+
libgdal = ">=3.12.1,<4"
73+
74+
[feature.test.dependencies]
75+
benchmark = ">=1.9"
76+
doctest = ">=2.4"
77+
78+
[feature.test.tasks]
79+
configure = { cmd = "cmake --preset geodynamix-pixi" }
80+
build_debug = { cmd = "cmake --build --preset geodynamix-pixi-debug", depends-on = ["configure"] }
81+
build_release = { cmd = "cmake --build --preset geodynamix-pixi-release", depends-on = ["configure"] }
82+
83+
[environments]
84+
test = ["test"]

0 commit comments

Comments
 (0)