Skip to content

Commit

Permalink
Simplfied linux build tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Kraft committed Aug 30, 2021
1 parent 7836736 commit 566bbbc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 28 deletions.
4 changes: 2 additions & 2 deletions cmf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from .timetools import StopWatch, datetime_to_cmf, timerange


__version__ = '2.0.0b5.cmf2'
__compiletime__ = 'Fri Jan 15 16:05:41 2021'
__version__ = '2.0.0b5'
__compiletime__ = 'Mon Aug 30 17:45:30 2021'

from .cmf_core import connect_cells_with_flux as __ccwf

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
numpy>=1.14
wheel
scipy>=1.0
cmake>=3.13.0
# shapely>=1.5.0
12 changes: 9 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
from setuptools.command.build_ext import build_ext
from distutils.sysconfig import customize_compiler
from distutils.command.build_py import build_py

import logging
logging.basicConfig(level=logging.DEBUG)
version = '2.0.0b5'

branchversion = version
Expand Down Expand Up @@ -61,7 +62,7 @@ def __init__(self, includepath, libpath, *libs, build_script=None, build_always=
self.build_script_name = build_script
self.build_always = build_always

def __str__(self):
def __repr__(self):
return self.libs[0] + ' - library'

def as_win32(self):
Expand Down Expand Up @@ -113,6 +114,7 @@ def extend(self, include_dirs, library_dirs, libraries, extra_objects):

def build(self):
import subprocess as sp
logging.debug(f'StaticLibrary.build({self})')
cwd = os.path.dirname(__file__)
if os.name == 'nt':
script_ext = '.bat'
Expand Down Expand Up @@ -194,6 +196,7 @@ def add_numpy_include(self):
ext.include_dirs += [get_numpy_include()]

def build_libraries(self):
logging.debug('build_libraries()' + str(static_libraries))
for sl in static_libraries:
if not sl.exists():
print(sl, 'get downloaded and installed')
Expand All @@ -215,6 +218,7 @@ def build_libraries(self):


def build_extensions(self):
logging.debug('build_extensions()')
customize_compiler(self.compiler)

try:
Expand Down Expand Up @@ -250,6 +254,8 @@ def updateversion():
cmf/__init__.py: set __version__ constant
Doxyfile: set PROJECT_NUMBER
"""
logging.debug('updateversion()')

try:
module_code = open('cmf/__init__.py').readlines()
except IOError:
Expand Down Expand Up @@ -338,7 +344,7 @@ def make_cmf_core():
- include dirs
- extra compiler flags
"""

logging.debug('make_cmf_core()')
# Include numpy
include_dirs = []
library_dirs = []
Expand Down
14 changes: 4 additions & 10 deletions tools/install_cmf_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,13 @@ export CXXFLAGS="-fPIC"

CWD=$PWD
TOOLDIR=$(dirname $0)
TOOLDIR=$(python3 $TOOLDIR/abspath.py $TOOLDIR)
echo "tools: "$TOOLDIR
CMFDIR=$(python3 $TOOLDIR/abspath.py $TOOLDIR/..)
echo "home: "$CMFDIR

CMFDIR=$TOOLDIR/..

BUILDDIR=$CMFDIR/build/cmf_core
echo "CMF build directory: "$BUILDDIR
CMF_CORE_SRC=$CMFDIR/cmf/cmf_core_src
echo "CMF core source directory: "$CMF_CORE_SRC
mkdir -p $BUILDDIR
cd $BUILDDIR
cmake $CMF_CORE_SRC -DCMAKE_BUILD_TYPE=Release
make $MAKE_OPTIONS
make install
cmake -S $CMF_CORE_SRC -B $BUILDDIR -DCMAKE_BUILD_TYPE=Release
make -C $BUILDDIR
make install -C $BUILDDIR
cd $CWD
18 changes: 5 additions & 13 deletions tools/install_solvers.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
#!/usr/bin/env bash
export CLAGS="-fPIC"
export CXXFLAGS="-fPIC"

CWD=$PWD
TOOLDIR=$(dirname $0)
TOOLDIR=$(python3 $TOOLDIR/abspath.py $TOOLDIR)
echo "TOOLDIR="$TOOLDIR
CMFDIR=$(python3 $TOOLDIR/abspath.py $TOOLDIR/..)
echo "CMFDIR="$CMFDIR
export CFLAGS="-fPIC"
export CXXFLAGS="-fPIC"

BUILDDIR=$CMFDIR/build/extern
BUILDDIR=$TOOLDIR/../build/extern
echo "BUILDDIR="$BUILDDIR

mkdir -p $BUILDDIR
cd $BUILDDIR
cmake ${TOOLDIR} -DCMAKE_BUILD_TYPE=Release
make $MAKE_OPTIONS

cd $CWD
cmake -S ${TOOLDIR} -B ${BUILDDIR} -DCMAKE_BUILD_TYPE=Release
make -C ${BUILDDIR}

0 comments on commit 566bbbc

Please sign in to comment.