diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index 4d8ee971c..7aa07eb82 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -461,8 +461,6 @@ jobs: runner.os == 'Windows' && env.INSTALLC == 1 name: (WINDOWS,CONDA) Set up MSVC Compiler uses: ilammy/msvc-dev-cmd@v1 - with: - toolset: 14.0 - continue-on-error: true id: conda_build if: matrix.install-method == 'conda' || matrix.install-method == 'mamba' @@ -861,8 +859,6 @@ jobs: runner.os == 'Windows' && env.INSTALLC == 1 name: (WINDOWS,CONDA) Set up MSVC Compiler uses: ilammy/msvc-dev-cmd@v1 - with: - toolset: 14.0 - continue-on-error: true id: conda_build if: matrix.install-method == 'conda' || matrix.install-method == 'mamba' @@ -1237,8 +1233,6 @@ jobs: runner.os == 'Windows' && env.INSTALLC == 1 name: (WINDOWS,CONDA) Set up MSVC Compiler uses: ilammy/msvc-dev-cmd@v1 - with: - toolset: 14.0 - continue-on-error: true id: conda_build if: matrix.install-method == 'conda' || matrix.install-method == 'mamba' @@ -1594,8 +1588,6 @@ jobs: runner.os == 'Windows' && env.INSTALLC == 1 name: (WINDOWS,CONDA) Set up MSVC Compiler uses: ilammy/msvc-dev-cmd@v1 - with: - toolset: 14.0 - continue-on-error: true id: conda_build if: matrix.install-method == 'conda' || matrix.install-method == 'mamba' @@ -1950,8 +1942,6 @@ jobs: runner.os == 'Windows' && env.INSTALLC == 1 name: (WINDOWS,CONDA) Set up MSVC Compiler uses: ilammy/msvc-dev-cmd@v1 - with: - toolset: 14.0 - continue-on-error: true id: conda_build if: matrix.install-method == 'conda' || matrix.install-method == 'mamba' diff --git a/tests/drivers/test_CModelDriver.py b/tests/drivers/test_CModelDriver.py index 5f778d64a..b329b131f 100644 --- a/tests/drivers/test_CModelDriver.py +++ b/tests/drivers/test_CModelDriver.py @@ -1,7 +1,4 @@ -import pytest -import os -from yggdrasil import platform -from yggdrasil.drivers.CModelDriver import CModelDriver, LDLinker +from yggdrasil.drivers.CModelDriver import LDLinker def test_LDLinker_tool_version(): @@ -10,16 +7,3 @@ def test_LDLinker_tool_version(): LDLinker.tool_version() LDLinker.get_search_path() LDLinker.get_env_flags() - - -@pytest.mark.skipif(not platform._is_linux, reason="OS is not Linux") -def test_update_ld_library_path(): - r"""Test update_ld_library_path method.""" - lang_dir = CModelDriver.get_language_dir() - total = os.pathsep.join(['test', lang_dir]) - env = {'LD_LIBRARY_PATH': 'test'} - env = CModelDriver.update_ld_library_path(env) - assert(env['LD_LIBRARY_PATH'] == total) - # Second time to ensure that path not added twice - env = CModelDriver.update_ld_library_path(env) - assert(env['LD_LIBRARY_PATH'] == total) diff --git a/tests/drivers/test_ModelDriver.py b/tests/drivers/test_ModelDriver.py index cbad912d1..7fe09e77f 100644 --- a/tests/drivers/test_ModelDriver.py +++ b/tests/drivers/test_ModelDriver.py @@ -21,7 +21,7 @@ def test_ModelDriver_implementation(): with pytest.raises(NotImplementedError): ModelDriver.is_library_installed(None) with pytest.raises(InvalidCompilationTool): - CompiledModelDriver.get_tool('compiler') + print(CompiledModelDriver.get_tool('compiler')) with pytest.raises(NotImplementedError): CompiledModelDriver.language_executable() with pytest.raises(NotImplementedError): diff --git a/tests/test_tools.py b/tests/test_tools.py index c44d14a40..22b705626 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -228,6 +228,8 @@ def test_find_all(): # Multiple files mdir, mpat, mans = make_temp_multiple() mout = tools.find_all(mpat, mdir) + print(mout) + print(mans) assert isinstance(mout, list) assert mout == mans diff --git a/utils/setup_test_env.py b/utils/setup_test_env.py index 68837f465..aa5df7b10 100644 --- a/utils/setup_test_env.py +++ b/utils/setup_test_env.py @@ -1742,7 +1742,7 @@ def install_pkg(method, param=None, without_build=False, # allow_missing=False) return cmds call_script(cmds, param=param) - config_pkg(param=param, allow_missing=False) + config_pkg(param=param, allow_missing=False, use_shell=True) def verify_pkg(install_opts=None): diff --git a/utils/test-install-base.yml b/utils/test-install-base.yml index 1cc4bcb38..4633128af 100644 --- a/utils/test-install-base.yml +++ b/utils/test-install-base.yml @@ -250,8 +250,8 @@ jobs: - name: (WINDOWS,CONDA) Set up MSVC Compiler uses: ilammy/msvc-dev-cmd@v1 if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') && runner.os == 'Windows' && env.INSTALLC == 1 - with: - toolset: 14.0 + # with: + # toolset: 14.0 # - name: (UNIX,CONDA) Add miniconda bin to path # if: (matrix.install-method == 'conda' || matrix.install-method == 'mamba') && runner.os != 'Windows' # run: | diff --git a/yggdrasil/drivers/CMakeModelDriver.py b/yggdrasil/drivers/CMakeModelDriver.py index 668541010..8463ab1ff 100644 --- a/yggdrasil/drivers/CMakeModelDriver.py +++ b/yggdrasil/drivers/CMakeModelDriver.py @@ -27,9 +27,18 @@ class CMakeConfigure(ConfigurerBase): ('target_fortran_compiler_path', '-DCMAKE_Fortran_COMPILER:FILEPATH=%s'), ('target_linker_path', '-DCMAKE_LINKER=%s'), - ('ignore_default_c_flags', '-DCMAKE_C_FLAGS='), - ('ignore_default_c++_flags', '-DCMAKE_CXX_FLAGS='), - ('ignore_default_fortran_flags', '-DCMAKE_Fortran_FLAGS='), + ('ignore_default_c_flags', + ['-DCMAKE_C_FLAGS=', + '-DCMAKE_C_FLAGS_DEBUG=', + '-DCMAKE_C_FLAGS_RELEASE=']), + ('ignore_default_c++_flags', + ['-DCMAKE_CXX_FLAGS=', + '-DCMAKE_CXX_FLAGS_DEBUG=', + '-DCMAKE_CXX_FLAGS_RELEASE=']), + ('ignore_default_fortran_flags', + ['-DCMAKE_Fortran_FLAGS=', + '-DCMAKE_Fortran_FLAGS_DEBUG=', + '-DCMAKE_Fortran_FLAGS_RELEASE=']), ('osx_sysroot', '-DCMAKE_OSX_SYSROOT=%s'), ('osx_deployment_target', '-DCMAKE_OSX_DEPLOYMENT_TARGET=%s'), ('sourcedir', '-S'), @@ -815,6 +824,9 @@ def create_imports(cls, dep, imp, products=None, overwrite=False, """ logger.debug(f"CREATE_IMPORTS {dep} {imp}") buildfile = dep['buildfile'] + if not os.path.isabs(buildfile): + buildfile = dep._relative_to_directory(buildfile) + logger.info(f"CREATE_IMPORTS {dep}: {buildfile}") target = dep.get('target', '${PROJECT_NAME}') if products is None: products = tools.IntegrationPathSet(overwrite=overwrite) diff --git a/yggdrasil/drivers/CompiledModelDriver.py b/yggdrasil/drivers/CompiledModelDriver.py index 575370d6e..b7d3791c8 100644 --- a/yggdrasil/drivers/CompiledModelDriver.py +++ b/yggdrasil/drivers/CompiledModelDriver.py @@ -29,7 +29,7 @@ _all_toolsets = [ 'gnu', 'msvc', 'llvm', ] -_default_libtype = 'static' # TODO: retry static' +_default_libtype = 'static' _conda_prefix = tools.get_conda_prefix() _venv_prefix = tools.get_venv_prefix() _system_suffix = "" @@ -2193,7 +2193,7 @@ def locate_tool(self, tooltype, toolname): tooltype0, language=language, driver=self.parent_driver, compatible_with=toolname, - only_installed=True) + only_installed=True, default=None) self._updated_tools[tooltype][toolname] = out if out and out.toolname not in self._updated_tools[tooltype]: self._updated_tools[tooltype][out.toolname] = out @@ -2940,6 +2940,9 @@ def _result(self, **kwargs): def _generated_windows_import(self, previous=None, **kwargs): out = None dll = self.get('shared', **kwargs) + # TODO: temp + logger.info(f"GENERATED_WINDOWS_IMPORT [{self.name}]: {dll} " + f"(previous = {previous}") if dll: directory = self.parent_driver.get_language_dir() out = create_windows_import( @@ -3471,8 +3474,7 @@ def _dep_libtool_kwargs(self, key, to_update=None, dep_libtype=None, if not os.path.isfile(dep_lib): raise RuntimeError(f"Library for {self.name} dependency " f"does not exist: '{dep_lib}'.") - if ((self['libtype'] in self.library_files - and dep_libtype != 'static')): + if self['libtype'] in self.library_files: libkey = 'libraries' if use_library_path_internal and self.origin == 'internal': if to_update.get('skip_library_libs', False): @@ -3595,6 +3597,7 @@ def _generic_env(self, key, to_update=None, for_build=False, if ((self.parent_driver.is_build_tool and self.parameters.get('target_dep', False))): target_dep = self.parameters['target_dep'] + out.update(target_dep.get(key, **kws)) for k in target_dep.active_tools(): out.update( target_dep.get(f'{k}_env', for_build=for_build, **kws)) @@ -3730,6 +3733,7 @@ def _search_brute(self, fname, libtype=None, verbose=False, fname_ext = expected_ext[0] if os.path.isfile(fname): return fname + fname_base = os.path.basename(fname_base) # use_regex = (not platform._is_win) fname_try = [fname_base] if platform._is_win and libtype in self.library_files: @@ -4414,7 +4418,7 @@ def create_flag(cls, key, value): list: Items representing the flag. """ - if (not isinstance(key, dict)) and (key in cls.flag_options): + if (not isinstance(key, (dict, list))) and (key in cls.flag_options): key = cls.flag_options[key] if isinstance(key, dict): key = key['key'] @@ -4422,6 +4426,10 @@ def create_flag(cls, key, value): out = [] for v in value: out += cls.create_flag(key, v) + elif isinstance(key, list): + out = [] + for k in key: + out += cls.create_flag(k, value) elif value is None: out = [] elif len(key) == 0: diff --git a/yggdrasil/drivers/FortranModelDriver.py b/yggdrasil/drivers/FortranModelDriver.py index 52486d5e1..da111e252 100644 --- a/yggdrasil/drivers/FortranModelDriver.py +++ b/yggdrasil/drivers/FortranModelDriver.py @@ -222,7 +222,12 @@ class FortranModelDriver(CompiledModelDriver): 'source': 'c_wrappers.c', 'language': 'c', 'libtype': 'object', - 'internal_dependencies': [('c', 'ygg')]}} + 'internal_dependencies': [('c', 'ygg')], + 'platform_specifics': { + 'Linux': { + 'compiler_flags': ['-fPIC'], + } + }}} type_map = { 'comm': 'yggcomm', 'dtype': 'yggdtype',