-
Notifications
You must be signed in to change notification settings - Fork 96
Streamline mex build and install process #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a2ff7e0
Add an octave build script
blink1073 95701d5
Add an octave config for win64
blink1073 627d27b
Rename function to avoid conflict
blink1073 7dfdc1a
Replace name of octave binary file
blink1073 e4d66a9
Add win64 octave binary
blink1073 5ae3d2a
Remove old octave dir
blink1073 ce17ee0
Update readme install instructions
blink1073 0761598
Remove messenger binary
blink1073 d2200c7
Add a linux config
blink1073 2a902c6
Add the linux octave binary
blink1073 b504695
Stub out the mac octave config
blink1073 d68c8f6
Commit linux64 messenger
blink1073 2e4e956
Remove .oct file
blink1073 a3e26df
Clean up install and configs
blink1073 072fe8d
Update the Readme
blink1073 c96cd2a
Update readme with Windows woes.
blink1073 04a4157
Make messenger a package
blink1073 08138ae
Can not use relative imports in package
blink1073 ca8a877
Add package __init__
blink1073 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import sys | ||
| import platform | ||
|
|
||
|
|
||
| def get_messenger_dir(): | ||
| # Check the system platform first | ||
| splatform = sys.platform | ||
|
|
||
| if splatform.startswith('linux'): | ||
| messenger_dir = 'mexa64' | ||
| elif splatform.startswith('darwin'): | ||
| messenger_dir = 'mexmaci64' | ||
| elif splatform.startswith('win32'): | ||
| if splatform == "win32": | ||
| # We have a win64 messenger, so we need to figure out if this is 32 or 64 | ||
| # bit Windows: | ||
| if not platform.machine().endswith('64'): | ||
| raise ValueError("pymatbridge does not work on win32") | ||
|
|
||
| # We further need to differniate 32 from 64 bit: | ||
| maxint = sys.maxsize | ||
| if maxint == 9223372036854775807: | ||
| messenger_dir = 'mexw64' | ||
| elif maxint == 2147483647: | ||
| messenger_dir = 'mexw32' | ||
| return messenger_dir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/python | ||
| from __future__ import print_function | ||
| import os | ||
| from get_messenger_dir import get_messenger_dir | ||
| import shutil | ||
| import subprocess | ||
|
|
||
| messenger_dir = get_messenger_dir() | ||
|
|
||
| with open(os.path.join(messenger_dir, 'local_octave.cfg')) as fid: | ||
| lines = fid.readlines() | ||
|
|
||
| cfg = {} | ||
| for line in lines: | ||
| name, path = line.split('=') | ||
| cfg[name.lower()] = path.strip() or '.' | ||
|
|
||
| print("Building messenger.mex...") | ||
|
|
||
| paths = "-L%(octave_lib)s -I%(octave_inc)s -L%(zmq_lib)s -I%(zmq_inc)s" % cfg | ||
| make_cmd = "mkoctfile --mex %s -lzmq ./src/messenger.c" % paths | ||
| print(make_cmd) | ||
| subprocess.check_output(make_cmd.split()) | ||
|
|
||
| messenger_exe = 'messenger.mex' | ||
| messenger_loc = os.path.join(messenger_dir, messenger_exe) | ||
|
|
||
| shutil.move(messenger_exe, messenger_loc) | ||
| os.remove('messenger.o') | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| OCTAVE_INC=/usr/include | ||
| OCTAVE_LIB=/usr/lib/x86_64-linux-gnu/ | ||
| ZMQ_INC= | ||
| ZMQ_LIB= |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| OCTAVE_INC=/usr/include | ||
| OCTAVE_LIB=/usr/lib/x86_64-linux-gnu/ | ||
| ZMQ_INC= | ||
| ZMQ_LIB= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| OCTAVE_INC="C:\Octave\Octave-3.8.2\include\octave-3.8.2\octave" | ||
| OCTAVE_LIB="C:\Octave\Octave-3.8.2\lib\octave\3.8.2" | ||
| ZMQ_INC="C:\zeromq-4.0.5\include" | ||
| ZMQ_LIB="C:\zeromq-4.0.5\src\.libs" |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the look of this file. I think
make.pycould be made to look like this after some cleanup, and then more duplication could be extracted out. But that doesn't have to be done now.