Skip to content

Commit

Permalink
Add .dll support for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Salzmann committed Feb 23, 2024
1 parent 584e751 commit 5e73711
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion l4casadi/l4casadi.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@


def dynamic_lib_file_ending():
return '.dylib' if platform.system() == 'Darwin' else '.so'
system = platform.system()
if system == 'Darwin':
return '.dylib'
elif system == 'Linux':
return '.so'
elif system == 'Windows':
return '.dll'


class L4CasADi(object):
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
def compile_hook(manifest):
lib = manifest[0]
file_path = pathlib.Path(__file__).parent.resolve()
(pathlib.Path(__file__).parent.resolve() / 'l4casadi' / 'lib').mkdir(exist_ok=True)
(pathlib.Path(__file__).parent.resolve() / 'l4casadi' / 'include').mkdir(exist_ok=True)
(file_path / 'l4casadi' / 'lib').mkdir(exist_ok=True)
(file_path / 'l4casadi' / 'include').mkdir(exist_ok=True)

# Copy lib
shutil.copy(lib, file_path / 'l4casadi' / 'lib')
Expand All @@ -38,6 +38,7 @@ def compile_hook(manifest):
package_data={'': [
'lib/**.dylib',
'lib/**.so',
'lib/**.dll',
'include/**.hpp',
'template_generation/templates/casadi_function.in.cpp'
]},
Expand Down

0 comments on commit 5e73711

Please sign in to comment.