[SCons] Remove Makefile generation for samples

This commit is contained in:
Ray Speth 2023-06-17 11:47:35 -04:00 committed by Ray Speth
parent 2eccea007c
commit 5c789d4d5a
10 changed files with 2 additions and 296 deletions

View File

@ -1,102 +0,0 @@
###############################################################################
# Include Snippet for Makefiles
#
# To create Cantera C++ applications from the install environment
# include this file into your Makefile environment by putting
# the line "include Cantera.mak" in your Makefile.
#
# Main Variables:
#
# CANTERA_INCLUDES = Variable containing the include path
# CANTERA_LIBS = List of libraries to include on the link line
#
# CANTERA_FORTRAN_LIBS = list of libraries to link for Fortran programs
# CANTERA_FORTRAN_MODS = Directory containing the F90 .mod files
#
CANTERA_VERSION=@cantera_version@
###############################################################################
# CANTERA CORE
###############################################################################
# The directory where Cantera include files may be found.
#
# Include files in application programs should start with:
# #include "cantera/core.h"
# #include "cantera/onedim.h"
CANTERA_INSTALL_ROOT=@ct_installroot@
CANTERA_CORE_INCLUDES=-I$(CANTERA_INSTALL_ROOT)/include
CANTERA_EXTRA_INCLUDES=@mak_extra_includes@
# Required Cantera libraries
CANTERA_CORE_LIBS=@mak_threadflags@ -L@ct_libdir@ @mak_corelibs@ -Wl,-rpath,@ct_libdir@
CANTERA_CORE_LIBS_DEP = @ct_libdir@/libcantera.a
CANTERA_EXTRA_LIBDIRS=@mak_extra_libdirs@
CANTERA_CORE_FTN=-L@ct_libdir@ -lcantera_fortran @mak_corelibs@
CANTERA_FORTRAN_MODS=$(CANTERA_INSTALL_ROOT)/include/cantera
CANTERA_FORTRAN_SYSLIBS=@mak_fort_threadflags@ @mak_stdlib@
###############################################################################
# BOOST
###############################################################################
CANTERA_BOOST_INCLUDES=@mak_boost_include@
###############################################################################
# CVODE/SUNDIALS LINKAGE
###############################################################################
CANTERA_SUNDIALS_INCLUDE=@mak_sundials_include@
CANTERA_SUNDIALS_LIBS=@mak_sundials_libdir@ @mak_sundials_libs@
###############################################################################
# BLAS LAPACK LINKAGE
###############################################################################
CANTERA_BLAS_LAPACK_LIBS=@mak_blas_lapack_libs@
###############################################################################
# HDF5 SUPPORT
###############################################################################
CANTERA_HDF5_INCLUDES=@mak_hdf_include@
CANTERA_HDF5_LIBS=@mak_hdf_libs@
###############################################################################
# COMBINATIONS OF INCLUDES AND LIBS
###############################################################################
CANTERA_INCLUDES=$(CANTERA_CORE_INCLUDES) $(CANTERA_SUNDIALS_INCLUDE) \
$(CANTERA_BOOST_INCLUDES) $(CANTERA_HDF5_INCLUDES) \
$(CANTERA_EXTRA_INCLUDES)
CANTERA_TOTAL_INCLUDES = $(CANTERA_INCLUDES)
# Add this into the compilation environment to identify the version number
CANTERA_DEFINES = -DCANTERA_VERSION=@cantera_version@
CANTERA_LIBS=$(CANTERA_CORE_LIBS) \
$(CANTERA_EXTRA_LIBDIRS) $(CANTERA_SUNDIALS_LIBS) \
$(CANTERA_BLAS_LAPACK_LIBS) $(CANTERA_HDF5_LIBS)
CANTERA_TOTAL_LIBS=$(CANTERA_LIBS)
CANTERA_TOTAL_LIBS_DEP= $(CANTERA_CORE_LIBS_DEP)
CANTERA_FORTRAN_LIBS=$(CANTERA_CORE_FTN) \
$(CANTERA_EXTRA_LIBDIRS) $(CANTERA_SUNDIALS_LIBS) \
$(CANTERA_BLAS_LAPACK_LIBS) $(CANTERA_FORTRAN_SYSLIBS) \
$(CANTERA_HDF5_LIBS)
###############################################################################
# END
###############################################################################

