Various build fixes. Ensure --enable-pic configure option is set when building the python Extension. Build all libraries before building the Python extension. Fix for non-standard Python installation.
This commit is contained in:
parent
1892b77a46
commit
07e022648b
4 changed files with 32 additions and 16 deletions
15
Makefile
15
Makefile
|
@ -19,6 +19,8 @@ include libfftpack/planck.make
|
||||||
include libsharp/planck.make
|
include libsharp/planck.make
|
||||||
include docsrc/planck.make
|
include docsrc/planck.make
|
||||||
|
|
||||||
|
CYTHON_MODULES=python/libsharp/libsharp.so $(if $(MPI_CFLAGS), python/libsharp/libsharp_mpi.so)
|
||||||
|
|
||||||
$(all_lib): %: | $(LIBDIR)_mkdir
|
$(all_lib): %: | $(LIBDIR)_mkdir
|
||||||
@echo "# creating library $*"
|
@echo "# creating library $*"
|
||||||
$(ARCREATE) $@ $^
|
$(ARCREATE) $@ $^
|
||||||
|
@ -62,10 +64,15 @@ perftest: compile_all
|
||||||
genclean:
|
genclean:
|
||||||
rm libsharp/sharp_legendre.c || exit 0
|
rm libsharp/sharp_legendre.c || exit 0
|
||||||
|
|
||||||
python/libsharp/libsharp.so: python/libsharp/libsharp.pyx $(LIB_libsharp)
|
$(CYTHON_MODULES): %.so: %.pyx
|
||||||
|
ifndef PIC_CFLAGS
|
||||||
|
$(error Python extension must be built using the --enable-pic configure option.)
|
||||||
|
endif
|
||||||
cython $<
|
cython $<
|
||||||
$(CC) -fPIC `python-config --cflags` -I$(INCDIR) -o python/libsharp/libsharp.o -c python/libsharp/libsharp.c
|
$(CC) $(DEBUG_CFLAGS) $(OPENMP_CFLAGS) $(PIC_CFLAGS) `python-config --cflags` -I$(INCDIR) -o $(<:.pyx=.o) -c $(<:.pyx=.c)
|
||||||
$(CL) -shared python/libsharp/libsharp.o -L$(LIBDIR) -lsharp -lfftpack -lc_utils `python-config --libs` -o $@
|
$(CL) -shared $(<:.pyx=.o) $(OPENMP_CFLAGS) $(CYTHON_OBJ) -L$(LIBDIR) -lsharp -lfftpack -lc_utils -L`python-config --prefix`/lib `python-config --ldflags` -o $@
|
||||||
|
|
||||||
pytest: python/libsharp/libsharp.so
|
python: $(all_lib) hdrcopy $(CYTHON_MODULES)
|
||||||
|
|
||||||
|
pytest: python
|
||||||
cd python && nosetests --nocapture libsharp/tests/test_sht.py
|
cd python && nosetests --nocapture libsharp/tests/test_sht.py
|
||||||
|
|
|
@ -5,5 +5,8 @@ CL=@CC@
|
||||||
CCFLAGS_NO_C=@CCFLAGS_NO_C@
|
CCFLAGS_NO_C=@CCFLAGS_NO_C@
|
||||||
CCFLAGS=$(CCFLAGS_NO_C) -c
|
CCFLAGS=$(CCFLAGS_NO_C) -c
|
||||||
CLFLAGS=-L. -L$(LIBDIR) @LDCCFLAGS@ -lm
|
CLFLAGS=-L. -L$(LIBDIR) @LDCCFLAGS@ -lm
|
||||||
|
DEBUG_CFLAGS=@DEBUG_CFLAGS@
|
||||||
|
MPI_CFLAGS=@MPI_CFLAGS@
|
||||||
|
OPENMP_CFLAGS=@OPENMP_CFLAGS@
|
||||||
|
PIC_CFLAGS=@PIC_CFLAGS@
|
||||||
ARCREATE=@ARCREATE@
|
ARCREATE=@ARCREATE@
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
BLDROOT = $(SRCROOT)/build.$(SHARP_TARGET)
|
BLDROOT = $(SRCROOT)/build.$(SHARP_TARGET)
|
||||||
PREFIX = $(SRCROOT)/$(SHARP_TARGET)
|
PREFIX = $(SRCROOT)/$(SHARP_TARGET)
|
||||||
BINDIR = $(PREFIX)/bin
|
BINDIR = $(PREFIX)/bin
|
||||||
INCDIR = $(PREFIX)/include
|
INCDIR = $(PREFIX)/include
|
||||||
LIBDIR = $(PREFIX)/lib
|
LIBDIR = $(PREFIX)/lib
|
||||||
DOCDIR = $(SRCROOT)/doc
|
DOCDIR = $(SRCROOT)/doc
|
||||||
|
PYTHONDIR = $(SRCROOT)/python/libsharp
|
||||||
|
|
||||||
# do not use any suffix rules
|
# do not use any suffix rules
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
@ -26,6 +27,7 @@ $(BLDROOT)/%.o : $(SRCROOT)/%.cc | echo_config
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BLDROOT) $(PREFIX) $(DOCDIR) autom4te.cache/ config.log config.status
|
rm -rf $(BLDROOT) $(PREFIX) $(DOCDIR) autom4te.cache/ config.log config.status
|
||||||
|
rm -rf $(PYTHONDIR)/*.c $(PYTHONDIR)/*.o $(PYTHONDIR)/*.so
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f config/config.auto
|
rm -f config/config.auto
|
||||||
|
|
14
configure.ac
14
configure.ac
|
@ -82,20 +82,20 @@ case $system in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CCFLAGS="$CCFLAGS $OPENMP_CFLAGS"
|
|
||||||
|
|
||||||
if test $ENABLE_DEBUG = yes; then
|
if test $ENABLE_DEBUG = yes; then
|
||||||
CCFLAGS="$CCFLAGS -g"
|
DEBUG_CFLAGS="-g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $ENABLE_PIC = yes; then
|
if test $ENABLE_PIC = yes; then
|
||||||
CCFLAGS="$CCFLAGS -fPIC"
|
PIC_CFLAGS="-fPIC"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $ENABLE_MPI = yes; then
|
if test $ENABLE_MPI = yes; then
|
||||||
CCFLAGS="$CCFLAGS -DUSE_MPI"
|
MPI_CFLAGS="-DUSE_MPI"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CCFLAGS="$CCFLAGS $DEBUG_CFLAGS $OPENMP_CFLAGS $PIC_CFLAGS $MPI_CFLAGS"
|
||||||
|
|
||||||
CCFLAGS_NO_C="$CCFLAGS $CPPFLAGS"
|
CCFLAGS_NO_C="$CCFLAGS $CPPFLAGS"
|
||||||
|
|
||||||
LDCCFLAGS="$LDFLAGS $CCFLAGS"
|
LDCCFLAGS="$LDFLAGS $CCFLAGS"
|
||||||
|
@ -104,6 +104,10 @@ AC_SUBST(SILENT_RULE)
|
||||||
AC_SUBST(CC)
|
AC_SUBST(CC)
|
||||||
AC_SUBST(CCFLAGS_NO_C)
|
AC_SUBST(CCFLAGS_NO_C)
|
||||||
AC_SUBST(LDCCFLAGS)
|
AC_SUBST(LDCCFLAGS)
|
||||||
|
AC_SUBST(DEBUG_CFLAGS)
|
||||||
|
AC_SUBST(MPI_CFLAGS)
|
||||||
|
AC_SUBST(OPENMP_CFLAGS)
|
||||||
|
AC_SUBST(PIC_CFLAGS)
|
||||||
AC_SUBST(ARCREATE)
|
AC_SUBST(ARCREATE)
|
||||||
|
|
||||||
AC_OUTPUT(config/config.auto)
|
AC_OUTPUT(config/config.auto)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue