Skip to content
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

fixed: spaces in path + "=" breaking builds on macOS #52

Merged
merged 6 commits into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
*.mexw64
*.mexa64
*.mexmaci64
*.o
*.asv
*.pdp
*.mexw64.pdb
pathdef.m
jldict.mat
*DS_Store
26 changes: 20 additions & 6 deletions jl.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@
function varargout = mexn(nout, fn, varargin)
jl.check_initialized;
outputs = cell(nout+1, 1);
[outputs{:}] = mexjulia('jl_mex', fn, varargin{:});
varargout = outputs(2:end);
result = outputs{1};
if ~islogical(result)
throw(result);
try
[outputs{:}] = mexjulia('jl_mex', fn, varargin{:});
varargout = outputs(2:end);
result = outputs{1};
if ~islogical(result)
throw(result);
end
catch err
warning('Something went wrong')
warning(err.message)
warning('Stack trace follows:')
w = warning('query');
for i = 1:length(err.stack)
if ~strcmp(w(1).state,'off')
disp(err.stack(i))
end
end
varargout{1} = [];
end
end

Expand Down Expand Up @@ -229,7 +242,7 @@ function config(exe)
% set ldflags
ldflags = ['-L"' jl.get('lib_dir') '"'];
if ~ispc
ldflags = [ldflags ' -Wl,-rpath="' jl.get('lib_dir') '"'];
ldflags = [ldflags ' -Wl,-rpath "' jl.get('lib_dir') '"'];
end
jl.set('build_ldflags', ldflags);

Expand Down Expand Up @@ -283,6 +296,7 @@ function build()
else
mex_ptrn = 'mex LDFLAGS=''%s $LDFLAGS'' -v -largeArrayDims -outdir "%s" %s %s %s';
end
src = ['"' src '"'];
mex_cmd = sprintf(mex_ptrn, ldflags, jl.this_dir, cflags, src, ldlibs);
fprintf('The mex command to be executed:\n%s\n', mex_cmd);
eval(mex_cmd);
Expand Down