View File

@ -11,7 +11,6 @@ if env['INSTALL_MANPAGES']:
### Generate customized scripts ###
# Cantera.mak include file for Makefile projects
# cantera.pc for use with pkg-config
pc_libs = list(localenv['cantera_libs'])
@ -19,72 +18,30 @@ pc_libdirs = []
pc_incdirs = []
pc_cflags = list(localenv['CXXFLAGS'])
localenv["mak_corelibs"] = " ".join(f"-l{lib}" for lib in localenv["cantera_libs"])
if localenv["package_build"]:
# folders outside of conda environment are not transferable
localenv["mak_extra_includes"] = ""
localenv["mak_extra_libdirs"] = ""
else:
localenv["mak_extra_includes"] = " ".join(
f"-I{dir}" for dir in localenv["extra_inc_dirs"])
if not localenv["package_build"]:
pc_incdirs.extend(localenv["extra_inc_dirs"])
localenv["mak_extra_libdirs"] = " ".join(
f"-L{dir} -Wl,-rpath,{dir}" for dir in localenv["extra_lib_dirs"])
pc_libdirs.extend(localenv["extra_lib_dirs"])
localenv["mak_stdlib"] = " ".join(f"-l{lib}" for lib in env["cxx_stdlib"])
if localenv['system_sundials']:
# Add links to the sundials environment
localenv["mak_sundials_libs"] = " ".join(
f"-l{lib}" for lib in localenv["sundials_libs"])
if localenv["sundials_libdir"] and not localenv["package_build"]:
localenv["mak_sundials_libdir"] = f"-L{localenv['sundials_libdir']}"
pc_libdirs.append(localenv['sundials_libdir'])
else:
localenv['mak_sundials_libdir'] = ''
if localenv["sundials_include"] and not localenv["package_build"]:
localenv["mak_sundials_include"] = f"-I{localenv['sundials_include']}"
pc_incdirs.append(localenv['sundials_include'])
else:
localenv['mak_sundials_include'] = ''
if localenv["boost_inc_dir"] and not localenv["package_build"]:
localenv["mak_boost_include"] = f"-I{localenv['boost_inc_dir']}"
pc_incdirs.append(localenv['boost_inc_dir'])
else:
localenv['mak_boost_include'] = ''
if localenv["use_hdf5"] and not localenv["package_build"]:
localenv["mak_hdf_include"] = f"-I{localenv['hdf_include']}"
pc_incdirs.append(localenv["hdf_include"])
localenv["mak_hdf_libs"] = f"-L{localenv['hdf_libdir']} -lhdf5"
else:
localenv["mak_hdf_include"] = ""
localenv["mak_hdf_libs"] = "-lhdf5"
# Handle BLAS/LAPACK linkage
blas_lapack_libs = " ".join(f"-l{lib}" for lib in localenv["blas_lapack_libs"])
if localenv["blas_lapack_dir"] and not localenv["package_build"]:
localenv["mak_blas_lapack_libs"] = (
f"-L{localenv['blas_lapack_dir']} {blas_lapack_libs}")
else:
localenv['mak_blas_lapack_libs'] = blas_lapack_libs
if 'Accelerate' in localenv['FRAMEWORKS']:
localenv['mak_blas_lapack_libs'] += ' -framework Accelerate'
pc_cflags.append('-framework Accelerate')
localenv['mak_threadflags'] = localenv['thread_flags']
if '-pthread' in localenv['thread_flags']:
localenv['mak_fort_threadflags'] = '-lpthread'
pc_cflags.append('-pthread')
pc_libs.append('pthread')
else:
localenv['mak_fort_threadflags'] = ''
if localenv["package_build"]:
# Remove sysroot flags in templated output files. This only applies to the
@ -96,9 +53,6 @@ if localenv["package_build"]:
localenv["CCFLAGS"] = compiler_flag_list(localenv["CCFLAGS"], excludes)
localenv["CXXFLAGS"] = compiler_flag_list(localenv["CXXFLAGS"], excludes)
mak = build(localenv.SubstFile('Cantera.mak', 'Cantera.mak.in'))
install('$inst_incdir', mak)
# Generate cantera.pc for use with pkg-config
localenv["pc_prefix"] = localenv["prefix"]
localenv["pc_libdirs"] = " ".join(f"-L{dir}" for dir in pc_libdirs)

