diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8f9e67dac..fc2c6e2ad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -520,8 +520,9 @@ jobs: - name: Test Install # spot-check installation locations run: | + set -x scons install - test -f ${CONDA_PREFIX}/Library/lib/cantera_shared.dll + test -f ${CONDA_PREFIX}/Library/bin/cantera_shared.dll test -f ${CONDA_PREFIX}/Library/include/cantera/base/Solution.h test -f ${CONDA_PREFIX}/Scripts/ck2yaml test -f ${CONDA_PREFIX}/share/cantera/data/gri30.yaml @@ -531,6 +532,7 @@ jobs: - name: Test Essentials # ensure that Python package loads and converter scripts work run: | + set -x python -c 'import cantera as ct; import sys; sys.exit(0) if ct.__version__.startswith("3.0.0") else sys.exit(1)' ck2yaml --input=test/data/h2o2.inp --output=h2o2-test.yaml test -f h2o2-test.yaml diff --git a/SConstruct b/SConstruct index d6ae36cbc..9cd596296 100644 --- a/SConstruct +++ b/SConstruct @@ -2024,7 +2024,8 @@ elif env["layout"] == "conda": prefix = Path(env["prefix"]) if env["layout"] == "conda" and os.name == "nt": - env["ct_libdir"] = (prefix / "Library" / env["libdirname"]).as_posix() + env["ct_libdir"] = (prefix / "Library" / "lib").as_posix() + env["ct_shlibdir"] = (prefix / "Library" / "bin").as_posix() env["ct_bindir"] = (prefix / "Scripts").as_posix() env["ct_python_bindir"] = (prefix / "Scripts").as_posix() env["ct_incdir"] = (prefix / "Library" / "include" / "cantera").as_posix() @@ -2035,6 +2036,14 @@ else: env["prefix"] = prefix.as_posix() env["ct_libdir"] = (prefix / env["libdirname"]).as_posix() env["ct_bindir"] = (prefix / "bin").as_posix() + + # On Windows, the search path for DLLs is the "bin" dir. "lib" dirs are used only for + # static and "import" libraries + if env["OS"] == "Windows": + env["ct_shlibdir"] = env["ct_bindir"] + else: + env["ct_shlibdir"] = env["ct_libdir"] + env["ct_python_bindir"] = (prefix / "bin").as_posix() env["ct_incdir"] = (prefix / "include" / "cantera").as_posix() env["ct_incroot"] = (prefix / "include").as_posix() @@ -2081,7 +2090,7 @@ if os.path.abspath(instRoot) == Dir('.').abspath: sys.exit(1) env["inst_root"] = instRoot -locations = ["libdir", "bindir", "python_bindir", "incdir", "incroot", +locations = ["libdir", "shlibdir", "bindir", "python_bindir", "incdir", "incroot", "matlab_dir", "datadir", "sampledir", "docdir", "mandir"] for loc in locations: if env["prefix"] == ".": diff --git a/samples/clib/SConscript b/samples/clib/SConscript index 377e9fcac..b34b5dcb9 100644 --- a/samples/clib/SConscript +++ b/samples/clib/SConscript @@ -16,7 +16,7 @@ for programName, sources in samples: # Generate SConstruct files to be installed linkflags = ["-g", localenv["thread_flags"]] if not localenv["package_build"]: - linkflags.append(f"-Wl,-rpath,{localenv['ct_libdir']}") + linkflags.append(f"-Wl,-rpath,{localenv['ct_shlibdir']}") incdirs = [localenv["ct_incroot"]] libdirs = [localenv["ct_libdir"]] + localenv["extra_lib_dirs"] else: diff --git a/samples/f77/SConscript b/samples/f77/SConscript index 2b445314d..45eb5dc2c 100644 --- a/samples/f77/SConscript +++ b/samples/f77/SConscript @@ -37,7 +37,7 @@ if localenv["package_build"]: libdirs = [] else: cc_flags = localenv["CCFLAGS"] + localenv["CXXFLAGS"] - linkflags.append(f"-Wl,-rpath,{localenv['ct_libdir']}") + linkflags.append(f"-Wl,-rpath,{localenv['ct_shlibdir']}") incdirs = [localenv["ct_incroot"]] incdirs.extend([localenv["sundials_include"], localenv["boost_inc_dir"]]) diff --git a/samples/f90/SConscript b/samples/f90/SConscript index f8a382524..714f3515a 100644 --- a/samples/f90/SConscript +++ b/samples/f90/SConscript @@ -20,7 +20,7 @@ for programName, sources in samples: incdirs = [pjoin(localenv["ct_incroot"], "cantera")] # path to fortran .mod libdirs = [] if not localenv["package_build"]: - linkflags.append(f"-Wl,-rpath,{localenv['ct_libdir']}") + linkflags.append(f"-Wl,-rpath,{localenv['ct_shlibdir']}") libdirs = [localenv["ct_libdir"]] libdirs.extend([localenv["sundials_libdir"], localenv["blas_lapack_dir"]]) libdirs.append(localenv["hdf_libdir"]) diff --git a/src/SConscript b/src/SConscript index 2484bd8a3..e79e4fcc6 100644 --- a/src/SConscript +++ b/src/SConscript @@ -89,7 +89,7 @@ if env["python_package"] == "full": shim = pyenv.SharedObject("extensions/pythonShim.cpp") pylibname = f"../lib/cantera_python{pyenv['py_version_short'].replace('.', '_')}" lib = build(pyenv.SharedLibrary(pylibname, shim, SPAWN=get_spawn(pyenv))) - install("$inst_libdir", lib) + install("$inst_shlibdir", lib) # build the Cantera static library @@ -162,11 +162,17 @@ if localenv['versioned_shared_library']: lib = build(localenv.SharedLibrary(sharedName, libraryTargets + sharedIndicator, SPAWN=get_spawn(localenv), SHLIBVERSION=localenv['cantera_pure_version'])) - install(localenv.InstallVersionedLib, '$inst_libdir', lib) + install(localenv.InstallVersionedLib, '$inst_shlibdir', lib) else: lib = build(localenv.SharedLibrary(sharedName, libraryTargets + sharedIndicator, - SPAWN=get_spawn(localenv))) - install('$inst_libdir', lib) + SPAWN=get_spawn(localenv))) + for libfile in lib: + if libfile.name.endswith(('.exp', '.lib')): + # On Windows, these are the export/import libraries used when linking, which + # should be installed in the same location as static libraries + install('$inst_libdir', libfile) + else: + install('$inst_shlibdir', libfile) if env["OS"] == "Darwin": localenv.AddPostAction(lib, diff --git a/src/fortran/SConscript b/src/fortran/SConscript index f946097d1..858ade904 100644 --- a/src/fortran/SConscript +++ b/src/fortran/SConscript @@ -32,11 +32,18 @@ if localenv['layout'] != 'debian': SHLIBVERSION=localenv['cantera_pure_version'], LIBS=list(env['cantera_shared_libs'] + env['cxx_stdlib']), LINK='$FORTRAN_LINK')) - install(localenv.InstallVersionedLib, '$inst_libdir', shlib) + install(localenv.InstallVersionedLib, '$inst_shlibdir', shlib) else: shlib = build(localenv.SharedLibrary(target=sharedName, source=objects, SPAWN=get_spawn(localenv), LIBS=list(env['cantera_shared_libs'] + env['cxx_stdlib']), LINK='$FORTRAN_LINK')) - install('$inst_libdir', shlib) + for libfile in shlib: + if libfile.name.endswith(('.exp', '.lib')): + # On Windows, these are the export/import libraries used when linking, which + # should be installed in the same location as static libraries + install('$inst_libdir', libfile) + else: + install('$inst_shlibdir', libfile) + localenv.Depends(shlib, localenv['config_h_target'])