chiark / gitweb /
Default build (#74)
authorJulien Schueller <schueller@phimeca.com>
Wed, 20 Jul 2016 14:36:27 +0000 (16:36 +0200)
committerSteven G. Johnson <stevenj@mit.edu>
Wed, 20 Jul 2016 14:36:27 +0000 (10:36 -0400)
* Enable Matlab by default

* Cleanup CMakeLists.txt

CMakeLists.txt
octave/CMakeLists.txt
swig/CMakeLists.txt

index 3fa727cc02c0057fe0c39103aa7498458303bf10..848d29a65b9ab63875229826606cf683816efd9d 100644 (file)
@@ -26,7 +26,7 @@ option (WITH_CXX "enable cxx routines" OFF)
 option (BUILD_SHARED_LIBS "Build NLOPT as a shared library" ON)\r
 option (BUILD_PYTHON "build python bindings" ON)\r
 option (BUILD_OCTAVE "build octave bindings" ON)\r
-option (BUILD_MATLAB "build matlab bindings" OFF)\r
+option (BUILD_MATLAB "build matlab bindings" ON)\r
 option (BUILD_GUILE "build guile bindings" ON)\r
 option (USE_SWIG "use SWIG to build bindings" ON)\r
 \r
@@ -48,13 +48,13 @@ set (INSTALL_DATA_DIR    share/nlopt       CACHE PATH "Installation directory fo
 set (INSTALL_CMAKE_DIR   ${INSTALL_LIB_DIR}/cmake/nlopt CACHE PATH "Installation directory for cmake config files")\r
 \r
 # Make relative paths absolute (needed later on)\r
-foreach(p LIB BIN INCLUDE DATA CMAKE)\r
-    set(var INSTALL_${p}_DIR)\r
-    set(RELATIVE_INSTALL_${p}_DIR ${INSTALL_${p}_DIR})\r
-    if(NOT IS_ABSOLUTE "${${var}}")\r
-        set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")\r
-    endif()\r
-endforeach()\r
+foreach (p LIB BIN INCLUDE DATA CMAKE)\r
+  set (var INSTALL_${p}_DIR)\r
+  set (RELATIVE_INSTALL_${p}_DIR ${INSTALL_${p}_DIR})\r
+  if (NOT IS_ABSOLUTE "${${var}}")\r
+    set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")\r
+  endif ()\r
+endforeach ()\r
 \r
 \r
 set (CMAKE_INSTALL_RPATH ${INSTALL_LIB_DIR})\r
@@ -158,21 +158,21 @@ set (${INCLUDE_DIRECTORIES} "")
 include_directories (\r
   ${CMAKE_BINARY_DIR}/api\r
   ${CMAKE_BINARY_DIR}\r
-  stogo \r
-  util \r
-  direct \r
-  cdirect \r
-  praxis \r
-  luksan \r
-  crs \r
-  mlsl \r
-  mma \r
-  cobyla \r
-  newuoa \r
-  neldermead \r
-  auglag \r
-  bobyqa \r
-  isres \r
+  stogo\r
+  util\r
+  direct\r
+  cdirect\r
+  praxis\r
+  luksan\r
+  crs\r
+  mlsl\r
+  mma\r
+  cobyla\r
+  newuoa\r
+  neldermead\r
+  auglag\r
+  bobyqa\r
+  isres\r
   slsqp\r
   esch\r
   api)\r
@@ -182,29 +182,29 @@ include_directories (
 # nlopt LIBRARY TARGET (SHARED OR STATIC)\r
 #==============================================================================\r
 \r
-SET ( NLOPT_HEADERS \r
+set (NLOPT_HEADERS \r
   api/nlopt.h ${CMAKE_BINARY_DIR}/api/nlopt.hpp ${CMAKE_BINARY_DIR}/api/nlopt.f\r
 )\r
 \r
-SET ( NLOPT_SOURCES   \r
-       direct/DIRect.c direct/direct_wrap.c direct/DIRserial.c direct/DIRsubrout.c direct/direct-internal.h direct/direct.h\r
-       cdirect/cdirect.c cdirect/hybrid.c cdirect/cdirect.h\r
-       praxis/praxis.c praxis/praxis.h\r
-       luksan/plis.c luksan/plip.c luksan/pnet.c luksan/mssubs.c luksan/pssubs.c luksan/luksan.h\r
-       crs/crs.c crs/crs.h\r
-       mlsl/mlsl.c mlsl/mlsl.h\r
-       mma/mma.c mma/mma.h mma/ccsa_quadratic.c\r
-       cobyla/cobyla.c cobyla/cobyla.h\r
-       newuoa/newuoa.c newuoa/newuoa.h \r
-       neldermead/nldrmd.c neldermead/neldermead.h neldermead/sbplx.c   \r
-       auglag/auglag.c auglag/auglag.h\r
-       bobyqa/bobyqa.c bobyqa/bobyqa.h\r
-       isres/isres.c isres/isres.h \r
-       slsqp/slsqp.c slsqp/slsqp.h \r
-       esch/esch.c esch/esch.h\r
-       api/general.c api/options.c api/optimize.c api/deprecated.c api/nlopt-internal.h api/nlopt.h api/f77api.c api/f77funcs.h api/f77funcs_.h api/nlopt.hpp api/nlopt-in.hpp\r
-       util/mt19937ar.c util/sobolseq.c util/soboldata.h util/timer.c util/stop.c util/nlopt-util.h util/redblack.c util/redblack.h util/qsort_r.c util/rescale.c \r
-        )\r
+set (NLOPT_SOURCES   \r
+  direct/DIRect.c direct/direct_wrap.c direct/DIRserial.c direct/DIRsubrout.c direct/direct-internal.h direct/direct.h\r
+  cdirect/cdirect.c cdirect/hybrid.c cdirect/cdirect.h\r
+  praxis/praxis.c praxis/praxis.h\r
+  luksan/plis.c luksan/plip.c luksan/pnet.c luksan/mssubs.c luksan/pssubs.c luksan/luksan.h\r
+  crs/crs.c crs/crs.h\r
+  mlsl/mlsl.c mlsl/mlsl.h\r
+  mma/mma.c mma/mma.h mma/ccsa_quadratic.c\r
+  cobyla/cobyla.c cobyla/cobyla.h\r
+  newuoa/newuoa.c newuoa/newuoa.h\r
+  neldermead/nldrmd.c neldermead/neldermead.h neldermead/sbplx.c \r
+  auglag/auglag.c auglag/auglag.h\r
+  bobyqa/bobyqa.c bobyqa/bobyqa.h\r
+  isres/isres.c isres/isres.h\r
+  slsqp/slsqp.c slsqp/slsqp.h\r
+  esch/esch.c esch/esch.h\r
+  api/general.c api/options.c api/optimize.c api/deprecated.c api/nlopt-internal.h api/nlopt.h api/f77api.c api/f77funcs.h api/f77funcs_.h api/nlopt.hpp api/nlopt-in.hpp\r
+  util/mt19937ar.c util/sobolseq.c util/soboldata.h util/timer.c util/stop.c util/nlopt-util.h util/redblack.c util/redblack.h util/qsort_r.c util/rescale.c\r
+)\r
 \r
 if (WITH_CXX)\r
   list (APPEND NLOPT_SOURCES stogo/global.cc stogo/linalg.cc stogo/local.cc stogo/stogo.cc stogo/tools.cc stogo/global.h stogo/linalg.h stogo/local.h stogo/stogo_config.h stogo/stogo.h stogo/tools.h)\r
@@ -274,7 +274,6 @@ if (BUILD_OCTAVE)
 endif ()\r
 \r
 if (BUILD_MATLAB)\r
-  cmake_minimum_required (VERSION 3.3) # for the matlab_add_mex macro\r
   find_package (Matlab)\r
 endif ()\r
 \r
index 0c8e6f3d3d87efd023d986903147a255c21542ed..ed4a6c20dfaa237b18898fc2f2a8d116becc03dc 100644 (file)
@@ -27,5 +27,7 @@ if (OCTAVE_FOUND)
 endif ()
 
 if (Matlab_FOUND)
+  cmake_minimum_required (VERSION 3.3) # for the matlab_add_mex macro
+
   matlab_add_mex (NAME nlopt_optimize-mex SRC nlopt_optimize-mex.c OUTPUT_NAME nlopt_optimize LINK_TO ${nlopt_lib})
 endif ()
index fafb5124c78e6eb7a3ad1b88c61837d65ccea39e..16384b5fc4a493d09e5605cb62e93c7497cb5233 100644 (file)
@@ -33,8 +33,8 @@ if (NUMPY_FOUND AND PYTHONLIBS_FOUND AND (SWIG_FOUND OR (EXISTS ${CMAKE_CURRENT_
     swig_link_libraries (nlopt ${PYTHON_LIBRARIES})
   endif ()
 
-  install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/nlopt.py DESTINATION ${PYTHON_MODULE_PATH} )
-  install ( TARGETS ${SWIG_MODULE_nlopt_REAL_NAME} LIBRARY DESTINATION ${PYTHON_MODULE_PATH} )
+  install (FILES ${CMAKE_CURRENT_BINARY_DIR}/nlopt.py DESTINATION ${PYTHON_MODULE_PATH})
+  install (TARGETS ${SWIG_MODULE_nlopt_REAL_NAME} LIBRARY DESTINATION ${PYTHON_MODULE_PATH})
 endif ()