Skip to content

Commit

Permalink
Fix robot window linking with an external Python controller (#3449)
Browse files Browse the repository at this point in the history
* Fix robot window linking with an external Python controller

* Fix docs

* Update Makefile

* Update running-extern-robot-controllers.md
  • Loading branch information
lukicdarkoo authored Jul 16, 2021
1 parent fbf4c57 commit 64a3983
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
5 changes: 3 additions & 2 deletions docs/guide/running-extern-robot-controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Generic Webots environment variables needed for all the controller languages:
| Environment Variable | Typical Value |
|----------------------------------------------------|---------------------------------------------------------------------------|
| WEBOTS\_HOME | `C:\Program Files\Webots` |
| Path (all controllers except Python >= 3.8) | add `%WEBOTS_HOME%\lib\controller` and `%WEBOTS_HOME%\msys64\mingw64\bin` |
| Path (all controllers) | add `%WEBOTS_HOME%\lib\controller` |
| Path (all controllers except Python >= 3.8) | add `%WEBOTS_HOME%\msys64\mingw64\bin` |
| Path (for C++, Python < 3.8, and Java controllers) | add `%WEBOTS_HOME%\msys64\mingw64\bin\cpp` |

%tab-end
Expand All @@ -50,7 +51,7 @@ Generic Webots environment variables needed for all the controller languages:
| Environment Variable | Typical Value |
|---------------------------------------------------------|--------------------------------------------------|
| WEBOTS\_HOME | `/Applications/Webots.app` |
| DYLD\_LIBRARY\_PATH (not needed for Python controllers) | add `${WEBOTS_HOME}/lib/controller` |
| DYLD\_LIBRARY\_PATH | add `${WEBOTS_HOME}/lib/controller` |

%tab-end

Expand Down
2 changes: 1 addition & 1 deletion resources/projects/plugins/robot_windows/generic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ WEBOTS_HOME_PATH=$(subst $(space),\ ,$(strip $(subst \,/,$(WEBOTS_HOME))))
include $(WEBOTS_HOME_PATH)/resources/Makefile.os.include

ifeq ($(OSTYPE),linux)
LIBRARIES += -Wl,-rpath,$(WEBOTS_HOME_PATH)/lib/controller
LIBRARIES += -Wl,-rpath,'$$ORIGIN'/../../../../../lib/controller
endif

include $(WEBOTS_HOME_PATH)/resources/Makefile.include
13 changes: 0 additions & 13 deletions src/controller/python/controller.i
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@
%pythonbegin %{
import sys
import os
import platform
if 'WEBOTS_HOME' in os.environ:
new_path = os.path.join(os.environ['WEBOTS_HOME'], 'lib', 'controller')
variable_names = {
'Windows': 'PATH',
'Linux': 'LD_LIBRARY_PATH',
'Darwin': 'DYLD_LIBRARY_PATH'
}
variable_name = variable_names[platform.system()]
if variable_name in os.environ:
os.environ[variable_name] += os.pathsep + new_path
else:
os.environ[variable_name] = new_path
if os.name == 'nt' and sys.version_info >= (3, 8): # we need to explicitly list the folders containing the DLLs
webots_home = os.environ['WEBOTS_HOME']
os.add_dll_directory(os.path.join(webots_home, 'lib', 'controller'))
Expand Down

0 comments on commit 64a3983

Please sign in to comment.