From c19240e697f2e387284c2bb25592efeb27ab114e Mon Sep 17 00:00:00 2001 From: "David P. Chassin" Date: Sat, 30 Apr 2022 08:39:38 -0700 Subject: [PATCH] Fix build folder (#1154) --- converters/Makefile.mk | 2 +- python/Makefile.mk | 4 ++-- python/setup.py | 6 ++++-- source/Makefile.mk | 10 +++++----- subcommands/Makefile.mk | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/converters/Makefile.mk b/converters/Makefile.mk index f404e368c..157ff1909 100644 --- a/converters/Makefile.mk +++ b/converters/Makefile.mk @@ -2,7 +2,7 @@ # INPUT CONVERTERS # -python_requirements += converters/requirements.txt +python_requirements += $(top_srcdir)/converters/requirements.txt # csv -> glm dist_pkgdata_DATA += converters/csv-ami2glm-ceus.py diff --git a/python/Makefile.mk b/python/Makefile.mk index 08c1658f9..f7d69d73a 100644 --- a/python/Makefile.mk +++ b/python/Makefile.mk @@ -1,10 +1,10 @@ PYTHONVERSION=$(shell python3 $(top_srcdir)/python/setup.py --version) -$(top_srcdir)/python/dist/gridlabd-$(PYTHONVERSION).tar.gz: source/build.h +$(top_srcdir)/python/dist/gridlabd-$(PYTHONVERSION).tar.gz: $(top_srcdir)/source/build.h @echo "building $@" @rm -f $(top_srcdir)/python/dist/gridlabd-*.{whl,tar.gz} @python3 -m pip install build 1>/dev/null - @( export SRCDIR=$(realpath $(top_srcdir)) ; python3 -m build $(top_srcdir)/python 1>/dev/null ) + @( export SRCDIR=$(realpath $(top_srcdir)) ; export BLDDIR=$(shell pwd); python3 -m build $(top_srcdir)/python 1>/dev/null ) python-install: $(top_srcdir)/python/dist/gridlabd-$(PYTHONVERSION).tar.gz @echo "installing $@" diff --git a/python/setup.py b/python/setup.py index 6f7fa640b..0ee79894c 100644 --- a/python/setup.py +++ b/python/setup.py @@ -33,7 +33,9 @@ srcdir = os.path.realpath(sys.argv[0]).replace("/python/setup.py","") else: srcdir = os.path.realpath(srcdir) - +blddir = os.getenv('BLDDIR') +if not blddir: + blddir = os.getcwd() try: from compile_options import * except: @@ -44,7 +46,7 @@ compile_options = None if not compile_options : compile_options=['-Wall','-O3','-g'] -compile_options.extend(['-I%s/source'%srcdir,'-Isource','-Isource/rt',"-fPIC","-DHAVE_CONFIG_H","-DHAVE_PYTHON"]) +compile_options.extend(['-I%s/source'%srcdir,'-I%s/python'%srcdir,'-I%s/runtime'%srcdir,'-I%s/source'%blddir,"-fPIC","-DHAVE_CONFIG_H","-DHAVE_PYTHON"]) from distutils.core import setup, Extension gridlabd = Extension('gridlabd', diff --git a/source/Makefile.mk b/source/Makefile.mk index c708b60bd..e0a6fa351 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -90,12 +90,12 @@ gridlabd_bin_LDADD += -ldl -lcurl bin_SCRIPTS += source/gridlabd -gridlabd_bin_SOURCES += source/build.h -BUILT_SOURCES += source/build.h -CLEANFILES += source/build.h origin.txt +gridlabd_bin_SOURCES += $(top_srcdir)/source/build.h +BUILT_SOURCES += $(top_srcdir)/source/build.h +CLEANFILES += $(top_srcdir)/source/build.h origin.txt pkginclude_HEADERS = -pkginclude_HEADERS += source/build.h +pkginclude_HEADERS += $(top_srcdir)/source/build.h pkginclude_HEADERS += source/class.h pkginclude_HEADERS += source/complex.h pkginclude_HEADERS += source/debug.h @@ -117,7 +117,7 @@ gridlabd_DATA = origin.txt # @autom4te -l m4sh $< > $@ # @echo "$@ updated, please run 'make reconfigure && make TARGET' again" && false -source/build.h: buildnum +$(top_srcdir)/source/build.h: buildnum buildnum: utilities/build_number @/bin/bash -c "$(top_srcdir)/utilities/build_number" diff --git a/subcommands/Makefile.mk b/subcommands/Makefile.mk index e3a409e5c..50953d3b9 100644 --- a/subcommands/Makefile.mk +++ b/subcommands/Makefile.mk @@ -26,4 +26,4 @@ bin_SCRIPTS += subcommands/gridlabd-validate bin_SCRIPTS += subcommands/gridlabd-version bin_SCRIPTS += subcommands/gridlabd-weather -python_requirements += subcommands/requirements.txt +python_requirements += $(top_srcdir)/subcommands/requirements.txt