Skip to content

Commit

Permalink
Fix building and installing on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
imciner2 committed Nov 15, 2023
1 parent 1ee89e8 commit 03f9554
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions make_osqp.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ function make_osqp(varargin)
setenv('PATH', [PATH ':/usr/local/bin']);
end



%% Configure CMake for the mex interface
fprintf(' Configuring...' )
[status, output] = system( sprintf( 'cmake -B %s -S %s -DMatlab_ROOT_DIR=\"%s\"', osqp_mex_build_dir, osqp_mex_src_dir, Matlab_ROOT ), 'LD_LIBRARY_PATH', '' );
[status, output] = system( sprintf( 'cmake -B %s -S %s -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMatlab_ROOT_DIR=\"%s\"', osqp_mex_build_dir, osqp_mex_src_dir, Matlab_ROOT ), 'LD_LIBRARY_PATH', '' );
if( status )
fprintf( '\n' );
disp( output );
Expand All @@ -86,7 +88,7 @@ function make_osqp(varargin)

%% Build the mex interface
fprintf( ' Building...')
[status, output] = system( sprintf( 'cmake --build %s', osqp_mex_build_dir ), 'LD_LIBRARY_PATH', '' );
[status, output] = system( sprintf( 'cmake --build %s --config Release', osqp_mex_build_dir ), 'LD_LIBRARY_PATH', '' );
if( status )
fprintf( '\n' );
disp( output );
Expand All @@ -103,7 +105,11 @@ function make_osqp(varargin)
fprintf( ' Installing...' )

% Copy mex file to root directory for use
[err, errmsg, ~] = copyfile( [osqp_mex_build_dir, filesep, 'osqp_mex.mex*'], makefile_path );
if( ispc )
[err, errmsg, ~] = copyfile( [osqp_mex_build_dir, filesep, 'Release', filesep, 'osqp_mex.mex*'], makefile_path );
else
[err, errmsg, ~] = copyfile( [osqp_mex_build_dir, filesep, 'osqp_mex.mex*'], makefile_path );
end
if( ~err )
fprintf( '\n' )
disp( errmsg )
Expand Down

0 comments on commit 03f9554

Please sign in to comment.