diff --git a/tpls/tpl_tools/packages/arpack-ng.py b/tpls/tpl_tools/packages/arpack-ng.py index ebc9c91d..7793d15c 100644 --- a/tpls/tpl_tools/packages/arpack-ng.py +++ b/tpls/tpl_tools/packages/arpack-ng.py @@ -25,10 +25,12 @@ def configure_options(self, builder): builder.add_option("-DBUILD_SHARED_LIBS:BOOL=ON") else: builder.add_option("-DBUILD_SHARED_LIBS:BOOL=OFF") + builder.add_option("-DBLAS_LIBRARIES=" + builder.env["BLAS_LIBRARIES"]) + builder.add_option("-DLAPACK_LIBRARIES=" + builder.env["LAPACK_LIBRARIES"]) builder.add_option("-DMPI=ON") def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("ARPACK_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/bison.py b/tpls/tpl_tools/packages/bison.py index 8ce95a12..a3d56984 100644 --- a/tpls/tpl_tools/packages/bison.py +++ b/tpls/tpl_tools/packages/bison.py @@ -16,8 +16,8 @@ def setDependencies(self, builder): def register(self, builder): registry = builder._registry - registry.append_environment_variable("BISON_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) - registry.append_environment_variable( + registry.prepend_environment_variable("BISON_DIR", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable( "PATH", os.path.join(builder.install_dir(), "bin") ) diff --git a/tpls/tpl_tools/packages/catch2.py b/tpls/tpl_tools/packages/catch2.py index 83283f3f..ab60ed5e 100644 --- a/tpls/tpl_tools/packages/catch2.py +++ b/tpls/tpl_tools/packages/catch2.py @@ -26,4 +26,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("CATCH2_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/cmake.py b/tpls/tpl_tools/packages/cmake.py index d39f5a66..d95eeeee 100644 --- a/tpls/tpl_tools/packages/cmake.py +++ b/tpls/tpl_tools/packages/cmake.py @@ -30,6 +30,6 @@ def register(self, builder): registry.register_executable( os.path.join(builder.install_dir(), "bin", "cmake") ) - registry.append_environment_variable( + registry.prepend_environment_variable( "PATH", os.path.join(builder.install_dir(), "bin") ) diff --git a/tpls/tpl_tools/packages/flex.py b/tpls/tpl_tools/packages/flex.py index 36ac26de..c8d35573 100644 --- a/tpls/tpl_tools/packages/flex.py +++ b/tpls/tpl_tools/packages/flex.py @@ -22,8 +22,8 @@ def setDependencies(self, builder): def register(self, builder): registry = builder._registry - registry.append_environment_variable("FLEX_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) - registry.append_environment_variable( + registry.prepend_environment_variable("FLEX_DIR", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable( "PATH", os.path.join(builder.install_dir(), "bin") ) diff --git a/tpls/tpl_tools/packages/fmt.py b/tpls/tpl_tools/packages/fmt.py index 75edc4e6..7fb46c01 100644 --- a/tpls/tpl_tools/packages/fmt.py +++ b/tpls/tpl_tools/packages/fmt.py @@ -35,4 +35,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("FMT_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/hdf5.py b/tpls/tpl_tools/packages/hdf5.py index 19d5527a..38cac40f 100644 --- a/tpls/tpl_tools/packages/hdf5.py +++ b/tpls/tpl_tools/packages/hdf5.py @@ -37,7 +37,7 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("HDF5_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) - registry.append_environment_variable( + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable( "PATH", os.path.join(builder.install_dir(), "bin") ) diff --git a/tpls/tpl_tools/packages/lapack.py b/tpls/tpl_tools/packages/lapack.py index 47e9e87d..b00456b4 100644 --- a/tpls/tpl_tools/packages/lapack.py +++ b/tpls/tpl_tools/packages/lapack.py @@ -38,4 +38,4 @@ def register(self, builder): "LAPACK_LIBRARIES", os.path.join(builder.install_dir(), "lib/liblapack" + ext), ) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/metis.py b/tpls/tpl_tools/packages/metis.py index fdea4544..514b4f79 100644 --- a/tpls/tpl_tools/packages/metis.py +++ b/tpls/tpl_tools/packages/metis.py @@ -26,4 +26,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("METIS_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/mumps.py b/tpls/tpl_tools/packages/mumps.py index 97f0cf74..207d6167 100644 --- a/tpls/tpl_tools/packages/mumps.py +++ b/tpls/tpl_tools/packages/mumps.py @@ -122,4 +122,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("MUMPS_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/netcdf.py b/tpls/tpl_tools/packages/netcdf.py index 109a3f69..da645516 100644 --- a/tpls/tpl_tools/packages/netcdf.py +++ b/tpls/tpl_tools/packages/netcdf.py @@ -46,7 +46,7 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("NETCDF_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) - registry.append_environment_variable( + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable( "PATH", os.path.join(builder.install_dir(), "bin") ) diff --git a/tpls/tpl_tools/packages/omega_h.py b/tpls/tpl_tools/packages/omega_h.py index d9b2bf5f..42dfcfad 100644 --- a/tpls/tpl_tools/packages/omega_h.py +++ b/tpls/tpl_tools/packages/omega_h.py @@ -44,4 +44,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("OMEGA_H_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/openblas.py b/tpls/tpl_tools/packages/openblas.py index 0986f20a..ab11db4b 100644 --- a/tpls/tpl_tools/packages/openblas.py +++ b/tpls/tpl_tools/packages/openblas.py @@ -52,4 +52,4 @@ def register(self, builder): "LAPACK_LIBRARIES", os.path.join(builder.install_dir(), "lib/libopenblas" + ext), ) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/openmpi.py b/tpls/tpl_tools/packages/openmpi.py index ffa82c66..a8f67749 100644 --- a/tpls/tpl_tools/packages/openmpi.py +++ b/tpls/tpl_tools/packages/openmpi.py @@ -45,7 +45,7 @@ def register(self, builder): "MPI_Fortran_COMPILER", os.path.join(builder.install_dir(), "bin", "mpifort"), ) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) - registry.append_environment_variable( + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable( "PATH", os.path.join(builder.install_dir(), "bin") ) diff --git a/tpls/tpl_tools/packages/parmetis.py b/tpls/tpl_tools/packages/parmetis.py index e11e9f3f..6b514444 100644 --- a/tpls/tpl_tools/packages/parmetis.py +++ b/tpls/tpl_tools/packages/parmetis.py @@ -35,4 +35,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("PARMETIS_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/petsc.py b/tpls/tpl_tools/packages/petsc.py index 987c8ad0..1a10ef5e 100644 --- a/tpls/tpl_tools/packages/petsc.py +++ b/tpls/tpl_tools/packages/petsc.py @@ -73,4 +73,4 @@ def register(self, builder): registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("PETSC_DIR", builder.install_dir()) registry.set_environment_variable("PETSC_ARCH", "") - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) \ No newline at end of file + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/pnetcdf.py b/tpls/tpl_tools/packages/pnetcdf.py index 16c2d3e9..9ccc679c 100644 --- a/tpls/tpl_tools/packages/pnetcdf.py +++ b/tpls/tpl_tools/packages/pnetcdf.py @@ -32,4 +32,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("PNETCDF_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/scalapack.py b/tpls/tpl_tools/packages/scalapack.py index b8f3924a..6eac1a44 100644 --- a/tpls/tpl_tools/packages/scalapack.py +++ b/tpls/tpl_tools/packages/scalapack.py @@ -25,10 +25,12 @@ def configure_options(self, builder): builder.add_option("-DBUILD_SHARED_LIBS:BOOL=ON") else: builder.add_option("-DBUILD_SHARED_LIBS:BOOL=OFF") + builder.add_option("-DBLAS_LIBRARIES=" + builder.env["BLAS_LIBRARIES"]) + builder.add_option("-DLAPACK_LIBRARIES=" + builder.env["LAPACK_LIBRARIES"]) builder.add_option("-DSCALAPACK_BUILD_TESTS=OFF") def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("SCALAPACK_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/scotch.py b/tpls/tpl_tools/packages/scotch.py index 97656013..b4b97147 100644 --- a/tpls/tpl_tools/packages/scotch.py +++ b/tpls/tpl_tools/packages/scotch.py @@ -60,4 +60,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("SCOTCH_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/seacas.py b/tpls/tpl_tools/packages/seacas.py index 9358bac4..801f997d 100644 --- a/tpls/tpl_tools/packages/seacas.py +++ b/tpls/tpl_tools/packages/seacas.py @@ -65,11 +65,11 @@ def register(self, builder): registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("ACCESS", builder.install_dir()) registry.set_environment_variable("SEACAS_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) - registry.append_environment_variable( + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable( "PATH", os.path.join(builder.install_dir(), "bin") ) if builder.build_shared: - registry.append_environment_variable( + registry.prepend_environment_variable( "PYTHONPATH", os.path.join(builder.install_dir(), "lib") ) diff --git a/tpls/tpl_tools/packages/sparse.py b/tpls/tpl_tools/packages/sparse.py index b7325d79..d7f91c61 100644 --- a/tpls/tpl_tools/packages/sparse.py +++ b/tpls/tpl_tools/packages/sparse.py @@ -85,4 +85,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("SPARSE_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/suitesparse.py b/tpls/tpl_tools/packages/suitesparse.py index e206f619..7cd26323 100644 --- a/tpls/tpl_tools/packages/suitesparse.py +++ b/tpls/tpl_tools/packages/suitesparse.py @@ -37,4 +37,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("SUITESPARSE_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/superlu_dist.py b/tpls/tpl_tools/packages/superlu_dist.py index a0bd7577..1237c3f2 100644 --- a/tpls/tpl_tools/packages/superlu_dist.py +++ b/tpls/tpl_tools/packages/superlu_dist.py @@ -79,4 +79,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("SUPERLU_DIST_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/packages/trilinos.py b/tpls/tpl_tools/packages/trilinos.py index d4653bd5..3ffe3207 100644 --- a/tpls/tpl_tools/packages/trilinos.py +++ b/tpls/tpl_tools/packages/trilinos.py @@ -186,4 +186,4 @@ def register(self, builder): registry = builder._registry registry.register_package(self.name, builder.install_dir()) registry.set_environment_variable("TRILINOS_DIR", builder.install_dir()) - registry.append_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) + registry.prepend_environment_variable("CMAKE_PREFIX_PATH", builder.install_dir()) diff --git a/tpls/tpl_tools/registry.py b/tpls/tpl_tools/registry.py index 715d9f6f..d8430d84 100644 --- a/tpls/tpl_tools/registry.py +++ b/tpls/tpl_tools/registry.py @@ -15,12 +15,12 @@ def __init__(self): def set_environment_variable(self, variable, value): self.environment[variable] = value - def append_environment_variable(self, variable, value): + def prepend_environment_variable(self, variable, value): if variable in self.environment.keys(): if type(self.environment[variable]) != list: oldval = self.environment[variable] self.environment[variable] = [oldval] - self.environment[variable].append(value) + self.environment[variable].insert(0,value) else: self.environment[variable] = value @@ -114,9 +114,9 @@ def set_environment_variable(self, variable, value): self.environment[variable] = value self.config.set_environment_variable(variable, value) - def append_environment_variable(self, variable, value): + def prepend_environment_variable(self, variable, value): if variable in self.environment: self.environment[variable] += os.pathsep + value else: self.environment[variable] = value - self.config.append_environment_variable(variable, value) + self.config.prepend_environment_variable(variable, value)