Skip to content

Commit 548bf46

Browse files
authored
Merge pull request #160 from OpenFAST/rc-4.1.1
v4.1.1
2 parents afb61f8 + 7b2c193 commit 548bf46

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# system files
22
.DS_Store
33
.vscode
4+
.atom
5+
.fortls
6+
.devcontainer
7+
.idea
8+
.env
9+
410

511
# cmake outputs
612
CMakeCache.txt
@@ -29,6 +35,11 @@ vtk*
2935
# build directories
3036
glue-codes/openfast/5MW_Baseline/ServoData/DISCON*/build
3137

38+
# backup files
39+
*.asv
40+
~$*.xlsx
41+
.*.swp
42+
3243
# temporary figures
3344
_*.png
3445

modules/driver_utilities.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,40 @@ def get_library_path(module_name: str) -> str:
2424
"moordyn": "libmoordyn_c_binding"
2525
}
2626
basename = module_map.get(module_name.lower(), f"lib{module_name}_c_binding")
27-
build_path = Path("..").joinpath(*[".."] * 4, "build")
27+
build_path = Path("..").joinpath(*[".."] * 3) # for running from testing in a build dir
2828

2929
if sys.platform in ["linux", "linux2"]:
30-
return str(build_path / "modules" / module_name / f"{basename}.so")
31-
30+
ext = "so"
3231
if sys.platform == "darwin":
33-
return str(build_path / "modules" / module_name / f"{basename}.dylib")
32+
ext = "dylib"
33+
34+
if sys.platform in ["linux","linux2","darwin"]:
35+
possible_paths = [
36+
build_path / "modules" / module_name / f"{basename}.{ext}",
37+
build_path / ".." / "install" / "lib" / f"{basename}.{ext}"
38+
]
39+
for path in possible_paths:
40+
if path.is_file():
41+
print(f"Loading library from {path}")
42+
return str(path)
43+
sys.exit(
44+
f"Cannot find lib{module_name}_c_binding at"
45+
f" {possible_paths[0]} or {possible_paths[1]}"
46+
)
3447

3548
if sys.platform == "win32":
3649
bit_version = "Win32" if sys.maxsize <= 2**32 else "x64"
3750
possible_paths = [
3851
build_path / "modules" / module_name / f"{basename}.dll",
3952
build_path / "bin" / f"{module_name}_c_binding_{bit_version}.dll"
4053
]
41-
return str(next((path for path in possible_paths if path.is_file()), None)) or sys.exit(
54+
for path in possible_paths:
55+
if path.is_file():
56+
print(f"Loading library from {path}")
57+
return str(path)
58+
sys.exit(
4259
f"Python is {bit_version} bit and cannot find {bit_version} "
43-
f"bit {module_name} DLL in any expected location."
60+
f"bit {module_name} DLL at {path}."
4461
)
4562

4663
raise ValueError(f"Unsupported platform: {sys.platform}")

0 commit comments

Comments
 (0)