View File

@ -1,19 +0,0 @@
include @make_Cantera_dot_mak@
CC=@CC@
RM=rm -f
CFLAGS=@mak_compiler_flags@
CPPFLAGS=$(CANTERA_INCLUDES)
LDFLAGS=
LDLIBS=$(CANTERA_LIBS)
SRCS=@tmpl_sourcename@
OBJS=$(subst .cpp,.o,$(SRCS))
all: @tmpl_progname@
clean:
$(RM) $(OBJS) @tmpl_progname@
dist-clean: clean
$(RM) *~

View File

@ -49,18 +49,3 @@ for programName, sources in samples:
localenv['cmake_cantera_libdirs'] = ' '.join(quoted(x) for x in libdirs if x)
cmakelists = localenv.SubstFile('CMakeLists.txt', 'CMakeLists.txt.in')
install("$inst_sampledir/clib", cmakelists)
if localenv["OS"] != "Windows":
# Generate Makefile to be installed
mak_path = pjoin(localenv["ct_incroot"], "cantera", "Cantera.mak")
localenv["mak_compiler_flags"] = " ".join(cc_flags)
if " " in mak_path:
# There is no reasonable way to handle spaces in Makefile 'include'
# statement, so we fall back to using the relative path instead
mak_path = relpath(mak_path, pjoin(localenv["ct_sampledir"], "clib"))
localenv["make_Cantera_dot_mak"] = mak_path
localenv["make_target"] = programName
localenv["make_sourcefile"] = programName + ".c"
makefile = localenv.SubstFile("Makefile", "Makefile.in")
install("$inst_sampledir/clib", makefile)

View File

@ -1,20 +0,0 @@
include @make_Cantera_dot_mak@
CC=@CC@
CXX=@CXX@
RM=rm -f
CXXFLAGS=@mak_compiler_flags@
CPPFLAGS=$(CANTERA_INCLUDES)
LDFLAGS=
LDLIBS=$(CANTERA_LIBS)
SRCS=@tmpl_sourcename@
OBJS=$(subst .cpp,.o,$(SRCS))
all: @tmpl_progname@
clean:
$(RM) $(OBJS) @tmpl_progname@
dist-clean: clean
$(RM) *~

View File

@ -49,7 +49,7 @@ set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS})
buildSample(localenv.Program, pjoin(subdir, name),
multi_glob(localenv, subdir, *extensions))
# Note: These Makefiles and SConstruct files are automatically installed
# Note: These CMakeLists.txt and SConstruct files are automatically installed
# by the "RecursiveInstall" that grabs everything in the cxx directory.
incdirs = [localenv["ct_incroot"]]
@ -118,16 +118,3 @@ set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS})
## Generate CMakeList.txt files to be installed
cmakelists = localenv.SubstFile(pjoin(subdir, 'CMakeLists.txt'), 'CMakeLists.txt.in')
install(pjoin('$inst_sampledir', 'cxx', subdir), cmakelists)
if localenv["OS"] != "Windows":
## Generate Makefiles to be installed
mak_path = pjoin(localenv["ct_incroot"], "cantera", "Cantera.mak")
localenv["mak_compiler_flags"] = " ".join(cc_flags)
if " " in mak_path:
# There is no reasonable way to handle spaces in Makefile 'include'
# statement, so we fall back to using the relative path instead
mak_path = os.path.relpath(mak_path, pjoin(localenv["ct_sampledir"], "cxx", subdir))
localenv["make_Cantera_dot_mak"] = mak_path
makefile = build(localenv.SubstFile(pjoin(subdir, "Makefile"), "Makefile.in"))
install(pjoin("$inst_sampledir", "cxx", subdir), makefile)

