Commits

Ruben Martinez-Cantin committed f3098ba

Improve octave compilation

Comments (0)

Files changed (1)

matlab/compile_octave.m

 % You can also change ../lib for the correspoding install path
 % Octave
-mkoctfile -L../lib -l:bayesopt.so -lnlopt -I../include -I../wrappers ...
-    -I../nlopt/api --mex "-Wl,-rpath=../lib" --output bayesopt.mex ...
-    bayesoptmex.c
+if exist('../lib/libbayesopt.a','file')
+    disp('Compiling static library');
+     mkoctfile -L../lib -lbayesopt -I../include -I../wrappers ...
+        --mex "-Wl,-rpath=../lib" --output bayesoptcont.mex ...
+        bayesoptmex.c
 
-mkoctfile -L../lib -l:bayesopt.so -lnlopt -I../include -I../wrappers ...
-    -I../nlopt/api --mex "-Wl,-rpath=../lib" --output bayesoptdisc.mex ...
-    bayesoptdiscmex.c
+    mkoctfile -L../lib -lbayesopt -I../include -I../wrappers ...
+        --mex "-Wl,-rpath=../lib" --output bayesoptdisc.mex ...
+        bayesoptdiscmex.c
+else
+    disp('Compiling dynamic library');
+    mkoctfile -L../lib -l:bayesopt.so -lnlopt -I../include -I../wrappers ...
+        --mex "-Wl,-rpath=../lib" --output bayesoptcont.mex ...
+        bayesoptmex.c
 
+    mkoctfile -L../lib -l:bayesopt.so -lnlopt -I../include -I../wrappers ...
+        --mex "-Wl,-rpath=../lib" --output bayesoptdisc.mex ...
+        bayesoptdiscmex.c
+end