Skip to content

Commit

Permalink
Fix cmake variables. Add file with conda dev requirements.
Browse files Browse the repository at this point in the history
  • Loading branch information
tskisner committed Jan 7, 2025
1 parent 486cb7d commit 1b81a92
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 15 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/testconda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ jobs:
source ~/conda/etc/profile.d/conda.sh \
&& conda create --yes -n test python==${{ matrix.python }} \
&& conda activate test \
&& conda install --yes --file requirements.txt \
compilers libopenblas=*=*openmp* libblas=*=*openblas openblas=*=*openmp* \
boost gsl libflac
&& conda install --yes --file conda_dev_requirements.txt
- name: Install
run: |
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ else()
endif()

# Determine the location of site-packages.
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${Python_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)

# Numpy include directory?
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
execute_process(COMMAND ${Python_EXECUTABLE} -c
"import numpy; print(numpy.get_include())"
OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
OUTPUT_VARIABLE NUMPY_INCLUDE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)

Expand Down Expand Up @@ -88,8 +88,8 @@ target_link_libraries(so3g PUBLIC spt3g::core)
target_include_directories(so3g PRIVATE ${GSL_INCLUDE_DIR})
target_link_libraries(so3g PUBLIC ${GSL_LIBRARIES})

# Link to BLAS. You probably want to select openblas, so pass
# -DBLA_VENDOR=OpenBLAS
# Link to BLAS. You probably want to select openblas, so pass
# -DBLA_VENDOR=OpenBLAS
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
message("-- BLAS found: ${BLAS_LIBRARIES}")
Expand Down
34 changes: 34 additions & 0 deletions conda_dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This is the set of conda packages needed when creating
# a development environment for building spt3g / so3g
# using conda compilers and packages to meet dependencies.
#
# For example, assuming you have a conda-forge base environment
# you can do:
#
# conda create -n dev python==3.12
# conda activate dev
# conda install --file conda_dev_requirements.txt
# python3 -m pip install -vv .
#
# Build tools
compilers
cmake
# Compiled dependencies
libopenblas=*=*openmp*
libblas=*=*openblas
openblas=*=*openmp*
boost
libflac
gsl
# Python dependencies
numpy
scipy
astropy
matplotlib
ephem
pytz
pyaml
sqlalchemy
tqdm
# Eventually we should make a conda package for these:
# qpoint
3 changes: 0 additions & 3 deletions docker/so3g-setup.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env bash

np_incl=$(python3 -c 'import numpy as np; print(np.get_include())')

mkdir -p build
cd build
cmake \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE=$(which python3) \
-DPython_NumPy_INCLUDE_DIRS="${np_incl}" \
..
make -j 2
make install
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ def build_cmake(self):
)
raw_incl = out.split()[0]
py_incl = re.sub("-I", "", raw_incl)
# Get the numpy include path from numpy
np_incl = np.get_include()
dlist3g = [
f"-DPython_EXECUTABLE={py_exe}",
f"-DPython_INCLUDE_DIRS={py_incl}",
Expand All @@ -297,8 +295,6 @@ def build_cmake(self):
f"-DPython_LIBRARY_DIRS=''",
f"-DPython_VERSION_MAJOR={py_maj}",
f"-DPython_VERSION_MINOR={py_min}",
f"-DPython_NumPy_INCLUDE_DIRS={np_incl}",
f"-DBoost_PYTHON_TYPE=python{py_maj}{py_min}",
]
if "BOOST_ROOT" in os.environ:
dlist3g.append(f"-DBOOST_ROOT={os.environ['BOOST_ROOT']}")
Expand Down
15 changes: 15 additions & 0 deletions wheels/spt3g_disable_netcdf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff -urN spt3g_software_orig/dfmux/CMakeLists.txt spt3g_software/dfmux/CMakeLists.txt
--- spt3g_software_orig/dfmux/CMakeLists.txt 2025-01-06 11:29:16.606854658 -0800
+++ spt3g_software/dfmux/CMakeLists.txt 2025-01-07 10:15:20.506190895 -0800
@@ -1,5 +1,9 @@
-find_package(NetCDF MODULE)
-find_package(HDF5)
+if(NOT DISABLE_NETCDF)
+ find_package(NetCDF MODULE)
+endif()
+if(NOT DISABLE_HDF5)
+ find_package(HDF5)
+endif()
if (NetCDF_FOUND AND HDF5_FOUND)
set(DFMUX_LIB_EXTRA_SRC src/NetCDFDump.cxx)
else()

0 comments on commit 1b81a92

Please sign in to comment.