Skip to content
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
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
string(CONCAT CMAKE_Fortran_FLAGS
"-g -O3"
" -fno-align-commons -fdefault-real-8 -fdefault-double-8"
" -ffixed-line-length-none -O -w -fd-lines-as-comments")
" -ffixed-line-length-none -O -w -fd-lines-as-comments"
" -fallow-argument-mismatch")
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel")
string(CONCAT CMAKE_Fortran_FLAGS
"-g -O3"
Expand Down Expand Up @@ -71,6 +72,12 @@ include_directories(src/graphics)
include_directories(${PYTHON_INCLUDE_DIRS})
set(LIBS "${LIBS};${PYTHON_LIBRARIES}")

if(DEFINED PYTHON_NUMPY_INCLUDE_DIR)
include_directories(${PYTHON_NUMPY_INCLUDE_DIR})
else()
message(WARNING "PYTHON_NUMPY_INCLUDE_DIR not set, this may fail if numpy has been installed locally, using pip for example")
endif()

add_definitions(-DWITH_CMAKE)
add_definitions(-DVERSION="${PROJECT_VERSION}")
add_definitions(-DESTER_DATADIR="${CMAKE_INSTALL_PREFIX}/share")
Expand Down
12 changes: 12 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
pkgs ?
import (
builtins.fetchTarball {
name = "nixos-gcc13";
url = "https://github.com/nixos/nixpkgs/archive/e24b4c09e963677b1beea49d411cd315a024ad3a.tar.gz";
sha256 = "1m383nldy1jvl8n2jw02l26w9iib4b2a9341c1kf74miaahw7qx6";
}
)
{},
}:
pkgs.callPackage ./package.nix {}
79 changes: 79 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
lib,
stdenv,
cmake,
pkg-config,
swig,
binutils,
which,
gfortran,
blas,
glibc,
lapack,
hdf5-cpp,
python3,
llvmPackages,
makeBinaryWrapper,
}: let
pythonWithPackages = python3.withPackages (p: [p.numpy p.matplotlib p.tkinter]);
pythonPath = "$out/lib/python:${pythonWithPackages}/${pythonWithPackages.sitePackages}";
pythonExecutable = "${pythonWithPackages}/bin/${pythonWithPackages.executable}";
in
stdenv.mkDerivation {
pname = "ester";
version = "0";

src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.gitTracked ./.;
};

cmakeFlags = [
"-DPYTHON_SITE=lib/python"
#"-DCBLAS_LIBRARIES=cblas"
];
preConfigure = ''
numpy_include=$(${pythonExecutable} -c "import numpy; print(numpy.get_include())")
cmakeFlagsArray+=("-DPYTHON_NUMPY_INCLUDE_DIR=$numpy_include")
'';

dontStrip = stdenv.isDarwin;

nativeBuildInputs = [
cmake
pkg-config
swig
binutils
which
gfortran
makeBinaryWrapper
glibc.debug
];

buildInputs =
[
blas
lapack
hdf5-cpp.dev
pythonWithPackages
]
++ lib.optional stdenv.cc.isClang llvmPackages.openmp;

#postPatch = ''
# substituteInPlace python/CMakeLists.txt --replace 'execute_process(' 'set(PYTHON_SITE "$out/lib/python")\n# execute_process('
#'';

postInstall =
/*
bash
*/
''
for prog in ester_info gen_output star1d star2d star_evol version; do
wrapProgram "$out/bin/$prog" \
--set NIX_PYTHONPREFIX "${python3}" \
--set NIX_PYTHONEXECUTABLE ${pythonExecutable} \
--set NIX_PYTHONPATH ${pythonPath} \
--set PYTHONNOUSERSITE "true"
done
'';
}
1 change: 1 addition & 0 deletions src/utils/stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "stack.h"

#include <stdlib.h>
#include <cstdint>
#include <string>
#include <iostream>
#include <sstream>
Expand Down