View File

@ -1,22 +0,0 @@
include @make_Cantera_dot_mak@
FC=@F77@
RM=rm -f
FFLAGS=-g
LDFLAGS=
LDLIBS=$(CANTERA_FORTRAN_LIBS)
CXXFLAGS=@mak_compiler_flags@
CPPFLAGS=$(CANTERA_INCLUDES)
OBJS=isentropic.o demo_ftnlib.o
all: isentropic
isentropic: $(OBJS)
$(FC) $(LDFLAGS) -o isentropic $(OBJS) $(LDLIBS) $(CANTERA_LIBS)
clean:
$(RM) $(OBJS)
dist-clean: clean
$(RM) *~

View File

@ -4,8 +4,6 @@ from buildutils import *
Import('env', 'install', 'buildSample')
localenv = env.Clone()
localenv['mak_stdlib'] = ['-l' + lib for lib in env['cxx_stdlib']]
# (program name, [source files])
samples = [("ctlib", ["ctlib.f"]),
("demo", ["demo.f"]),
@ -71,19 +69,5 @@ if localenv["package_build"]:
localenv["F77"] = "gfortran"
localenv["CC"] = "gcc"
localenv["mak_compiler_flags"] = " ".join(cc_flags)
sconstruct = localenv.SubstFile('SConstruct', 'SConstruct.in')
install("$inst_sampledir/f77", sconstruct)
if localenv["OS"] != "Windows":
# Generate Makefile to be installed
mak_path = pjoin(localenv["ct_incroot"], "cantera", "Cantera.mak")
if " " in mak_path:
# There is no reasonable way to handle spaces in Makefile 'include'
# statement, so we fall back to using the relative path instead
mak_path = relpath(mak_path, pjoin(localenv["ct_sampledir"], "f77"))
localenv["make_Cantera_dot_mak"] = mak_path
makefile = localenv.SubstFile("Makefile", "Makefile.in")
install("$inst_sampledir/f77", makefile)

View File

@ -1,25 +0,0 @@
include @make_Cantera_dot_mak@
F90=@F90@
RM=rm -f
F90FLAGS=-g
F90MODDIR=$(CANTERA_FORTRAN_MODS)
LDFLAGS=
LDLIBS=$(CANTERA_FORTRAN_LIBS)
SRCS=@make_sourcefile@
OBJS=$(subst .f90,.o,$(SRCS))
all: @make_target@
@make_target@: $(OBJS)
$(F90) $(LDFLAGS) -o @make_target@ $(OBJS) $(LDLIBS) $(CANTERA_LIBS)
%.o : %.f90
$(F90) -c $< @FORTRANMODDIRPREFIX@$(F90MODDIR) $(F90FLAGS)
clean:
$(RM) $(OBJS)
dist-clean: clean
$(RM) *~

View File

@ -4,8 +4,6 @@ from buildutils import *
Import('env', 'install', 'buildSample')
localenv = env.Clone()
localenv['mak_stdlib'] = ['-l' + lib for lib in env['cxx_stdlib']]
# (program name, [source files])
samples = [('demo', ['demo.f90'])]
@ -51,17 +49,3 @@ for programName, sources in samples:
localenv['cmake_cantera_libdirs'] = ' '.join(quoted(x) for x in libdirs if x)
cmakelists = localenv.SubstFile('CMakeLists.txt', 'CMakeLists.txt.in')
install("$inst_sampledir/f90", cmakelists)
if localenv["OS"] != "Windows":
# Generate Makefile to be installed
mak_path = pjoin(localenv["ct_incroot"], "cantera", "Cantera.mak")
if " " in mak_path:
# There is no reasonable way to handle spaces in Makefile 'include'
# statement, so we fall back to using the relative path instead
mak_path = relpath(mak_path, pjoin(localenv["ct_sampledir"], "f90"))
localenv["make_Cantera_dot_mak"] = mak_path
localenv["make_target"] = programName
localenv["make_sourcefile"] = programName + ".f90"
makefile = localenv.SubstFile("Makefile", "Makefile.in")
install("$inst_sampledir/f90", makefile)