*.mex*
*.oct
*.zip
+build
# generated code
api/nlopt.f
octave/dummy
test/testopt
util/redblack_test
-
-# autotools stuff
-Makefile
-Makefile.in
-.deps
-.libs
-stamp-h1
-install-sh
-libtool
-ltmain.sh
-m4/libtool.m4
-m4/ltoptions.m4
-m4/ltsugar.m4
-m4/ltversion.m4
-m4/lt~obsolete.m4
-configure
-config.*
-autom4te.cache
-INSTALL
-README
-aclocal.m4
-depcomp
-missing
-py-compile
-compile
language: cpp
sudo: false
-addons:
- apt:
- packages:
- - swig
- - python-dev
- - python-numpy
- - guile-2.0-dev
- - octave3.2-headers
- - cmake
+matrix:
+ include:
+ - os: linux
+ addons:
+ apt:
+ packages:
+ - swig
+ - python-dev
+ - python-numpy
+ - guile-2.0-dev
+ - octave3.2-headers
+ - cmake
+ - g++-mingw-w64-i686
+ - gcc-mingw-w64-i686
+ - binutils-mingw-w64-i686
+ - g++-mingw-w64-x86-64
+ - gcc-mingw-w64-x86-64
+ - binutils-mingw-w64-x86-64
+ script:
+ - mkdir build && pushd build
+ - cmake -DCMAKE_INSTALL_PREFIX=~/.local -DWITH_CXX=ON ..
+ - make install -j2 && make tests -j2 && ctest -j2 --output-on-failure
+ - rm -rf * ~/.local
+ - cmake -DCMAKE_INSTALL_PREFIX=~/.local -DWITH_CXX=ON -DBUILD_PYTHON=OFF -DBUILD_OCTAVE=OFF -DBUILD_GUILE=OFF -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchain-i686-w64-mingw32.cmake ..
+ - make install -j2 && make tests -j2
+ - rm -rf * ~/.local
+ - cmake -DCMAKE_INSTALL_PREFIX=~/.local -DWITH_CXX=ON -DBUILD_PYTHON=OFF -DBUILD_OCTAVE=OFF -DBUILD_GUILE=OFF -DCMAKE_TOOLCHAIN_FILE=$PWD/../cmake/toolchain-x86_64-w64-mingw32.cmake ..
+ - make install -j2 && make tests -j2
-script:
- - ./autogen.sh --no-configure
- - mkdir build && pushd build
- - ../configure --prefix=$HOME/.local --enable-shared --enable-maintainer-mode --enable-cxx
- - make -j2
- - make install
- - python ../test/test_std.py
- - rm -rf * ~/.local
- - cmake -DCMAKE_INSTALL_PREFIX=~/.local -DBUILD_SHARED_LIBS=ON ..
- - make install -j2
- - python ../test/test_std.py
+ - os: osx
+ install:
+ - brew tap homebrew/python
+ - brew install swig python
+ script:
+ - mkdir build && pushd build
+ - cmake -DCMAKE_INSTALL_PREFIX=~/.local -DWITH_CXX=ON ..
+ - make install && make tests && ctest --output-on-failure
\ No newline at end of file
+++ /dev/null
-#!/bin/sh
-set -ev
-
-rm -rf mingw32
-make distclean || true
-
-echo "COMPILING..."
-
-./configure --prefix=`pwd`/mingw32 --host=i686-w64-mingw32 --enable-shared --disable-static --without-matlab --without-octave --without-python --without-guile --without-threadlocal && make -j4 && make install
-
-echo "POST-PROCESSING..."
-
-cd mingw32/bin
-for dll in *.dll; do
- def=`basename $dll .dll`.def
- echo "LIBRARY $dll" > $def
- echo EXPORTS >> $def
- i686-w64-mingw32-nm $dll | grep ' T _' | sed 's/.* T _//' | egrep 'nlopt|nlo_' >> $def
-done
-cd ../..
-
-perl -pi -e 's,^ * #define NLOPT_DLL,*/\n#define NLOPT_DLL\n/*,' mingw32/include/nlopt.h
-
-cat > README-WINDOWS <<EOF
-This .zip archive contains DLL libraries and the associated header (.h)
-and module-definition (.def) files of NLopt compiled for Win32.
-
-In order to link to this .dll files from Visual C++, you need to
-create a .lib "import libraries" for it, and can do so with the "lib"
-command that comes with VC++. In particular, run:
- lib /def:libnlopt-0.def
-
-To compile the Matlab plugin, use the Matlab "mex" compiler on the file
-nlopt_optimize.c (being sure to link to the libnlopt DLL) in the matlab
-subdirectory.
-
-To build the Python plugin (assuming that you have Python and Numpy
-installed), do:
- python setup.py build_ext --inplace
-
-They were compiled by the GNU C compiler for MinGW, specifically:
-EOF
-i686-w64-mingw32-gcc --version |head -1 >> README-WINDOWS
-
-# grep -v "nlopt-util.h" octave/nlopt_minimize_constrained-mex.c > mingw32/nlopt_minimize_constrained.c
-
-nlopt_vers=`grep PACKAGE_VERSION config.h |cut -d" " -f3 |tr -d \"`
-
-mkdir mingw32/matlab
-cd octave
-cp `grep 'MFILES =' Makefile.am | cut -d= -f2` ../mingw32/matlab
-cp `grep 'm_DATA =' Makefile.am | cut -d\) -f2` ../mingw32/matlab
-cp nlopt_optimize-mex.c ../mingw32/matlab/nlopt_optimize.c
-cd ..
-
-mkdir mingw32/python
-cp swig/nlopt.py swig/nlopt-python.cpp mingw32/python
-cat > mingw32/python/setup.py <<EOF
-from distutils.core import setup, Extension
-nlopt_module = Extension('_nlopt',
- sources=['nlopt-python.cpp'],
- libraries=['libnlopt-0'],
- )
-import numpy
-setup (name = 'nlopt',
- version = '${nlopt_vers}',
- author = "Steven G. Johnson",
- description = """NLopt nonlinear-optimization library""",
- ext_modules = [nlopt_module],
- py_modules = ["nlopt"],
- include_dirs = ['.', numpy.get_include()],
- )
-EOF
-
-nlopt_vers=`grep PACKAGE_VERSION config.h |cut -d" " -f3 |tr -d \"`
-zip=nlopt-${nlopt_vers}-dll32.zip
-rm -f $zip
-zip -vj $zip mingw32/bin/*.dll mingw32/bin/*.exe
-zip -vjgl $zip mingw32/bin/*.def mingw32/include/* mingw32/python/* README COPYING COPYRIGHT NEWS README-WINDOWS
-
-echo "PACKAGING $zip..."
-
-cd mingw32
-zip -vgl ../$zip matlab/*
-cd ..
+++ /dev/null
-#!/bin/sh
-set -ev
-
-rm -rf mingw64
-make distclean || true
-
-echo "COMPILING..."
-
-./configure --prefix=`pwd`/mingw64 --host=x86_64-w64-mingw32 --enable-shared --disable-static --without-matlab --without-octave --without-python --without-guile --without-threadlocal && make -j4 && make install
-
-echo "POST-PROCESSING..."
-
-cd mingw64/bin
-for dll in *.dll; do
- def=`basename $dll .dll`.def
- echo "LIBRARY $dll" > $def
- echo EXPORTS >> $def
- x86_64-w64-mingw32-nm $dll | grep ' T ' | sed 's/.* T //' | egrep 'nlopt|nlo_' >> $def
-done
-cd ../..
-
-perl -pi -e 's,^ * #define NLOPT_DLL,*/\n#define NLOPT_DLL\n/*,' mingw64/include/nlopt.h
-
-cat > README-WINDOWS <<EOF
-This .zip archive contains DLL libraries and the associated header (.h)
-and module-definition (.def) files of NLopt compiled for Win64.
-
-In order to link to this .dll files from Visual C++, you need to
-create a .lib "import libraries" for it, and can do so with the "lib"
-command that comes with VC++. In particular, run:
- lib /def:libnlopt-0.def
-
-To compile the Matlab plugin, use the Matlab "mex" compiler on the file
-nlopt_optimize.c (being sure to link to the libnlopt DLL) in the matlab
-subdirectory.
-
-To build the Python plugin (assuming that you have Python and Numpy
-installed), do:
- python setup.py build_ext --inplace
-
-They were compiled by the GNU C compiler for MinGW, specifically:
-EOF
-x86_64-w64-mingw32-gcc --version |head -1 >> README-WINDOWS
-
-# grep -v "nlopt-util.h" octave/nlopt_minimize_constrained-mex.c > mingw64/nlopt_minimize_constrained.c
-
-nlopt_vers=`grep PACKAGE_VERSION config.h |cut -d" " -f3 |tr -d \"`
-
-mkdir mingw64/matlab
-cd octave
-cp `grep 'MFILES =' Makefile.am | cut -d= -f2` ../mingw64/matlab
-cp `grep 'm_DATA =' Makefile.am | cut -d\) -f2` ../mingw64/matlab
-cp nlopt_optimize-mex.c ../mingw64/matlab/nlopt_optimize.c
-cd ..
-
-mkdir mingw64/python
-cp swig/nlopt.py swig/nlopt-python.cpp mingw64/python
-cat > mingw64/python/setup.py <<EOF
-from distutils.core import setup, Extension
-nlopt_module = Extension('_nlopt',
- sources=['nlopt-python.cpp'],
- libraries=['libnlopt-0'],
- )
-import numpy
-setup (name = 'nlopt',
- version = '${nlopt_vers}',
- author = "Steven G. Johnson",
- description = """NLopt nonlinear-optimization library""",
- ext_modules = [nlopt_module],
- py_modules = ["nlopt"],
- include_dirs = ['.', numpy.get_include()],
- )
-EOF
-
-nlopt_vers=`grep PACKAGE_VERSION config.h |cut -d" " -f3 |tr -d \"`
-zip=nlopt-${nlopt_vers}-dll64.zip
-rm -f $zip
-zip -vj $zip mingw64/bin/*.dll mingw64/bin/*.exe
-zip -vjgl $zip mingw64/bin/*.def mingw64/include/* mingw64/python/* README COPYING COPYRIGHT NEWS README-WINDOWS
-
-echo "PACKAGING $zip..."
-
-cd mingw64
-zip -vgl ../$zip matlab/*
-cd ..
-PROJECT(NLOPT)\r
-\r
#==============================================================================\r
# NLOPT CMake file\r
# \r
# Benoit Scherrer, 2010 CRL, Harvard Medical School\r
# Copyright (c) 2008-2009 Children's Hospital Boston \r
#==============================================================================\r
+cmake_minimum_required (VERSION 2.6)\r
\r
+if (NOT DEFINED CMAKE_BUILD_TYPE)\r
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type")\r
+endif ()\r
\r
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)\r
-INCLUDE(CheckIncludeFiles)\r
-INCLUDE(CheckFunctionExists)\r
-INCLUDE(CheckTypeSize)\r
+project (nlopt C)\r
\r
+list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)\r
\r
-#==============================================================================\r
-# COMPILATION CHECKINGS and CONFIGURATION GENERATION\r
-#==============================================================================\r
-CHECK_INCLUDE_FILES( unistd.h HAVE_UNISTD_H)\r
-CHECK_INCLUDE_FILES( string.h HAVE_STRING_H)\r
-CHECK_INCLUDE_FILES( strings.h HAVE_STRINGS_H)\r
-CHECK_INCLUDE_FILES( sys/stat.h HAVE_SYS_STAT_H)\r
-CHECK_INCLUDE_FILES( inttypes.h HAVE_INTTYPES_H)\r
-CHECK_INCLUDE_FILES( memory.h HAVE_MEMORY_H)\r
-CHECK_INCLUDE_FILES( stdlib.h HAVE_STDLIB_H)\r
-CHECK_INCLUDE_FILES( stdint.h HAVE_STDINT_H)\r
-\r
-CHECK_INCLUDE_FILES( sys/types.h HAVE_SYS_TYPES_H)\r
-CHECK_INCLUDE_FILES( sys/types.h HAVE_SYS_TYPES_H)\r
-CHECK_INCLUDE_FILES( sys/types.h HAVE_SYS_TYPES_H)\r
-\r
-CHECK_FUNCTION_EXISTS( isinf HAVE_ISINF)\r
-CHECK_FUNCTION_EXISTS( isinf HAVE_ISNAN)\r
-CHECK_FUNCTION_EXISTS( gettimeofday HAVE_GETTIMEOFDAY)\r
-CHECK_FUNCTION_EXISTS( qsort_r HAVE_QSORT_R)\r
-CHECK_FUNCTION_EXISTS( time HAVE_TIME)\r
-CHECK_FUNCTION_EXISTS( copysign HAVE_COPYSIGN)\r
-\r
-CHECK_TYPE_SIZE(uint32_t UINT32_T)\r
-IF(NOT HAVE_UINT32_T)\r
- IF(MSVC)\r
- SET(uint32_t "unsigned int")\r
- SET(SIZEOF_UNSIGNED_INT 4)\r
- ENDIF(MSVC)\r
-ENDIF(NOT HAVE_UINT32_T)\r
+option (WITH_CXX "enable cxx routines" OFF)\r
+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_GUILE "build guile bindings" ON)\r
+option (USE_SWIG "use SWIG to build bindings" ON)\r
+\r
+set (NLOPT_SUFFIX)\r
+if (WITH_CXX)\r
+ set (NLOPT_SUFFIX _cxx)\r
+endif ()\r
+\r
+if (WITH_CXX OR BUILD_PYTHON)\r
+ enable_language (CXX)\r
+endif ()\r
+\r
+\r
+# Offer the user the choice of overriding the installation directories\r
+set (INSTALL_LIB_DIR lib${LIB_SUFFIX} CACHE PATH "Installation directory for libraries")\r
+set (INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")\r
+set (INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")\r
+set (INSTALL_DATA_DIR share/nlopt CACHE PATH "Installation directory for data files")\r
+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
+\r
+\r
+set (CMAKE_INSTALL_RPATH ${INSTALL_LIB_DIR})\r
+set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)\r
+if(POLICY CMP0042)\r
+ # Set MACOSX_RPATH to ON\r
+ cmake_policy(SET CMP0042 NEW)\r
+endif()\r
+\r
+include (CheckIncludeFiles)\r
+include (CheckFunctionExists)\r
+include (CheckTypeSize)\r
+include (CheckCCompilerFlag)\r
\r
#==============================================================================\r
-# LOOK FOR THE VERSION NUMBER IN configure.ac\r
+# COMPILATION CHECKINGS and CONFIGURATION GENERATION\r
#==============================================================================\r
+check_include_file (dlfcn.h HAVE_DLFCN_H)\r
+check_include_file (getopt.h HAVE_GETOPT_H)\r
+check_include_file (unistd.h HAVE_UNISTD_H)\r
+check_include_file (string.h HAVE_STRING_H)\r
+check_include_file (strings.h HAVE_STRINGS_H)\r
+check_include_file (inttypes.h HAVE_INTTYPES_H)\r
+check_include_file (memory.h HAVE_MEMORY_H)\r
+check_include_file (stdlib.h HAVE_STDLIB_H)\r
+check_include_file (stdint.h HAVE_STDINT_H)\r
+check_include_file (time.h HAVE_TIME_H)\r
+check_include_file (sys/types.h HAVE_SYS_TYPES_H)\r
+check_include_file (sys/stat.h HAVE_SYS_STAT_H)\r
+check_include_file (sys/time.h HAVE_SYS_TIME_H)\r
+if (HAVE_TIME_H AND HAVE_SYS_TIME_H)\r
+ set (TIME_WITH_SYS_TIME TRUE)\r
+endif ()\r
+check_function_exists (getpid HAVE_GETPID)\r
+check_function_exists (syscall HAVE_GETTID_SYSCALL)\r
+check_function_exists (isinf HAVE_ISINF)\r
+check_function_exists (isnan HAVE_ISNAN)\r
+check_function_exists (gettimeofday HAVE_GETTIMEOFDAY)\r
+check_function_exists (qsort_r HAVE_QSORT_R)\r
+check_function_exists (time HAVE_TIME)\r
+check_function_exists (copysign HAVE_COPYSIGN)\r
+check_type_size ("uint32_t" SIZEOF_UINT32_T)\r
+set (HAVE_UINT32_T ${SIZEOF_UINT32_T})\r
+check_type_size ("unsigned int" SIZEOF_UNSIGNED_INT)\r
+check_type_size ("unsigned long" SIZEOF_UNSIGNED_LONG)\r
\r
-FILE( READ configure.ac CONFIG_AUTOMAKE )\r
-\r
-STRING( REGEX MATCH "AC_INIT\\(nlopt, ([0-9]+\\.[0-9]+\\.?[0-9]*)" NLOPT_AUTOMAKE_LINE_VERSION "${CONFIG_AUTOMAKE}") \r
+if (NOT DEFINED HAVE_FPCLASSIFY)\r
+ message(STATUS "Looking for fpclassify")\r
+ file (WRITE ${CMAKE_BINARY_DIR}/fpclassify.c "#include <math.h>\n")\r
+ file (APPEND ${CMAKE_BINARY_DIR}/fpclassify.c "int main(void) {\n")\r
+ file (APPEND ${CMAKE_BINARY_DIR}/fpclassify.c "if (!fpclassify(3.14159)) fpclassify(2.7183);\n")\r
+ file (APPEND ${CMAKE_BINARY_DIR}/fpclassify.c " return 0; }\n")\r
+ try_compile (HAVE_FPCLASSIFY\r
+ ${CMAKE_BINARY_DIR}/build_fpclassify\r
+ ${CMAKE_BINARY_DIR}/fpclassify.c\r
+ CMAKE_FLAGS -DLINK_LIBRARIES=m)\r
+ message(STATUS "Looking for fpclassify - ${HAVE_FPCLASSIFY}")\r
+endif ()\r
\r
-#---------------------------------\r
-# If version matches 'X.X.X'\r
-#---------------------------------\r
-IF(${NLOPT_AUTOMAKE_LINE_VERSION} MATCHES ".*[0-9]+\\.[0-9]+\\.[0-9]+")\r
- STRING( REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]*.*" "\\1" NLOPT_MAJOR_VERSION "${NLOPT_AUTOMAKE_LINE_VERSION}") \r
- STRING( REGEX REPLACE ".*[0-9]+\\.([0-9]+)\\.[0-9]*.*" "\\1" NLOPT_MINOR_VERSION "${NLOPT_AUTOMAKE_LINE_VERSION}") \r
- STRING( REGEX REPLACE ".*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" NLOPT_BUGFIX_VERSION "${NLOPT_AUTOMAKE_LINE_VERSION}") \r
-#---------------------------------\r
-# Else (consider that version matches 'X.X')\r
-#---------------------------------\r
-ELSE(${NLOPT_AUTOMAKE_LINE_VERSION} MATCHES ".*[0-9]+\\.[0-9]+\\.[0-9]+")\r
- STRING( REGEX REPLACE ".*([0-9]+)\\.[0-9]+.*" "\\1" NLOPT_MAJOR_VERSION "${NLOPT_AUTOMAKE_LINE_VERSION}") \r
- STRING( REGEX REPLACE ".*[0-9]+\\.([0-9]+).*" "\\1" NLOPT_MINOR_VERSION "${NLOPT_AUTOMAKE_LINE_VERSION}") \r
- SET (NLOPT_BUGFIX_VERSION "0")\r
-ENDIF(${NLOPT_AUTOMAKE_LINE_VERSION} MATCHES ".*[0-9]+\\.[0-9]+\\.[0-9]+")\r
+option (WITH_THREADLOCAL "check thread local keyword" ON)\r
+if (WITH_THREADLOCAL AND NOT DEFINED HAVE_THREAD_LOCAL_STORAGE)\r
+ foreach (_THREADLOCAL_KEY "__thread" "__declspec(thread)")\r
+ unset (HAVE_THREAD_LOCAL_STORAGE CACHE)\r
+ check_c_source_compiles("\r
+ ${_THREADLOCAL_KEY} int tls;\r
\r
-MESSAGE(STATUS "NLOPT: Version number ${NLOPT_MAJOR_VERSION}.${NLOPT_MINOR_VERSION}.${NLOPT_BUGFIX_VERSION} found in configure.ac" )\r
+ int main(void) {\r
+ return 0;\r
+ }" HAVE_THREAD_LOCAL_STORAGE)\r
+ if (${HAVE_THREAD_LOCAL_STORAGE})\r
+ set (THREADLOCAL ${_THREADLOCAL_KEY})\r
+ endif ()\r
+ endforeach()\r
+endif ()\r
\r
+#==============================================================================\r
+# version\r
+#==============================================================================\r
+set (NLOPT_MAJOR_VERSION "2")\r
+set (NLOPT_MINOR_VERSION "5")\r
+set (NLOPT_BUGFIX_VERSION "0")\r
+set (NLOPT_VERSION_STRING ${NLOPT_MAJOR_VERSION}.${NLOPT_MINOR_VERSION}.${NLOPT_BUGFIX_VERSION})\r
+message (STATUS "NLopt version ${NLOPT_VERSION_STRING}")\r
\r
#==============================================================================\r
# CREATE config.h\r
#==============================================================================\r
\r
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h IMMEDIATE )\r
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h IMMEDIATE)\r
\r
+# pkgconfig file\r
+if (UNIX OR MINGW)\r
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/nlopt.pc.in ${CMAKE_CURRENT_BINARY_DIR}/nlopt.pc @ONLY)\r
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/nlopt.pc DESTINATION ${RELATIVE_INSTALL_LIB_DIR}/pkgconfig)\r
+endif ()\r
\r
#==============================================================================\r
# INCLUDE DIRECTORIES\r
#==============================================================================\r
-SET(${INCLUDE_DIRECTORIES} "")\r
-INCLUDE_DIRECTORIES (\r
- ${CMAKE_CURRENT_SOURCE_DIR}\r
- ${CMAKE_CURRENT_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
- slsqp\r
- esch\r
- api )\r
+set (${INCLUDE_DIRECTORIES} "")\r
+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
+ slsqp\r
+ esch\r
+ api)\r
\r
\r
#==============================================================================\r
#==============================================================================\r
\r
SET ( NLOPT_HEADERS \r
- api/nlopt.h api/nlopt.hpp api/nlopt.f\r
+ api/nlopt.h ${CMAKE_BINARY_DIR}/api/nlopt.hpp ${CMAKE_BINARY_DIR}/api/nlopt.f\r
)\r
\r
SET ( NLOPT_SOURCES \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
- 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
)\r
\r
-OPTION(BUILD_SHARED_LIBS "Build NLOPT as a shared library" OFF )\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
+endif ()\r
+\r
\r
if (BUILD_SHARED_LIBS)\r
- ADD_DEFINITIONS(-DNLOPT_DLL)\r
- ADD_DEFINITIONS(-DNLOPT_DLL_EXPORT )\r
- \r
- if (NOT CMAKE_INSTALL_PREFIX MATCHES "^/usr")\r
- set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})\r
- set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)\r
- endif ()\r
+ add_definitions (-DNLOPT_DLL)\r
+ add_definitions (-DNLOPT_DLL_EXPORT)\r
endif ()\r
\r
-INSTALL ( FILES ${NLOPT_HEADERS} DESTINATION include )\r
+install (FILES ${NLOPT_HEADERS} DESTINATION include)\r
\r
-ADD_LIBRARY (nlopt ${NLOPT_SOURCES} )\r
+set (nlopt_lib nlopt${NLOPT_SUFFIX})\r
+add_library (${nlopt_lib} ${NLOPT_SOURCES})\r
+set_target_properties (${nlopt_lib} PROPERTIES SOVERSION 0)\r
+set_target_properties (${nlopt_lib} PROPERTIES VERSION 0.9.0)\r
\r
-# parse configure.ac for lib version\r
-STRING( REGEX MATCH "SHARED_VERSION_INFO=\"[0-9]+:[0-9]+:[0-9]+\"" _VERSION_INFO_LINE "${CONFIG_AUTOMAKE}") \r
-IF (_VERSION_INFO_LINE)\r
- STRING( REGEX REPLACE "SHARED_VERSION_INFO=\"([0-9]+):[0-9]+:[0-9]+\"" "\\1" _VERSION_INFO_CURRENT "${_VERSION_INFO_LINE}") \r
- STRING( REGEX REPLACE "SHARED_VERSION_INFO=\"[0-9]+:([0-9]+):[0-9]+\"" "\\1" _VERSION_INFO_REVISION "${_VERSION_INFO_LINE}") \r
- STRING( REGEX REPLACE "SHARED_VERSION_INFO=\"[0-9]+:[0-9]+:([0-9]+)\"" "\\1" _VERSION_INFO_AGE "${_VERSION_INFO_LINE}") \r
- MATH(EXPR _INFO_SOVERSION "${_VERSION_INFO_CURRENT} - ${_VERSION_INFO_AGE} ")\r
- SET(_INFO_VERSION "${_INFO_SOVERSION}.${_VERSION_INFO_AGE}.${_VERSION_INFO_REVISION}")\r
- SET_TARGET_PROPERTIES(nlopt PROPERTIES SOVERSION ${_INFO_SOVERSION})\r
- SET_TARGET_PROPERTIES(nlopt PROPERTIES VERSION ${_INFO_VERSION} )\r
-ENDIF ()\r
+# pass -fPIC in case swig module is built with static library\r
+if (NOT BUILD_SHARED_LIBS)\r
+ check_c_compiler_flag (-fPIC HAS_FPIC)\r
+ if (HAS_FPIC)\r
+ set (CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")\r
+ set (CMAKE_CXX_FLAGS "-fPIC ${CMAKE_CXX_FLAGS}")\r
+ endif ()\r
+endif ()\r
\r
-INSTALL ( TARGETS nlopt\r
- RUNTIME DESTINATION bin\r
- LIBRARY DESTINATION lib${LIB_SUFFIX}\r
- ARCHIVE DESTINATION lib${LIB_SUFFIX}\r
+install ( TARGETS ${nlopt_lib}\r
+ EXPORT NLoptLibraryDepends\r
+ RUNTIME DESTINATION ${RELATIVE_INSTALL_BIN_DIR}\r
+ LIBRARY DESTINATION ${RELATIVE_INSTALL_LIB_DIR}\r
+ ARCHIVE DESTINATION ${RELATIVE_INSTALL_LIB_DIR}\r
)\r
\r
+add_subdirectory (api)\r
+\r
+if (BUILD_PYTHON)\r
+ find_package (PythonInterp)\r
+ find_package (PythonLibs)\r
+ find_package (NumPy)\r
+endif ()\r
+\r
+if (PYTHONINTERP_FOUND)\r
+ execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))"\r
+ OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH\r
+ OUTPUT_STRIP_TRAILING_WHITESPACE )\r
+\r
+ get_filename_component (_ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE)\r
+ file (RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH})\r
+\r
+ set (PYTHON_MODULE_PATH ${_REL_PYTHON_MODULE_PATH})\r
+\r
+endif ()\r
+\r
+if (BUILD_GUILE)\r
+ find_package (Guile)\r
+endif ()\r
+\r
+if (USE_SWIG)\r
+ find_package (SWIG)\r
+endif ()\r
+\r
add_subdirectory (swig)\r
+\r
+if (BUILD_OCTAVE)\r
+ find_package (Octave)\r
+endif ()\r
+\r
+if (OCTAVE_FOUND)\r
+ add_subdirectory (octave)\r
+endif ()\r
+\r
+enable_testing ()\r
+add_subdirectory (test)\r
+\r
+set (CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")\r
+set (CPACK_PACKAGE_VERSION_MAJOR "${NLOPT_MAJOR_VERSION}")\r
+set (CPACK_PACKAGE_VERSION_MINOR "${NLOPT_MINOR_VERSION}")\r
+set (CPACK_PACKAGE_VERSION_PATCH "${NLOPT_BUGFIX_VERSION}")\r
+set (CPACK_SOURCE_GENERATOR "TBZ2;TGZ" )\r
+set (CPACK_BINARY_STGZ "OFF" )\r
+set (CPACK_BINARY_TBZ2 "ON" )\r
+set (CPACK_BINARY_TGZ "ON" )\r
+set (CPACK_BINARY_TZ "OFF" )\r
+set (CPACK_SOURCE_IGNORE_FILES ".git;/build;.*~;${CPACK_SOURCE_IGNORE_FILES}")\r
+\r
+set (CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${NLOPT_VERSION_STRING})\r
+\r
+include (CPack)\r
+\r
+# configuration files\r
+export (TARGETS ${nlopt_lib} FILE ${PROJECT_BINARY_DIR}/NLoptLibraryDepends.cmake)\r
+\r
+# Install the export set for use with the install-tree\r
+install(EXPORT NLoptLibraryDepends\r
+ DESTINATION ${RELATIVE_INSTALL_CMAKE_DIR}\r
+ COMPONENT Development)\r
+\r
+# Create a NLOPTConfig.cmake file for the use from the install tree\r
+# and install it\r
+set (NLOPT_LIBRARIES ${nlopt_lib})\r
+\r
+set (NLOPT_CMAKE_DIR "${INSTALL_CMAKE_DIR}")\r
+file (RELATIVE_PATH rel_include_dir "${NLOPT_CMAKE_DIR}" "${INSTALL_INCLUDE_DIR}")\r
+list (APPEND RELATIVE_NLOPT_INCLUDE_DIRS ${rel_include_dir})\r
+\r
+file (RELATIVE_PATH rel_lib_dir "${NLOPT_CMAKE_DIR}" "${INSTALL_LIB_DIR}")\r
+list (APPEND RELATIVE_NLOPT_LIB_DIR ${rel_lib_dir})\r
+\r
+configure_file (cmake/NLoptConfig.cmake.in NLoptConfig.cmake @ONLY)\r
+configure_file (cmake/NLoptConfigVersion.cmake.in NLoptConfigVersion.cmake @ONLY)\r
+install (FILES\r
+ ${CMAKE_CURRENT_BINARY_DIR}/NLoptConfig.cmake\r
+ ${CMAKE_CURRENT_BINARY_DIR}/NLoptConfigVersion.cmake\r
+ DESTINATION ${RELATIVE_INSTALL_CMAKE_DIR}\r
+ COMPONENT Development)\r
+\r
+++ /dev/null
-OPTIONS_AUTOMAKE=gnu
-lib_LTLIBRARIES = libnlopt@NLOPT_SUFFIX@.la
-
-ACLOCAL_AMFLAGS=-I m4
-
-if WITH_CXX
-CXX_DIRS = stogo
-CXX_LIBS = stogo/libstogo.la
-endif
-
-SUBDIRS = util direct cdirect $(CXX_DIRS) praxis luksan crs mlsl mma cobyla newuoa neldermead auglag bobyqa isres slsqp esch api . octave test swig
-EXTRA_DIST = autogen.sh nlopt.pc.in m4 CMakeLists.txt config.cmake.h.in
-
-libnlopt@NLOPT_SUFFIX@_la_SOURCES =
-if WITH_CXX
-# Dummy C++ source to cause C++ linking
-nodist_EXTRA_libnlopt@NLOPT_SUFFIX@_la_SOURCES = dummy.cxx
-endif
-libnlopt@NLOPT_SUFFIX@_la_LIBADD = direct/libdirect.la \
-cdirect/libcdirect.la $(CXX_LIBS) praxis/libpraxis.la \
-luksan/libluksan.la crs/libcrs.la mlsl/libmlsl.la mma/libmma.la \
-cobyla/libcobyla.la newuoa/libnewuoa.la neldermead/libneldermead.la \
-auglag/libauglag.la bobyqa/libbobyqa.la isres/libisres.la \
-slsqp/libslsqp.la esch/libesch.la api/libapi.la util/libutil.la
-
-libnlopt@NLOPT_SUFFIX@_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = nlopt.pc
-
-if MAINTAINER_MODE
-
-README: README.md
- cp -f $(srcdir)/README.md $@
-
-endif
The latest release and a complete manual may be found at the NLopt
home page: http://ab-initio.mit.edu/nlopt
-It is compiled and installed with the standard GNU autoconf/automake
-commands:
+It is compiled and installed with CMake build system:
- ./configure
- make
+ cmake .
make install
See `./configure --help` or the `INSTALL` file for other options. To
git clone git://github.com/stevengj/nlopt
cd nlopt
- sh autogen.sh
+ cmake .
make
-(To build from git, you will need GNU autoconf, automake, and libtool
-installed, along with SWIG and Unix tools such as m4, perl, and sed.)
+(To build from git, you will need SWIG.)
Once it is installed, `#include <nlopt.h>` in your C/C++ programs and
link it with `-lnlopt -lm`. You may need to use the C++ compiler to link
--- /dev/null
+
+# install man
+if (UNIX)
+ install (FILES nlopt.3 DESTINATION share/man/man3)
+endif ()
+
+# generate nlopt.f from nlopt.h enums
+if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/nlopt.f)
+ file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/nlopt.f "")
+ file (STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt.h NLOPT_H_LINES REGEX " NLOPT_[A-Z0-9_]+")
+ set (i 0)
+ foreach (NLOPT_H_LINE ${NLOPT_H_LINES})
+ if (NOT NLOPT_H_LINE MATCHES "NLOPT_NUM_")
+ string (REGEX REPLACE ".*NLOPT_([A-Z0-9_]+).*" "\\1" ENUM_STRING ${NLOPT_H_LINE})
+ string (REGEX REPLACE ".*NLOPT_[A-Z0-9_]+ = (-?[0-9]+).*" "\\1" ENUM_VAL ${NLOPT_H_LINE})
+ if (ENUM_VAL MATCHES "^-?[0-9]+$")
+ set (i ${ENUM_VAL})
+ endif ()
+ set (ENUM_LINE " integer NLOPT_${ENUM_STRING}\n parameter (NLOPT_${ENUM_STRING}=${i})\n")
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.f "${ENUM_LINE}")
+
+ # https://public.kitware.com/Bug/print_bug_page.php?bug_id=8996
+ if (i MATCHES "^-")
+ math (EXPR i "1 ${i}")
+ else ()
+ math (EXPR i "${i} + 1")
+ endif ()
+ endif ()
+ endforeach ()
+endif ()
+
+# generate nlopt.hpp from nlopt-in.hpp
+if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp)
+ file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp "")
+ file (STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-in.hpp NLOPT_HPP_LINES)
+ foreach (NLOPT_HPP_LINE ${NLOPT_HPP_LINES})
+ list(LENGTH NLOPT_HPP_LINE line_len)
+ # handling trailing backlashes in "file (STRINGS" is a little tricky
+ if (line_len VERSION_LESS 8)
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp "${NLOPT_HPP_LINE}\n")
+ else ()
+ set (prev_inst FALSE)
+ foreach(NLOPT_HPP_SUBLINE ${NLOPT_HPP_LINE})
+ # test is we need to add the eaten semicolon
+ if (NLOPT_HPP_SUBLINE MATCHES "\\)$" OR NLOPT_HPP_SUBLINE MATCHES "return")
+ set (new_inst TRUE)
+ else ()
+ set (new_inst FALSE)
+ endif ()
+ if (NOT prev_inst)
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp "${NLOPT_HPP_SUBLINE}")
+ if (new_inst)
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp ";")
+ endif ()
+ list (FIND NLOPT_HPP_LINE "${NLOPT_HPP_SUBLINE}" index)
+ math (EXPR index "${index} + 1")
+ list (LENGTH NLOPT_HPP_LINE total)
+ if (NOT index STREQUAL total)
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp " \\")
+ endif ()
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp "\n")
+ endif ()
+ set (prev_inst ${new_inst})
+ endforeach ()
+ endif ()
+ if (NLOPT_HPP_LINE MATCHES "GEN_ENUMS_HERE")
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp " enum algorithm {\n")
+ file (STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt.h NLOPT_H_LINES REGEX " NLOPT_[A-Z0-9_]+")
+ foreach (NLOPT_H_LINE ${NLOPT_H_LINES})
+ string (REGEX REPLACE "NLOPT_" "" ENUM_LINE ${NLOPT_H_LINE})
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp "${ENUM_LINE}\n")
+ if (NLOPT_H_LINE MATCHES "NLOPT_NUM_ALGORITHMS")
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp " };\n enum result {\n")
+ elseif (NLOPT_H_LINE MATCHES "NLOPT_MAXTIME_REACHED")
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt.hpp " };\n")
+ endif ()
+ endforeach ()
+ endif ()
+ endforeach ()
+endif ()
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/cdirect -I$(top_srcdir)/direct -I$(top_srcdir)/stogo -I$(top_srcdir)/praxis -I$(top_srcdir)/lbfgs -I$(top_srcdir)/luksan -I$(top_srcdir)/crs -I$(top_srcdir)/mlsl -I$(top_srcdir)/mma -I$(top_srcdir)/cobyla -I$(top_srcdir)/newuoa -I$(top_srcdir)/neldermead -I$(top_srcdir)/auglag -I$(top_srcdir)/bobyqa -I$(top_srcdir)/isres -I$(top_srcdir)/slsqp -I$(top_srcdir)/esch -I$(top_srcdir)/util
-
-include_HEADERS = nlopt.h nlopt.f nlopt.hpp
-noinst_LTLIBRARIES = libapi.la
-dist_man_MANS = nlopt.3
-
-libapi_la_SOURCES = general.c options.c optimize.c deprecated.c \
-nlopt-internal.h nlopt.h f77api.c f77funcs.h f77funcs_.h
-
-BUILT_SOURCES = nlopt.f nlopt.hpp
-EXTRA_DIST = nlopt-in.hpp
-
-if MAINTAINER_MODE
-# convert constants to F77 parameter statements & C++
-
-nlopt.f: nlopt.h
- rm -f $@
- (i=0; egrep 'NLOPT_[LG][DN]|NLOPT_AUGLAG|NLOPT_G_MLSL' $(srcdir)/nlopt.h | tr -d ' =0,' | while read n; do echo " integer $$n"; echo " parameter ($$n=$$i)"; i=`expr $$i + 1`; done; tail -n +`grep -n enum $(srcdir)/nlopt.h |cut -d: -f1 |tail -n 1` $(srcdir)/nlopt.h | grep NLOPT | egrep -v 'EXTERN|DEPRECATED|MINF_MAX' | cut -d, -f1 | tr -d ' ' | perl -pe 's/([A-Za-z0-9_]+)=([-+0-9]+)/ integer \1\n parameter (\1=\2)/') > $(srcdir)/$@
-
-nlopt.hpp: nlopt.h nlopt-in.hpp
- rm -f $@
- (n=`grep -n GEN_ENUMS_HERE $(srcdir)/nlopt-in.hpp | cut -d: -f1`; head -n $$n $(srcdir)/nlopt-in.hpp; echo " enum algorithm {"; egrep 'NLOPT_[LG][DN]|NLOPT_AUGLAG|NLOPT_G_MLSL|NLOPT_NUM_ALGORITHMS' $(srcdir)/nlopt.h | sed 's/NLOPT_//g'; echo " };"; echo " enum result {"; egrep 'NLOPT_[A-Z_]* =' $(srcdir)/nlopt.h | egrep -v 'NLOPT_[LG][DN]' | sed 's/NLOPT_//g'; echo " };"; tail -n +$$n $(srcdir)/nlopt-in.hpp) > $(srcdir)/$@
-
-endif
--- /dev/null
+version: 1.0.{build}
+os: Visual Studio 2015
+clone_folder: C:\projects\nlopt
+test: off
+configuration:
+ - Release
+branches:
+ only:
+ - master
+environment:
+ matrix:
+ - CMAKE_PLATFORM: "Visual Studio 14 2015"
+ - CMAKE_PLATFORM: "Visual Studio 14 2015 Win64"
+#install:
+ #- cinstall: python
+ #- choco install swig
+build_script:
+ - echo Running cmake...
+ - cd c:\projects\nlopt
+ - cmake -G "%CMAKE_PLATFORM%" -DBUILD_SHARED_LIBS=OFF -DWITH_CXX=ON -DCMAKE_INSTALL_PREFIX="C:\projects\nlopt\install" .
+ - cmake --build . --config %Configuration% --target install
+ - cmake --build . --config %Configuration% --target tests
+ - ctest -C %Configuration% --output-on-failure --timeout 100
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libauglag.la
-libauglag_la_SOURCES = auglag.c auglag.h
-
-EXTRA_DIST = README
+++ /dev/null
-#!/bin/sh
-
-configure_args=""
-configure="yes"
-
-while test $# -ge 1; do
- case $1 in
- --verbose) verbose=yes ;;
- --enable-*) configure_args="$configure_args $1" ;;
- --disable-*) configure_args="$configure_args $1" ;;
- --with-*) configure_args="$configure_args $1" ;;
- --without-*) configure_args="$configure_args $1" ;;
- --no-configure) configure="no" ;;
- *) echo "unknown argument $1"; exit 1 ;;
- esac
- shift
-done
-
-touch swig/nlopt.scm.in
-
-cp README.md README
-
-# paranoia: sometimes autoconf doesn't get things right the first time
-autoreconf --verbose --install --symlink --force
-autoreconf --verbose --install --symlink --force
-autoreconf --verbose --install --symlink --force
-
-if test "$configure" = "yes"
-then
- config=good # hackery so darcs_test still outputs config.log w/failed configure
-
- ./configure --enable-maintainer-mode $configure_args || config=bad
-
- if test x$verbose = xyes; then
- cat config.log
- fi
-
- test $config = bad && exit 1
-fi
\ No newline at end of file
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libbobyqa.la
-libbobyqa_la_SOURCES = bobyqa.c bobyqa.h
-
-EXTRA_DIST = README README.orig COPYRIGHT
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libcdirect.la
-libcdirect_la_SOURCES = cdirect.c hybrid.c cdirect.h
-
-EXTRA_DIST = README
--- /dev/null
+# Copyright (c) 2008, 2014 OpenCog.org (http://opencog.org)
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+# - Try to find Guile; Once done this will define
+#
+# GUILE_FOUND - system has the GUILE library
+# GUILE_INCLUDE_DIRS - the GUILE include directory
+# GUILE_LIBRARIES - The libraries needed to use GUILE
+# GUILE_VERSION_STRING - Version
+# GUILE_SITE_DIR - site dir
+# GUILE_EXTENSION_DIR - extension dir
+# GUILE_ROOT_DIR - prefix dir
+
+# Look for the header file
+# Look for guile-2.2 first, then 2.0, then 1.8
+# Macports for OSX puts things in /opt/local
+find_path (GUILE_INCLUDE_DIR libguile.h
+ PATH_SUFFIXES
+ guile/2.2
+ guile/2.0
+ guile/1.8
+ libguile
+ guile
+ HINTS /opt/local/include
+)
+
+# Look for the library
+find_library (GUILE_LIBRARY NAMES guile-2.2 guile-2.0 guile
+ HINTS
+ /opt/local/lib
+)
+
+
+set (GUILE_LIBRARIES ${GUILE_LIBRARY})
+set (GUILE_INCLUDE_DIRS ${GUILE_INCLUDE_DIR})
+
+
+# check guile's version if we're using cmake >= 2.6
+if (GUILE_INCLUDE_DIR)
+ SET(GUILE_VERSION_MAJOR 0)
+ SET(GUILE_VERSION_MINOR 0)
+ SET(GUILE_VERSION_PATCH 0)
+
+ IF(NOT EXISTS "${GUILE_INCLUDE_DIR}/libguile/version.h")
+ MESSAGE(FATAL_ERROR "Found ${GUILE_INCLUDE_DIR}/libguile.h but not version.h; check your guile installation!")
+ ENDIF(NOT EXISTS "${GUILE_INCLUDE_DIR}/libguile/version.h")
+
+ # Extract the libguile version from the 'version.h' file
+ SET(GUILE_MAJOR_VERSION 0)
+ FILE(READ "${GUILE_INCLUDE_DIR}/libguile/version.h" _GUILE_VERSION_H_CONTENTS)
+
+ STRING(REGEX MATCH "#define SCM_MAJOR_VERSION[ ]+([0-9])" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
+ SET(GUILE_VERSION_MAJOR ${CMAKE_MATCH_1})
+ STRING(REGEX MATCH "#define SCM_MINOR_VERSION[ ]+([0-9]+)" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
+ SET(GUILE_VERSION_MINOR ${CMAKE_MATCH_1})
+ STRING(REGEX MATCH "#define SCM_MICRO_VERSION[ ]+([0-9]+)" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
+ SET(GUILE_VERSION_PATCH ${CMAKE_MATCH_1})
+
+ SET(GUILE_VERSION_STRING "${GUILE_VERSION_MAJOR}.${GUILE_VERSION_MINOR}.${GUILE_VERSION_PATCH}")
+
+endif ()
+
+find_program(GUILE_CONFIG_EXECUTABLE
+ NAMES guile-config
+ )
+
+
+if (GUILE_CONFIG_EXECUTABLE)
+ execute_process (COMMAND ${GUILE_CONFIG_EXECUTABLE} info prefix
+ OUTPUT_VARIABLE GUILE_ROOT_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${GUILE_CONFIG_EXECUTABLE} info sitedir
+ OUTPUT_VARIABLE GUILE_SITE_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${GUILE_CONFIG_EXECUTABLE} info extensiondir
+ OUTPUT_VARIABLE GUILE_EXTENSION_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif ()
+
+# IF(GUILE_FOUND AND GUILE_VERSION_MAJOR EQUAL 2)
+# ADD_DEFINITIONS(-DHAVE_GUILE2)
+# ENDIF(GUILE_FOUND AND GUILE_VERSION_MAJOR EQUAL 2)
+
+# handle REQUIRED and QUIET options
+include (FindPackageHandleStandardArgs)
+if (CMAKE_VERSION LESS 2.8.3)
+ find_package_handle_standard_args (Guile DEFAULT_MSG GUILE_ROOT_DIR GUILE_INCLUDE_DIRS GUILE_LIBRARIES GUILE_VERSION_STRING)
+else ()
+ find_package_handle_standard_args (Guile REQUIRED_VARS GUILE_ROOT_DIR GUILE_INCLUDE_DIRS GUILE_LIBRARIES VERSION_VAR GUILE_VERSION_STRING)
+endif ()
+
+
+MARK_AS_ADVANCED(GUILE_INCLUDE_DIR GUILE_LIBRARY)
--- /dev/null
+# - Find the NumPy libraries
+# This module finds if NumPy is installed, and sets the following variables
+# indicating where it is.
+#
+# TODO: Update to provide the libraries and paths for linking npymath lib.
+#
+# NUMPY_FOUND - was NumPy found
+# NUMPY_VERSION - the version of NumPy found as a string
+# NUMPY_VERSION_MAJOR - the major version number of NumPy
+# NUMPY_VERSION_MINOR - the minor version number of NumPy
+# NUMPY_VERSION_PATCH - the patch version number of NumPy
+# NUMPY_VERSION_DECIMAL - e.g. version 1.6.1 is 10601
+# NUMPY_INCLUDE_DIRS - path to the NumPy include files
+
+#============================================================================
+# Copyright 2012 Continuum Analytics, Inc.
+#
+# MIT License
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files
+# (the "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to permit
+# persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+#============================================================================
+
+# Finding NumPy involves calling the Python interpreter
+if(NumPy_FIND_REQUIRED)
+ find_package(PythonInterp REQUIRED)
+else()
+ find_package(PythonInterp)
+endif()
+
+if(NOT PYTHONINTERP_FOUND)
+ set(NUMPY_FOUND FALSE)
+ return()
+endif()
+
+execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
+ "import numpy as n; print(n.__version__); print(n.get_include());"
+ RESULT_VARIABLE _NUMPY_SEARCH_SUCCESS
+ OUTPUT_VARIABLE _NUMPY_VALUES_OUTPUT
+ ERROR_VARIABLE _NUMPY_ERROR_VALUE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+if(NOT _NUMPY_SEARCH_SUCCESS MATCHES 0)
+ if(NumPy_FIND_REQUIRED)
+ message(FATAL_ERROR
+ "NumPy import failure:\n${_NUMPY_ERROR_VALUE}")
+ endif()
+ set(NUMPY_FOUND FALSE)
+ return()
+endif()
+
+# Convert the process output into a list
+string(REGEX REPLACE ";" "\\\\;" _NUMPY_VALUES ${_NUMPY_VALUES_OUTPUT})
+string(REGEX REPLACE "\n" ";" _NUMPY_VALUES ${_NUMPY_VALUES})
+list(GET _NUMPY_VALUES 0 NUMPY_VERSION)
+list(GET _NUMPY_VALUES 1 NUMPY_INCLUDE_DIRS)
+
+string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" _VER_CHECK "${NUMPY_VERSION}")
+if("${_VER_CHECK}" STREQUAL "")
+ # The output from Python was unexpected. Raise an error always
+ # here, because we found NumPy, but it appears to be corrupted somehow.
+ message(FATAL_ERROR
+ "Requested version and include path from NumPy, got instead:\n${_NUMPY_VALUES_OUTPUT}\n")
+ return()
+endif()
+
+# Make sure all directory separators are '/'
+string(REGEX REPLACE "\\\\" "/" NUMPY_INCLUDE_DIRS ${NUMPY_INCLUDE_DIRS})
+
+# Get the major and minor version numbers
+string(REGEX REPLACE "\\." ";" _NUMPY_VERSION_LIST ${NUMPY_VERSION})
+list(GET _NUMPY_VERSION_LIST 0 NUMPY_VERSION_MAJOR)
+list(GET _NUMPY_VERSION_LIST 1 NUMPY_VERSION_MINOR)
+list(GET _NUMPY_VERSION_LIST 2 NUMPY_VERSION_PATCH)
+string(REGEX MATCH "[0-9]*" NUMPY_VERSION_PATCH ${NUMPY_VERSION_PATCH})
+math(EXPR NUMPY_VERSION_DECIMAL
+ "(${NUMPY_VERSION_MAJOR} * 10000) + (${NUMPY_VERSION_MINOR} * 100) + ${NUMPY_VERSION_PATCH}")
+
+find_package_message(NUMPY
+ "Found NumPy: version \"${NUMPY_VERSION}\" ${NUMPY_INCLUDE_DIRS}"
+ "${NUMPY_INCLUDE_DIRS}${NUMPY_VERSION}")
+
+set(NUMPY_FOUND TRUE)
--- /dev/null
+# - Find Octave
+# GNU Octave is a high-level interpreted language, primarily intended for numerical computations.
+# available at http://www.gnu.org/software/octave/
+#
+# This module defines:
+# OCTAVE_EXECUTABLE - octave interpreter
+# OCTAVE_INCLUDE_DIRS - include path for mex.h, mexproto.h
+# OCTAVE_LIBRARIES - required libraries: octinterp, octave, cruft
+# OCTAVE_OCTINTERP_LIBRARY - path to the library octinterp
+# OCTAVE_OCTAVE_LIBRARY - path to the library octave
+# OCTAVE_CRUFT_LIBRARY - path to the library cruft
+# OCTAVE_VERSION_STRING - octave version string
+# OCTAVE_MAJOR_VERSION - major version
+# OCTAVE_MINOR_VERSION - minor version
+# OCTAVE_PATCH_VERSION - patch version
+# OCTAVE_OCT_FILE_DIR - object files that will be dynamically loaded
+# OCTAVE_OCT_LIB_DIR - oct libraries
+# OCTAVE_ROOT_DIR - octave prefix
+# OCTAVE_M_SITE_DIR - .m files site dir
+# OCTAVE_OCT_SITE_DIR - .oct files site dir
+#
+# The macro octave_add_oct allows to create compiled modules.
+# octave_add_oct (target_name
+# [SOURCES] source1 [source2 ...]
+# [LINK_LIBRARIES lib1 [lib2 ...]]
+# [EXTENSION ext]
+#)
+#
+# To install it, you can the use the variable OCTAVE_OCT_FILE_DIR as follow:
+# file (RELATIVE_PATH PKG_OCTAVE_OCT_SITE_DIR ${OCTAVE_ROOT_DIR} ${OCTAVE_OCT_SITE_DIR})
+# install (
+# TARGETS target_name
+# DESTINATION ${PKG_OCTAVE_OCT_SITE_DIR}
+#)
+
+
+#=============================================================================
+# Copyright 2013, Julien Schueller
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# The views and conclusions contained in the software and documentation are those
+# of the authors and should not be interpreted as representing official policies,
+# either expressed or implied, of the FreeBSD Project.
+#=============================================================================
+
+find_program(OCTAVE_CONFIG_EXECUTABLE
+ NAMES octave-config
+ )
+
+
+if (OCTAVE_CONFIG_EXECUTABLE)
+ execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} -p PREFIX
+ OUTPUT_VARIABLE OCTAVE_ROOT_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} --m-site-dir
+ OUTPUT_VARIABLE OCTAVE_M_SITE_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} --oct-site-dir
+ OUTPUT_VARIABLE OCTAVE_OCT_SITE_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} -p BINDIR
+ OUTPUT_VARIABLE OCTAVE_BIN_PATHS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} -p OCTINCLUDEDIR
+ OUTPUT_VARIABLE OCTAVE_INCLUDE_PATHS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} -p OCTLIBDIR
+ OUTPUT_VARIABLE OCTAVE_LIBRARIES_PATHS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} -p OCTFILEDIR
+ OUTPUT_VARIABLE OCTAVE_OCT_FILE_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} -p OCTLIBDIR
+ OUTPUT_VARIABLE OCTAVE_OCT_LIB_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ execute_process (COMMAND ${OCTAVE_CONFIG_EXECUTABLE} -v
+ OUTPUT_VARIABLE OCTAVE_VERSION_STRING
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if (OCTAVE_VERSION_STRING)
+ string (REGEX REPLACE "([0-9]+)\\..*" "\\1" OCTAVE_MAJOR_VERSION ${OCTAVE_VERSION_STRING})
+ string (REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" OCTAVE_MINOR_VERSION ${OCTAVE_VERSION_STRING})
+ string (REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" OCTAVE_PATCH_VERSION ${OCTAVE_VERSION_STRING})
+ endif ()
+endif ()
+
+
+find_program(OCTAVE_EXECUTABLE
+ HINTS ${OCTAVE_BIN_PATHS}
+ NAMES octave
+ )
+
+find_program(OCTAVE_MKOCTFILE
+ HINTS ${OCTAVE_BIN_PATHS}
+ NAMES mkoctfile
+ )
+
+find_library(OCTAVE_OCTINTERP_LIBRARY
+ NAMES octinterp liboctinterp
+ HINTS ${OCTAVE_LIBRARIES_PATHS}
+ )
+find_library(OCTAVE_OCTAVE_LIBRARY
+ NAMES octave liboctave
+ HINTS ${OCTAVE_LIBRARIES_PATHS}
+ )
+find_library(OCTAVE_CRUFT_LIBRARY
+ NAMES cruft libcruft
+ HINTS ${OCTAVE_LIBRARIES_PATHS}
+ )
+
+set (OCTAVE_LIBRARIES ${OCTAVE_OCTINTERP_LIBRARY})
+list (APPEND OCTAVE_LIBRARIES ${OCTAVE_OCTAVE_LIBRARY})
+if (OCTAVE_CRUFT_LIBRARY)
+ list (APPEND OCTAVE_LIBRARIES ${OCTAVE_CRUFT_LIBRARY})
+endif ()
+
+find_path (OCTAVE_INCLUDE_DIR
+ NAMES octave/oct.h
+ PATHS "${OCTAVE_INCLUDE_PATHS}/.."
+ )
+
+set (OCTAVE_INCLUDE_DIRS ${OCTAVE_INCLUDE_DIR})
+
+
+macro (octave_add_oct FUNCTIONNAME)
+ set (_CMD SOURCES)
+ set (_SOURCES)
+ set (_LINK_LIBRARIES)
+ set (_EXTENSION)
+ set (_OCT_EXTENSION oct)
+ foreach (_ARG ${ARGN})
+ if (${_ARG} MATCHES SOURCES)
+ set (_CMD SOURCES)
+ elseif (${_ARG} MATCHES LINK_LIBRARIES)
+ set (_CMD LINK_LIBRARIES)
+ elseif (${_ARG} MATCHES EXTENSION)
+ set (_CMD EXTENSION)
+ else ()
+ if (${_CMD} MATCHES SOURCES)
+ list (APPEND _SOURCES "${_ARG}")
+ elseif (${_CMD} MATCHES LINK_LIBRARIES)
+ list (APPEND _LINK_LIBRARIES "${_ARG}")
+ elseif (${_CMD} MATCHES EXTENSION)
+ set (_OCT_EXTENSION ${_ARG})
+ endif ()
+ endif ()
+ endforeach ()
+ add_library (${FUNCTIONNAME} SHARED ${_SOURCES})
+ target_link_libraries (${FUNCTIONNAME} ${OCTAVE_LIBRARIES} ${_LINK_LIBRARIES})
+ set_target_properties (${FUNCTIONNAME} PROPERTIES
+ PREFIX ""
+ SUFFIX ".${_OCT_EXTENSION}"
+)
+endmacro ()
+
+
+# handle REQUIRED and QUIET options
+include (FindPackageHandleStandardArgs)
+if (CMAKE_VERSION LESS 2.8.3)
+ find_package_handle_standard_args (Octave DEFAULT_MSG OCTAVE_EXECUTABLE OCTAVE_ROOT_DIR OCTAVE_INCLUDE_DIRS OCTAVE_LIBRARIES OCTAVE_VERSION_STRING)
+else ()
+ find_package_handle_standard_args (Octave REQUIRED_VARS OCTAVE_EXECUTABLE OCTAVE_ROOT_DIR OCTAVE_INCLUDE_DIRS OCTAVE_LIBRARIES VERSION_VAR OCTAVE_VERSION_STRING)
+endif ()
+
+
+mark_as_advanced (
+ OCTAVE_OCT_FILE_DIR
+ OCTAVE_OCT_LIB_DIR
+ OCTAVE_OCTINTERP_LIBRARY
+ OCTAVE_OCTAVE_LIBRARY
+ OCTAVE_CRUFT_LIBRARY
+ OCTAVE_LIBRARIES
+ OCTAVE_INCLUDE_DIR
+ OCTAVE_INCLUDE_DIRS
+ OCTAVE_ROOT_DIR
+ OCTAVE_VERSION_STRING
+ OCTAVE_MAJOR_VERSION
+ OCTAVE_MINOR_VERSION
+ OCTAVE_PATCH_VERSION
+)
+
+
+
--- /dev/null
+
+# defined since 2.8.3
+if (CMAKE_VERSION VERSION_LESS 2.8.3)
+ get_filename_component (CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+endif ()
+
+# Tell the user project where to find our headers and libraries
+
+set (NLOPT_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/@RELATIVE_NLOPT_INCLUDE_DIRS@")
+set (NLOPT_LIBRARY_DIRS "${CMAKE_CURRENT_LIST_DIR}/@RELATIVE_NLOPT_LIB_DIR@")
+
+# Allows loading NLOPT settings from another project
+set (NLOPT_CONFIG_FILE "${CMAKE_CURRENT_LIST_FILE}")
+
+# List of compilation flags -DTOTO to export
+set (NLOPT_DEFINITIONS "@NLOPT_DEFINITIONS@")
+
+# Our library dependencies (contains definitions for IMPORTED targets)
+include ("${CMAKE_CURRENT_LIST_DIR}/NLoptLibraryDepends.cmake")
+
+# These are IMPORTED targets created by NLOPTLibraryDepends.cmake
+set (NLOPT_LIBRARIES "@NLOPT_LIBRARIES@")
+
+if (CMAKE_VERSION VERSION_LESS 2.8.3)
+ set (CMAKE_CURRENT_LIST_DIR)
+endif ()
--- /dev/null
+
+set (PACKAGE_VERSION "@NLOPT_VERSION_STRING@")
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+ set (PACKAGE_VERSION_COMPATIBLE FALSE)
+else ()
+ set (PACKAGE_VERSION_COMPATIBLE TRUE)
+ if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+ set (PACKAGE_VERSION_EXACT TRUE)
+ endif ()
+endif ()
--- /dev/null
+set (CMAKE_SYSTEM_NAME Windows)
+
+# specify the cross compiler
+set (CMAKE_C_COMPILER i686-w64-mingw32-gcc)
+set (CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
+
+# where is the target environment
+set (CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
+
+# search for programs in the build host directories
+set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+# for libraries and headers in the target directories
+set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+# Make sure Qt can be detected by CMake
+set (QT_BINARY_DIR /usr/i686-w64-mingw32/bin /usr/bin)
+set (QT_INCLUDE_DIRS_NO_SYSTEM ON)
+
+# set the resource compiler (RHBZ #652435)
+set (CMAKE_RC_COMPILER i686-w64-mingw32-windres)
+set (CMAKE_MC_COMPILER i686-w64-mingw32-windmc)
+
+# override boost thread component suffix as mingw-w64-boost is compiled with threadapi=win32
+set (Boost_THREADAPI win32)
+
+# These are needed for compiling lapack (RHBZ #753906)
+set (CMAKE_Fortran_COMPILER i686-w64-mingw32-gfortran)
+set (CMAKE_AR:FILEPATH i686-w64-mingw32-ar)
+set (CMAKE_RANLIB:FILEPATH i686-w64-mingw32-ranlib)
+
--- /dev/null
+set (CMAKE_SYSTEM_NAME Windows)
+
+# specify the cross compiler
+set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
+set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
+
+# where is the target environment
+set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
+
+# search for programs in the build host directories
+set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+# for libraries and headers in the target directories
+set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+# Make sure Qt can be detected by CMake
+set (QT_BINARY_DIR /usr/x86_64-w64-mingw32/bin /usr/bin)
+set (QT_INCLUDE_DIRS_NO_SYSTEM ON)
+
+# set the resource compiler (RHBZ #652435)
+set (CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
+set (CMAKE_MC_COMPILER x86_64-w64-mingw32-windmc)
+
+# override boost thread component suffix as mingw-w64-boost is compiled with threadapi=win32
+set (Boost_THREADAPI win32)
+
+# These are needed for compiling lapack (RHBZ #753906)
+set (CMAKE_Fortran_COMPILER x86_64-w64-mingw32-gfortran)
+set (CMAKE_AR:FILEPATH x86_64-w64-mingw32-ar)
+set (CMAKE_RANLIB:FILEPATH x86_64-w64-mingw32-ranlib)
+
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libcobyla.la
-libcobyla_la_SOURCES = cobyla.c cobyla.h
-
-EXTRA_DIST = README COPYRIGHT README.orig
/* Define to 1 if you have the `BSDgettimeofday' function. */\r
#undef HAVE_BSDGETTIMEOFDAY\r
\r
+/* Define if the copysign function/macro is available. */\r
+#cmakedefine HAVE_COPYSIGN\r
+\r
/* Define to 1 if you have the <dlfcn.h> header file. */\r
-#undef HAVE_DLFCN_H\r
+#cmakedefine HAVE_DLFCN_H\r
+\r
+/* Define if the fpclassify() function/macro is available. */\r
+#cmakedefine HAVE_FPCLASSIFY\r
\r
/* Define to 1 if you have the <getopt.h> header file. */\r
-#undef HAVE_GETOPT_H\r
+#cmakedefine HAVE_GETOPT_H\r
\r
/* Define to 1 if you have the `getpid' function. */\r
-#undef HAVE_GETPID\r
+#cmakedefine HAVE_GETPID\r
\r
/* Define if syscall(SYS_gettid) available. */\r
#undef HAVE_GETTID_SYSCALL\r
/* Define to 1 if you have the `gettimeofday' function. */\r
#cmakedefine HAVE_GETTIMEOFDAY\r
\r
-/* Define if the copysign function/macro is available. */\r
-#cmakedefine HAVE_COPYSIGN\r
-\r
/* Define to 1 if you have the <inttypes.h> header file. */\r
#cmakedefine HAVE_INTTYPES_H\r
\r
/* Define to 1 if you have the <sys/types.h> header file. */\r
#cmakedefine HAVE_SYS_TYPES_H\r
\r
+/* Define to 1 if you have the <sys/types.h> header file. */\r
+#cmakedefine HAVE_SYS_TIME_H\r
+\r
/* Define to 1 if you have the `time' function. */\r
#cmakedefine HAVE_TIME\r
\r
#define SIZEOF_UNSIGNED_INT @SIZEOF_UNSIGNED_INT@\r
\r
/* The size of `unsigned long', as computed by sizeof. */\r
-#undef SIZEOF_UNSIGNED_LONG\r
+#define SIZEOF_UNSIGNED_LONG @SIZEOF_UNSIGNED_LONG@\r
\r
/* Define to 1 if you have the ANSI C header files. */\r
#undef STDC_HEADERS\r
\r
/* Define to C thread-local keyword, or to nothing if this is not supported in\r
your compiler. */\r
-#define THREADLOCAL\r
+#define THREADLOCAL @THREADLOCAL@\r
\r
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\r
-#undef TIME_WITH_SYS_TIME\r
+#cmakedefine TIME_WITH_SYS_TIME\r
\r
/* Version number of package */\r
#undef VERSION\r
\r
/* Define if compiled including C++-based routines */\r
-#undef WITH_CXX\r
-\r
-/* Define if we have the non-free Nocedal LBFGS code */\r
-#undef WITH_NOCEDAL\r
+#cmakedefine WITH_CXX\r
\r
/* Define to empty if `const' does not conform to ANSI C. */\r
#undef const\r
#ifndef __cplusplus\r
#undef inline\r
#endif\r
-\r
-\r
+++ /dev/null
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(nlopt, 2.5, stevenj@alum.mit.edu)
-AC_CONFIG_SRCDIR(api/nlopt.h)
-SHARED_VERSION_INFO="9:0:9" # CURRENT:REVISION:AGE
-
-AM_INIT_AUTOMAKE(1.7)
-AM_CONFIG_HEADER(config.h)
-AC_CONFIG_MACRO_DIR([m4])
-AM_MAINTAINER_MODE
-AC_SUBST(SHARED_VERSION_INFO)
-AC_DISABLE_SHARED dnl shared libraries are a PITA, disable by default
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_PROG_CC_STDC
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-AC_LIBTOOL_WIN32_DLL
-AC_PROG_LIBTOOL
-
-NLOPT_SUFFIX=""
-AC_ARG_WITH(cxx,
- [AC_HELP_STRING([--with-cxx], [include C++-based routines])],
- with_cxx=$withval,with_cxx=no)
-AM_CONDITIONAL(WITH_CXX, test "x$with_cxx" = xyes)
-AC_PROG_CXX
-if test "x$with_cxx" = xyes; then
- AC_DEFINE([WITH_CXX], 1, [Define if compiled including C++-based routines])
- NLOPT_SUFFIX="_cxx"
- CC=$CXX
- CFLAGS=$CXXFLAGS
-fi
-AC_SUBST(NLOPT_SUFFIX)
-
-AC_ARG_WITH(mthreads,
- [AC_HELP_STRING([--with-mthreads], [use -mthreads compiler flag])],
- with_mthrads=$withval,with_mthreads=no)
-if test "x$with_mthreads" = xyes; then
- CFLAGS="$CFLAGS -mthreads"
- CXXFLAGS="$CXXFLAGS -mthreads"
-fi
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_HEADER_STDC
-AC_HEADER_TIME
-AC_CHECK_HEADERS([unistd.h getopt.h stdint.h])
-AC_C_CONST
-AC_C_INLINE
-AX_C_THREADLOCAL
-
-dnl find 32-bit unsigned integer type for random-number generator
-AC_CHECK_SIZEOF(unsigned int)
-AC_CHECK_SIZEOF(unsigned long)
-AC_CHECK_TYPES(uint32_t, [], [], [$ac_includes_default
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif])
-
-dnl Checks for libraries and functions
-AC_CHECK_LIB(m, sin)
-AC_CHECK_FUNCS([BSDgettimeofday gettimeofday time qsort_r getpid])
-
-AC_MSG_CHECKING([for gettid syscall])
-AC_TRY_LINK([#include <unistd.h>
-#include <sys/syscall.h>
-], [syscall(SYS_gettid);], [ok=yes], [ok=no])
-if test "$ok" = "yes"; then
- AC_DEFINE(HAVE_GETTID_SYSCALL,1,[Define if syscall(SYS_gettid) available.])
-fi
-AC_MSG_RESULT(${ok})
-
-AC_MSG_CHECKING([for isnan])
-AC_TRY_LINK([#include <math.h>
-], [if (!isnan(3.14159)) isnan(2.7183);], ok=yes, ok=no)
-if test "$ok" = "yes"; then
- AC_DEFINE(HAVE_ISNAN,1,[Define if the isnan() function/macro is available.])
-fi
-AC_MSG_RESULT(${ok})
-
-AC_MSG_CHECKING([for isinf])
-AC_TRY_LINK([#include <math.h>
-], [if (!isinf(3.14159)) isinf(2.7183);], ok=yes, ok=no)
-if test "$ok" = "yes"; then
- AC_DEFINE(HAVE_ISINF,1,[Define if the isinf() function/macro is available.])
-fi
-AC_MSG_RESULT(${ok})
-
-AC_MSG_CHECKING([for fpclassify])
-AC_TRY_LINK([#include <math.h>
-], [if (!fpclassify(3.14159)) fpclassify(2.7183);], ok=yes, ok=no)
-if test "$ok" = "yes"; then
- AC_DEFINE(HAVE_FPCLASSIFY,1,[Define if the fpclassify() function/macro is available.])
-fi
-AC_MSG_RESULT(${ok})
-
-AC_MSG_CHECKING([for copysign])
-AC_TRY_LINK([#include <math.h>
-], [double x = copysign(3.14159, -2.7183);], ok=yes, ok=no)
-if test "$ok" = "yes"; then
- AC_DEFINE(HAVE_COPYSIGN,1,[Define if the copysign function/macro is available.])
-fi
-AC_MSG_RESULT(${ok})
-
-dnl -----------------------------------------------------------------------
-dnl SWIG wrappers
-
-AC_ARG_WITH(guile,
- [AC_HELP_STRING([--without-guile], [don't compile Guile plugin])],
- with_guile=$withval,with_guile=yes)
-AC_ARG_WITH(python,
- [AC_HELP_STRING([--without-python], [don't compile Python plugin])],
- with_python=$withval,with_python=yes)
-
-if test "$enable_shared" = no; then
- AC_MSG_WARN([Python and Guile wrappers require --enable-shared; disabling])
- GUILE_CONFIG=unknown
- have_python=no
-else
-
-if test "x$with_guile" = xno; then
- GUILE_CONFIG=unknown
-else
-
-dnl Guile:
-AC_ARG_VAR(GUILE_INSTALL_DIR, [where to install Guile plug-ins])
-AC_CHECK_PROG(GUILE_CONFIG, guile-config, guile-config, unknown)
-if test "x$GUILE_CONFIG" = "xunknown"; then
- AC_MSG_WARN([can't find guile-config, disabling Guile wrapper])
-else
- save_CPPFLAGS=$CPPFLAGS
- save_LIBS=$LIBS
- GUILE_CPPFLAGS=`$GUILE_CONFIG compile`
- GUILE_LIBS=`$GUILE_CONFIG link`
- CPPFLAGS="$CPPFLAGS $GUILE_CPPFLAGS"
- LIBS="$GUILE_LIBS $LIBS"
- AC_MSG_CHECKING([if linking to guile works])
- AC_TRY_LINK_FUNC(scm_is_vector, [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
- AC_MSG_WARN(guile-config is broken, disabling Guile wrapper)
- GUILE_CONFIG="unknown"])
- CPPFLAGS=$save_CPPFLAGS
- LIBS=$save_LIBS
-fi
-AC_CHECK_PROG(GUILE, guile, guile, unknown)
-if test "x$GUILE" = xunknown; then
- AC_MSG_WARN([can't find guile, disabling Guile wrapper])
- GUILE_CONFIG=unknown
-elif test x"$GUILE_INSTALL_DIR" = "x"; then
- AC_CHECK_PROGS(GUILE_CONFIG, guile-config, echo)
- AC_MSG_CHECKING(guile prefix)
- GUILE_PREFIX=`$GUILE_CONFIG info prefix`
- AC_MSG_RESULT($GUILE_PREFIX)
- AC_MSG_CHECKING([for Guile installation directory])
- GUILE_INSTALL_DIR=`guile -c '(display (%site-dir))'`
- if test "$prefix" != "NONE"; then
- # strip guile install path to honor prefix
- GUILE_INSTALL_DIR=`echo "$GUILE_INSTALL_DIR" | sed "s|$GUILE_PREFIX|$prefix|g"`
- fi
-
- AC_MSG_RESULT([$GUILE_INSTALL_DIR])
-fi
-
-fi # with_guile
-
-if test "x$with_python" = xno; then
- have_python=no
-else
-
-dnl Python:
-AM_PATH_PYTHON([],[have_python=yes],[have_python=no])
-if test $have_python = yes; then
- AC_ARG_VAR([PYTHON_CONFIG], [python-config program])
- AC_PATH_PROGS([PYTHON_CONFIG], [python$PYTHON_VERSION-config python-config],
- [unknown], [`dirname $PYTHON`:$PATH])
- AC_MSG_CHECKING([for Python include flags])
- if test "x$PYTHON_CONFIG" = "xunknown"; then
- pinc=-I`echo "import distutils.sysconfig; print (distutils.sysconfig.get_python_inc())" | $PYTHON - 2>/dev/null`
- test "x$pinc" = "x-I" && pinc=""
- else
- pinc=`$PYTHON_CONFIG --includes 2>/dev/null`
- fi
- AC_MSG_RESULT([${pinc:-unknown}])
- PYTHON_INCLUDES="$pinc"
- PYTHON_LIBS=`$PYTHON_CONFIG --libs 2>/dev/null`
- save_CPPFLAGS=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
- AC_CHECK_HEADER([Python.h], [], [AC_MSG_WARN([disabling Python wrappers])
- have_python=no])
- if test $have_python = yes; then
- AC_MSG_CHECKING([for Numpy include directory])
- pinc=`echo "import numpy; print (numpy.get_include())" | $PYTHON - 2>/dev/null`
- AC_MSG_RESULT([${pinc:-unknown}])
- test -n "$pinc" && PYTHON_INCLUDES="$PYTHON_INCLUDES -I$pinc"
- CPPFLAGS="$save_CPPFLAGS $PYTHON_INCLUDES"
- AC_CHECK_HEADER([numpy/arrayobject.h],[],[
- AC_MSG_WARN([disabling Python wrappers])
- have_python=no],[#include <Python.h>])
- fi
- CPPFLAGS=$save_CPPFLAGS
-fi
-
-fi # with_python
-
-fi # if enable_shared
-
-AC_SUBST(GUILE_INSTALL_DIR)
-AC_SUBST(GUILE_CPPFLAGS)
-AC_SUBST(GUILE_LIBS)
-AC_SUBST(PYTHON_INCLUDES)
-AC_SUBST(PYTHON_LIBS)
-AM_CONDITIONAL(WITH_GUILE, test x"$GUILE_CONFIG" != "xunknown")
-AM_CONDITIONAL(WITH_PYTHON, test x"$have_python" = "xyes")
-
-dnl -----------------------------------------------------------------------
-dnl Compiling Octave plug-in
-
-AC_ARG_VAR(OCT_INSTALL_DIR, [where to install GNU Octave .oct plug-ins])
-AC_ARG_VAR(M_INSTALL_DIR, [where to install GNU Octave .m plug-ins])
-AC_ARG_VAR(MKOCTFILE, [name of mkoctfile program to compile Octave plug-ins])
-
-AC_ARG_WITH(octave,
- [AC_HELP_STRING([--without-octave], [don't compile Octave plugin])],
- with_octave=$withval,with_octave=yes)
-
-AC_CHECK_PROGS(MKOCTFILE, mkoctfile, echo)
-
-if test x"$with_octave" = xno; then
- OCT_INSTALL_DIR=""
-elif test "$MKOCTFILE" = "echo"; then
- AC_MSG_WARN([can't find mkoctfile: won't be able to compile GNU Octave plugin])
- OCT_INSTALL_DIR=""
-elif test x"$OCT_INSTALL_DIR" = "x"; then
- # try to find installation directory
- AC_CHECK_PROGS(OCTAVE, octave, echo)
- AC_CHECK_PROGS(OCTAVE_CONFIG, octave-config, echo)
-
- AC_MSG_CHECKING(octave prefix)
- OCTAVE_PREFIX=`$OCTAVE_CONFIG --print PREFIX 2> /dev/null`
- AC_MSG_RESULT($OCTAVE_PREFIX)
-
- AC_MSG_CHECKING(where octave plugins go)
- OCT_INSTALL_DIR=`$OCTAVE_CONFIG --oct-site-dir 2> /dev/null | grep '/'`
- if test -z "$OCT_INSTALL_DIR"; then
- OCT_INSTALL_DIR=`$OCTAVE_CONFIG --print OCTFILEDIR 2> /dev/null | grep '/'`
- fi
- if test -z "$OCT_INSTALL_DIR"; then
- OCT_INSTALL_DIR=`echo "path" | $OCTAVE -q 2> /dev/null | grep "/oct/" | head -1`
- fi
- if test -z "$OCT_INSTALL_DIR"; then
- OCT_INSTALL_DIR=`echo "DEFAULT_LOADPATH" | $OCTAVE -q 2> /dev/null | tr ':' '\n' | grep "site/oct" | head -1`
- fi
- if test -n "$OCT_INSTALL_DIR"; then
- if test "$prefix" != "NONE"; then
- # strip octave install path to honor prefix
- OCT_INSTALL_DIR=`echo "$OCT_INSTALL_DIR" | sed "s|$OCTAVE_PREFIX|$prefix|g"`
- fi
- AC_MSG_RESULT($OCT_INSTALL_DIR)
- else
- AC_MSG_RESULT(unknown)
- AC_MSG_WARN([can't find where to install octave plugins: won't be able to compile octave plugin])
- fi
-
- AC_MSG_CHECKING(where octave scripts go)
- M_INSTALL_DIR=`$OCTAVE_CONFIG --m-site-dir 2> /dev/null | grep '/'`
- if test -z "$M_INSTALL_DIR"; then
- M_INSTALL_DIR=`$OCTAVE_CONFIG --print FCNFILEDIR 2> /dev/null | grep '/'`
- fi
- if test -z "$M_INSTALL_DIR"; then
- M_INSTALL_DIR=`echo "path" | $OCTAVE -q 2> /dev/null | grep "/m" | head -1`
- fi
- if test -z "$M_INSTALL_DIR"; then
- M_INSTALL_DIR=`echo "DEFAULT_LOADPATH" | $OCTAVE -q 2> /dev/null | tr ':' '\n' | grep "site/m" | head -1`
- fi
- if test -n "$M_INSTALL_DIR"; then
- if test "$prefix" != "NONE"; then
- # strip octave install path to honor prefix
- M_INSTALL_DIR=`echo "$M_INSTALL_DIR" | sed "s|$OCTAVE_PREFIX|$prefix|g"`
- fi
- AC_MSG_RESULT($M_INSTALL_DIR)
- else
- AC_MSG_RESULT(unknown)
- AC_MSG_WARN([can't find where to install octave scripts: won't be able to install octave plugin])
- OCT_INSTALL_DIR=""
- fi
-elif test x"$M_INSTALL_DIR" = "x"; then # user-specified OCT_INSTALL_DIR
- M_INSTALL_DIR=$OCT_INSTALL_DIR
-fi
-
-if test x"$OCT_INSTALL_DIR" != "x"; then
-if test "$enable_shared" = no; then
- AC_MSG_WARN([mkoctfile requires --enable-shared; won't compile Octave plugin])
- OCT_INSTALL_DIR=""
-fi
-fi
-
-AM_CONDITIONAL(WITH_OCTAVE, test x"$OCT_INSTALL_DIR" != "x")
-AC_SUBST(OCT_INSTALL_DIR)
-AC_SUBST(M_INSTALL_DIR)
-AC_SUBST(MKOCTFILE)
-
-dnl -----------------------------------------------------------------------
-dnl Compiling Matlab plug-in
-
-AC_ARG_WITH(matlab,
- [AC_HELP_STRING([--without-matlab], [don't compile Matlab plugin])],
- with_matlab=$withval,with_matlab=yes)
-
-AC_ARG_VAR(MEX_INSTALL_DIR, [where to install Matlab .mex plug-ins])
-AC_ARG_VAR(MEX, [name of mex program to compile Matlab plug-ins])
-AC_CHECK_PROGS(MEX, mex, echo)
-if test x"$with_matlab" = xno; then
- MEX_INSTALL_DIR=""
-elif test "$MEX" = "echo"; then
- AC_MSG_WARN([can't find mex: won't be able to compile Matlab plugin])
- MEX_INSTALL_DIR=""
-else
- AC_MSG_CHECKING([for extension of compiled mex files])
- rm -f conftest*
- cat > conftest.c <<EOF
-#include <mex.h>
-void mexFunction(int nlhs, mxArray *plhs[[]],
- int nrhs, const mxArray *prhs[[]]) { }
-EOF
- if $MEX conftest.c >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
- MEXSUFF=`ls conftest.m* | head -1 | cut -d'.' -f2`
- AC_MSG_RESULT($MEXSUFF)
- AC_CHECK_PROGS(MATLAB, matlab, echo)
- else
- AC_MSG_WARN([$MEX failed to compile a simple file; won't compile Matlab plugin])
- MEX_INSTALL_DIR=""
- MATLAB=echo
- fi
-
- if test x"$MATLAB" != xecho; then
- if test "$enable_shared" = no; then
- AC_MSG_RESULT(no)
- AC_MSG_WARN([mex requires --enable-shared; won't compile Matlab plugin])
- MEX_INSTALL_DIR=""
- MATLAB=echo
- fi
- fi
-
- if test x"$MATLAB" != xecho; then
- # try to find installation directory
- if test x"$MEX_INSTALL_DIR" = "x"; then
- AC_MSG_CHECKING(for MATLAB mex installation dir)
- MEX_INSTALL_DIR=`matlab -nodisplay -nodesktop -nojvm -r 'path;quit' | grep toolbox/local |sed 's,^[[^/]]*,,g' |sort |head -1`
- AC_MSG_RESULT($MEX_INSTALL_DIR)
- if test x`basename "$MEX_INSTALL_DIR"` != xlocal; then
- MEX_INSTALL_DIR=""
- fi
- if test x"$MEX_INSTALL_DIR" = "x"; then
- AC_MSG_WARN([can't find reasonable Matlab installation directory; Matlab plugins will not be compiled unless you manually specify MEX_INSTALL_DIR])
- fi
- fi
- else
- MEX_INSTALL_DIR=""
- fi
-fi
-AM_CONDITIONAL(WITH_MATLAB, test x"$MEX_INSTALL_DIR" != "x")
-AC_SUBST(MEX_INSTALL_DIR)
-AC_SUBST(MEX)
-AC_SUBST(MEXSUFF)
-
-dnl -----------------------------------------------------------------------
-dnl Check for broken Solaris HUGE_VAL macro under gcc 3.4.x and similar
-
-AC_MSG_CHECKING([for working HUGE_VAL])
-AC_TRY_COMPILE([#include <math.h>], [double x = -HUGE_VAL;],
-[AC_MSG_RESULT([ok])],
-[AC_TRY_COMPILE([#include <math.h>
-#ifdef __GNUC__
-#undef HUGE_VAL
-#define HUGE_VAL __builtin_huge_val()
-#endif], [double x = -HUGE_VAL;],
-[AC_MSG_RESULT([__builtin_huge_val()])
-AC_DEFINE(REPLACEMENT_HUGE_VAL,[__builtin_huge_val()],
- [replacement for broken HUGE_VAL macro, if needed])],
-[AC_MSG_RESULT([unknown])
-AC_MSG_ERROR([broken HUGE_VAL macro with this compiler, unknown workaround])])])
-
-dnl -----------------------------------------------------------------------
-dnl Debugging
-
-AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile with extra runtime checks for debugging])], ok=$enableval, ok=no)
-if test "$ok" = "yes"; then
- AC_DEFINE(DEBUG,1,[Define to enable extra debugging code.])
-fi
-
-dnl override CFLAGS selection when debugging
-if test "${enable_debug}" = "yes"; then
- CFLAGS="-g"
- CXXFLAGS="-g"
- FFLAGS="-g"
-fi
-
-dnl add gcc warnings, in debug/maintainer mode only
-if test "$enable_debug" = yes || test "$USE_MAINTAINER_MODE" = yes; then
-if test $ac_cv_prog_gcc = yes; then
- if test "$ac_test_CFLAGS" != "set"; then
- CFLAGS="$CFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -Wshadow -Wbad-function-cast -Wwrite-strings -Wstrict-prototypes -Wredundant-decls -Wnested-externs -Wundef -Wconversion -Wmissing-prototypes -Wmissing-declarations"
- fi
- if test "$ac_test_CXXFLAGS" != "set"; then
- CXXFLAGS="$CXXFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -Wshadow -Wwrite-strings -Wredundant-decls -Wundef -Wconversion"
- fi
- if test "x$with_cxx" = xyes; then
- CFLAGS=$CXXFLAGS
- fi
-fi
-fi
-
-vers=`echo ${VERSION}.0.0 | cut -d. -f1`
-AC_DEFINE_UNQUOTED(MAJOR_VERSION, $vers, [Major version number.])
-vers=`echo ${VERSION}.0.0 | cut -d. -f2`
-AC_DEFINE_UNQUOTED(MINOR_VERSION, $vers, [Minor version number.])
-vers=`echo ${VERSION}.0.0 | cut -d. -f3`
-AC_DEFINE_UNQUOTED(BUGFIX_VERSION, $vers, [Bugfix version number.])
-
-dnl -----------------------------------------------------------------------
-
-AC_CONFIG_FILES([
- Makefile
- nlopt.pc
- api/Makefile
- util/Makefile
- octave/Makefile
- direct/Makefile
- cdirect/Makefile
- stogo/Makefile
- praxis/Makefile
- luksan/Makefile
- crs/Makefile
- mlsl/Makefile
- mma/Makefile
- cobyla/Makefile
- newuoa/Makefile
- neldermead/Makefile
- auglag/Makefile
- bobyqa/Makefile
- isres/Makefile
- slsqp/Makefile
- esch/Makefile
- test/Makefile
- swig/Makefile
- swig/nlopt.scm
-])
-
-AC_OUTPUT
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libcquad.la
-libcquad_la_SOURCES = cquad.c cquad.h
-
-EXTRA_DIST = README
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libcrs.la
-libcrs_la_SOURCES = crs.c crs.h
-
-EXTRA_DIST = README
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libdirect.la
-libdirect_la_SOURCES = DIRect.c direct_wrap.c DIRserial.c DIRsubrout.c \
-direct-internal.h direct.h
-
-EXTRA_DIST = README AUTHORS COPYING DIRparallel.c tstc.c userguide.pdf
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libesch.la
-libesch_la_SOURCES = esch.c esch.h
-
-EXTRA_DIST = README COPYRIGHT
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libisres.la
-libisres_la_SOURCES = isres.c isres.h
-
-EXTRA_DIST = README
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libluksan.la
-libluksan_la_SOURCES = plis.c plip.c pnet.c mssubs.c pssubs.c luksan.h
-
-EXTRA_DIST = README COPYRIGHT plis.txt v999-07.pdf
+++ /dev/null
-dnl @synopsis AX_C_THREADLOCAL([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-dnl @summary determine C keyword for threadlocal storage
-dnl
-dnl This macro tries to discover a C keyword to declare variables
-dnl as having thread-local storage. Most commonly, this is either
-dnl __thread [gcc] or __declspec(thread) [Windows].
-dnl
-dnl On success, it #defines the THREADLOCAL preprocessor symbol to
-dnl the appropriate keyword. You would then use it in C code as, e.g.:
-dnl THREADLOCAL int myvariable;
-dnl
-dnl ACTION-IF-FOUND is a list of shell commands to run if an thread-local
-dnl keyword is found, and ACTION-IF-NOT-FOUND is a list of commands
-dnl to run it if one is not found. If ACTION-IF-FOUND is not specified,
-dnl the default action does nothing.
-dnl
-dnl @version 2010-05-28
-dnl @license GPLWithACException
-dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
-AC_DEFUN([AX_C_THREADLOCAL],
-[AC_ARG_WITH(threadlocal,
- [AC_HELP_STRING([--without-threadlocal], [no thread-local storage keyword])],
- with_ax_c_threadlocal=$withval, with_ax_c_threadlocal=yes)
- AC_CACHE_CHECK([for C thread-local keyword], ax_cv_c_threadlocal,
-[if test "x$with_ax_c_threadlocal" = xno; then
- ax_cv_c_threadlocal=disabled
- else
- ax_cv_c_threadlocal=unsupported
- AC_LANG_SAVE
- AC_LANG_C
- for ax_kw in __thread "__declspec(thread)"; do
- AC_TRY_COMPILE([], [static $ax_kw int x = 0;],
- [ax_cv_c_threadlocal=$ax_kw; break])
- done
- AC_LANG_RESTORE
- fi
-])
- ax_kw="$ax_cv_c_threadlocal"
- if test "x$ax_kw" = xunsupported; then ax_kw=""; fi
- if test "x$ax_kw" = xdisabled; then ax_kw=""; fi
- AC_DEFINE_UNQUOTED(THREADLOCAL, $ax_kw, [Define to C thread-local keyword, or to nothing if this is not supported in your compiler.])
- if test "$ax_cv_c_threadlocal" = unsupported; then
- m4_default([$2],:)
- else
- m4_default([$1],:)
- fi
-])
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libmlsl.la
-libmlsl_la_SOURCES = mlsl.c mlsl.h
-
-EXTRA_DIST = README
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libmma.la
-libmma_la_SOURCES = mma.c ccsa_quadratic.c mma.h
-
-EXTRA_DIST = README
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libneldermead.la
-libneldermead_la_SOURCES = nldrmd.c neldermead.h sbplx.c
-
-EXTRA_DIST = README
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libnewuoa.la
-libnewuoa_la_SOURCES = newuoa.c newuoa.h
-
-EXTRA_DIST = README README.orig COPYRIGHT
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
Name: NLopt
Description: nonlinear optimization libary
-Version: @VERSION@
+Version: @NLOPT_VERSION_STRING@
Libs: -L${libdir} -lnlopt@NLOPT_SUFFIX@ -lm
Cflags: -I${includedir}
--- /dev/null
+
+file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/nlopt_optimize_usage.h "#define NLOPT_OPTIMIZE_USAGE \\\n")
+file (STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt_optimize.m INPUT_LINES)
+foreach (INPUT_LINE ${INPUT_LINES})
+ string (REGEX REPLACE "^% " "" INPUT_LINE ${INPUT_LINE})
+ string (REGEX REPLACE "^%" "" INPUT_LINE ${INPUT_LINE})
+ foreach (repl_expr "tolerance" "help NLOPT_LN_SBPLX" "population")
+ string (REGEX REPLACE "\"${repl_expr}\"" "${repl_expr}" INPUT_LINE "${INPUT_LINE}")
+ endforeach ()
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt_optimize_usage.h "\"${INPUT_LINE}\\n\" \\\n")
+endforeach ()
+file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt_optimize_usage.h "\n")
+
+include_directories (${OCTAVE_INCLUDE_DIRS})
+include_directories (${CMAKE_CURRENT_BINARY_DIR})
+octave_add_oct (nlopt_optimize SOURCES nlopt_optimize-oct.cc ${CMAKE_CURRENT_BINARY_DIR}/nlopt_optimize_usage.h LINK_LIBRARIES ${nlopt_lib})
+
+file (RELATIVE_PATH PKG_OCTAVE_OCT_SITE_DIR ${OCTAVE_ROOT_DIR} ${OCTAVE_OCT_SITE_DIR})
+install (TARGETS nlopt_optimize DESTINATION ${PKG_OCTAVE_OCT_SITE_DIR})
+
+set (MFILES NLOPT_GN_DIRECT.m NLOPT_GN_DIRECT_L.m NLOPT_GN_DIRECT_L_RAND.m NLOPT_GN_DIRECT_NOSCAL.m NLOPT_GN_DIRECT_L_NOSCAL.m NLOPT_GN_DIRECT_L_RAND_NOSCAL.m NLOPT_GN_ORIG_DIRECT.m NLOPT_GN_ORIG_DIRECT_L.m NLOPT_GD_STOGO.m NLOPT_GD_STOGO_RAND.m NLOPT_LD_LBFGS_NOCEDAL.m NLOPT_LD_LBFGS.m NLOPT_LN_PRAXIS.m NLOPT_LD_VAR1.m NLOPT_LD_VAR2.m NLOPT_LD_TNEWTON.m NLOPT_LD_TNEWTON_RESTART.m NLOPT_LD_TNEWTON_PRECOND.m NLOPT_LD_TNEWTON_PRECOND_RESTART.m NLOPT_GN_CRS2_LM.m NLOPT_GN_MLSL.m NLOPT_GD_MLSL.m NLOPT_GN_MLSL_LDS.m NLOPT_GD_MLSL_LDS.m NLOPT_LD_MMA.m NLOPT_LN_COBYLA.m NLOPT_LN_NEWUOA.m NLOPT_LN_NEWUOA_BOUND.m NLOPT_LN_NELDERMEAD.m NLOPT_LN_SBPLX.m NLOPT_LN_AUGLAG.m NLOPT_LD_AUGLAG.m NLOPT_LN_AUGLAG_EQ.m NLOPT_LD_AUGLAG_EQ.m NLOPT_LN_BOBYQA.m NLOPT_GN_ISRES.m NLOPT_AUGLAG.m NLOPT_AUGLAG_EQ.m NLOPT_G_MLSL.m NLOPT_G_MLSL_LDS.m NLOPT_LD_SLSQP.m NLOPT_LD_CCSAQ.m NLOPT_GN_ESCH.m)
+set (M_DATA ${MFILES} nlopt_minimize.m nlopt_minimize_constrained.m nlopt_optimize.m)
+
+file (RELATIVE_PATH PKG_OCTAVE_M_SITE_DIR ${OCTAVE_ROOT_DIR} ${OCTAVE_M_SITE_DIR})
+install (FILES ${M_DATA} DESTINATION ${PKG_OCTAVE_M_SITE_DIR})
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/api -I$(top_srcdir)/util
-
-MFILES = NLOPT_GN_DIRECT.m NLOPT_GN_DIRECT_L.m NLOPT_GN_DIRECT_L_RAND.m NLOPT_GN_DIRECT_NOSCAL.m NLOPT_GN_DIRECT_L_NOSCAL.m NLOPT_GN_DIRECT_L_RAND_NOSCAL.m NLOPT_GN_ORIG_DIRECT.m NLOPT_GN_ORIG_DIRECT_L.m NLOPT_GD_STOGO.m NLOPT_GD_STOGO_RAND.m NLOPT_LD_LBFGS_NOCEDAL.m NLOPT_LD_LBFGS.m NLOPT_LN_PRAXIS.m NLOPT_LD_VAR1.m NLOPT_LD_VAR2.m NLOPT_LD_TNEWTON.m NLOPT_LD_TNEWTON_RESTART.m NLOPT_LD_TNEWTON_PRECOND.m NLOPT_LD_TNEWTON_PRECOND_RESTART.m NLOPT_GN_CRS2_LM.m NLOPT_GN_MLSL.m NLOPT_GD_MLSL.m NLOPT_GN_MLSL_LDS.m NLOPT_GD_MLSL_LDS.m NLOPT_LD_MMA.m NLOPT_LN_COBYLA.m NLOPT_LN_NEWUOA.m NLOPT_LN_NEWUOA_BOUND.m NLOPT_LN_NELDERMEAD.m NLOPT_LN_SBPLX.m NLOPT_LN_AUGLAG.m NLOPT_LD_AUGLAG.m NLOPT_LN_AUGLAG_EQ.m NLOPT_LD_AUGLAG_EQ.m NLOPT_LN_BOBYQA.m NLOPT_GN_ISRES.m NLOPT_AUGLAG.m NLOPT_AUGLAG_EQ.m NLOPT_G_MLSL.m NLOPT_G_MLSL_LDS.m NLOPT_LD_SLSQP.m NLOPT_LD_CCSAQ.m NLOPT_GN_ESCH.m
-
-#######################################################################
-# dummy C program to fool automake into making sure that CPPFLAGS etc.
-# are all defined
-noinst_PROGRAMS = dummy
-dummy_SOURCES = dummy.c
-
-#######################################################################
-octdir = $(OCT_INSTALL_DIR)
-mdir = $(M_INSTALL_DIR)
-if WITH_OCTAVE
-oct_DATA = nlopt_optimize.oct
-m_DATA = $(MFILES) nlopt_minimize.m nlopt_minimize_constrained.m nlopt_optimize.m
-endif
-
-nlopt_optimize.oct: nlopt_optimize-oct.cc nlopt_optimize_usage.h $(top_builddir)/.libs/libnlopt@NLOPT_SUFFIX@.la
- $(MKOCTFILE) -o $@ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(srcdir)/nlopt_optimize-oct.cc $(LDFLAGS) -L$(top_builddir)/.libs -lnlopt@NLOPT_SUFFIX@
-
-BUILT_SOURCES = nlopt_optimize_usage.h
-MAINTAINERCLEANFILES = $(BUILT_SOURCES)
-
-nlopt_optimize_usage.h: $(srcdir)/nlopt_optimize.m
- echo "#define NLOPT_OPTIMIZE_USAGE \\" > $@
- sed 's/\"/\\"/g' $(srcdir)/nlopt_optimize.m | sed 's,^% ,\",;s,^%,\",;s,$$,\\n\" \\,' >> $@
- echo "" >> $@
-
-#######################################################################
-mexdir = $(MEX_INSTALL_DIR)
-if WITH_MATLAB
-mex_DATA = nlopt_optimize.$(MEXSUFF) $(MFILES) nlopt_minimize.m nlopt_minimize_constrained.m nlopt_optimize.m
-endif
-
-nlopt_optimize.$(MEXSUFF): nlopt_optimize-mex.c $(top_builddir)/.libs/libnlopt@NLOPT_SUFFIX@.la
- $(MEX) -output nlopt_optimize -O $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(srcdir)/nlopt_optimize-mex.c $(LDFLAGS) -L$(top_builddir)/.libs -lnlopt@NLOPT_SUFFIX@
-
-#######################################################################
-
-EXTRA_DIST = nlopt_optimize-oct.cc nlopt_optimize-mex.c $(MFILES) nlopt_minimize.m nlopt_minimize_constrained.m nlopt_optimize.m nlopt_optimize_usage.h
-
-CLEANFILES = nlopt_optimize.oct nlopt_optimize.h nlopt_optimize.$(MEXSUFF) nlopt_optimize-oct.o
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libpraxis.la
-libpraxis_la_SOURCES = praxis.c praxis.h
-
-EXTRA_DIST = README
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libslsqp.la
-libslsqp_la_SOURCES = slsqp.c slsqp.h
-
-EXTRA_DIST = README COPYRIGHT
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libstogo.la
-libstogo_la_SOURCES = global.cc linalg.cc local.cc stogo.cc tools.cc \
-global.h linalg.h local.h stogo_config.h stogo.h tools.h
-
-EXTRA_DIST = testros.cc tst.cc tstc.c prog.cc testfun.h rosen.h README \
-paper.pdf techreport.pdf COPYRIGHT
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/util
-
-noinst_LTLIBRARIES = libsubplex.la
-libsubplex_la_SOURCES = subplex.c subplex.h
-
-EXTRA_DIST = README
-option (BUILD_PYTHON "build python bindings" ON)
-find_package (PythonInterp)
-find_package (PythonLibs)
-
-if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-python.cpp)
- find_package (SWIG)
+if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-enum-renames.i)
+ file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/nlopt-enum-renames.i "// AUTOMATICALLY GENERATED -- DO NOT EDIT\n")
+ file (STRINGS ${CMAKE_SOURCE_DIR}/api/nlopt.h NLOPT_H_LINES REGEX " NLOPT_[A-Z0-9_]+")
+ foreach (NLOPT_H_LINE ${NLOPT_H_LINES})
+ string (REGEX REPLACE ".*NLOPT_([A-Z0-9_]+).*" "%rename(NLOPT_\\1) nlopt::\\1;\n" ENUM_LINE ${NLOPT_H_LINE})
+ file (APPEND ${CMAKE_CURRENT_BINARY_DIR}/nlopt-enum-renames.i "${ENUM_LINE}")
+ endforeach ()
endif ()
-if (BUILD_PYTHON AND PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND AND (SWIG_FOUND OR (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-python.cpp)) AND BUILD_SHARED_LIBS)
- include_directories (${CMAKE_SOURCE_DIR}/api)
+if (NUMPY_FOUND AND PYTHONLIBS_FOUND AND (SWIG_FOUND OR (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-python.cpp)))
+
include_directories (${PYTHON_INCLUDE_DIRS})
+ include_directories (${NUMPY_INCLUDE_DIRS})
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-python.cpp)
set (SWIG_MODULE_nlopt_REAL_NAME _nlopt)
add_library (${SWIG_MODULE_nlopt_REAL_NAME} MODULE nlopt-python.cpp)
- target_link_libraries(${SWIG_MODULE_nlopt_REAL_NAME} nlopt)
+ target_link_libraries(${SWIG_MODULE_nlopt_REAL_NAME} ${nlopt_lib})
target_link_libraries(${SWIG_MODULE_nlopt_REAL_NAME} ${PYTHON_LIBRARIES})
set_target_properties (${SWIG_MODULE_nlopt_REAL_NAME} PROPERTIES PREFIX "")
if (NOT CMAKE_SOURCE_DIR MATCHES CMAKE_BINARY_DIR)
else ()
include (UseSWIG)
set_source_files_properties (nlopt.i PROPERTIES CPLUSPLUS ON)
- set (SWIG_MODULE_nlopt_EXTRA_DEPS nlopt-python.i numpy.i ${CMAKE_SOURCE_DIR}/api/nlopt.hpp)
+ set (SWIG_MODULE_nlopt_EXTRA_DEPS nlopt-python.i numpy.i)
swig_add_module (nlopt python nlopt.i)
- swig_link_libraries (nlopt nlopt)
+ swig_link_libraries (nlopt ${nlopt_lib})
swig_link_libraries (nlopt ${PYTHON_LIBRARIES})
endif ()
- execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))"
- OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
- OUTPUT_STRIP_TRAILING_WHITESPACE )
-
- get_filename_component (_ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE)
- file (RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH})
-
- set (PYTHON_MODULE_PATH ${_REL_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 ()
+
+
+# guile bindings with gcc only ok with swig >= 2.0.10
+if (GUILE_FOUND AND ((SWIG_FOUND AND SWIG_VERSION VERSION_GREATER 2.0.9) OR (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-guile.cpp)))
+ include_directories (${GUILE_INCLUDE_DIRS})
+
+ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-guile.cpp)
+ set (guile_cpp_source ${CMAKE_CURRENT_SOURCE_DIR}/nlopt-guile.cpp)
+ else ()
+ file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/GenericConfigureFile.cmake "configure_file (\${INFILE} \${OUTFILE} @ONLY)")
+
+ set (guile_cpp_source ${CMAKE_CURRENT_BINARY_DIR}/nlopt-guile.cpp)
+ add_custom_command (OUTPUT ${guile_cpp_source} nlopt.scm.in
+ COMMAND ${SWIG_EXECUTABLE} -I${CMAKE_BINARY_DIR}/api -outdir ${CMAKE_CURRENT_BINARY_DIR} -c++ -guile -scmstub -o ${guile_cpp_source} ${CMAKE_CURRENT_SOURCE_DIR}/nlopt.i
+ COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/nlopt.scm ${CMAKE_CURRENT_BINARY_DIR}/nlopt.scm.in
+ COMMAND ${CMAKE_COMMAND} -DINFILE=${CMAKE_CURRENT_BINARY_DIR}/nlopt.scm.in -DOUTFILE=${CMAKE_CURRENT_BINARY_DIR}/nlopt.scm -DNLOPT_SUFFIX=${NLOPT_SUFFIX} -P ${CMAKE_CURRENT_BINARY_DIR}/GenericConfigureFile.cmake)
+ endif ()
+
+ if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nlopt.scm.in)
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/nlopt.scm.in ${CMAKE_CURRENT_BINARY_DIR}/nlopt.scm @ONLY)
+ endif ()
+
+ set (SWIG_MODULE_nlopt_guile_REAL_NAME nlopt_guile)
+ add_library (${SWIG_MODULE_nlopt_guile_REAL_NAME} MODULE ${guile_cpp_source})
+ target_link_libraries(${SWIG_MODULE_nlopt_guile_REAL_NAME} ${nlopt_lib})
+ target_link_libraries(${SWIG_MODULE_nlopt_guile_REAL_NAME} ${GUILE_LIBRARIES})
+
+ file (RELATIVE_PATH _REL_GUILE_SITE_PATH ${GUILE_ROOT_DIR} ${GUILE_SITE_DIR})
+ set (GUILE_SITE_PATH ${_REL_GUILE_SITE_PATH})
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/nlopt.scm DESTINATION ${GUILE_SITE_PATH})
+
+ file (RELATIVE_PATH _REL_GUILE_EXTENSION_PATH ${GUILE_ROOT_DIR} ${GUILE_EXTENSION_DIR})
+ set (GUILE_EXTENSION_PATH ${_REL_GUILE_EXTENSION_PATH})
+ install (TARGETS ${SWIG_MODULE_nlopt_guile_REAL_NAME} LIBRARY DESTINATION ${GUILE_EXTENSION_PATH})
+endif ()
+++ /dev/null
-SWIG_SRC = nlopt.i nlopt-exceptions.i nlopt-enum-renames.i
-EXTRA_DIST = $(SWIG_SRC) nlopt-guile.i nlopt-python.i nlopt.scm.in nlopt.py numpy.i
-
-BUILT_SOURCES = nlopt-guile.cpp nlopt-python.cpp nlopt-enum-renames.i nlopt.scm.in
-
-HDR = $(top_srcdir)/api/nlopt.hpp
-
-##############################################################################
-# Guile wrapper
-
-libnlopt@NLOPT_SUFFIX@_guile_la_SOURCES = nlopt-guile.cpp
-libnlopt@NLOPT_SUFFIX@_guile_la_LIBADD = ../libnlopt@NLOPT_SUFFIX@.la @GUILE_LIBS@
-libnlopt@NLOPT_SUFFIX@_guile_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
-libnlopt@NLOPT_SUFFIX@_guile_la_CPPFLAGS = $(GUILE_CPPFLAGS) -I$(top_srcdir)/api
-
-guiledir = $(GUILE_INSTALL_DIR)
-if WITH_GUILE
-guile_DATA = nlopt.scm
-guilelib = libnlopt@NLOPT_SUFFIX@_guile.la
-endif
-
-##############################################################################
-# Python wrapper
-
-_nlopt_la_SOURCES = nlopt-python.cpp
-_nlopt_la_LIBADD = ../libnlopt@NLOPT_SUFFIX@.la @PYTHON_LIBS@
-_nlopt_la_LDFLAGS = -module -version-info @SHARED_VERSION_INFO@
-_nlopt_la_CPPFLAGS = $(PYTHON_INCLUDES) -I$(top_srcdir)/api
-if WITH_PYTHON
-python_PYTHON = nlopt.py
-pyexec_LTLIBRARIES = _nlopt.la
-endif
-
-##############################################################################
-
-
-lib_LTLIBRARIES = $(guilelib)
-
-##############################################################################
-# Generate wrappers via SWIG:
-
-if MAINTAINER_MODE
-
-nlopt-guile.cpp: $(SWIG_SRC) nlopt-guile.i $(HDR)
- swig -I$(top_srcdir)/api -outdir $(builddir) -c++ -guile -scmstub -o $@ $(srcdir)/nlopt.i
- rm -f nlopt.scm.in
- mv nlopt.scm nlopt.scm.in
-
-nlopt.scm.in: nlopt-guile.cpp
-
-nlopt-python.cpp: $(SWIG_SRC) nlopt-python.i numpy.i $(HDR)
- swig -I$(top_srcdir)/api -outdir $(builddir) -c++ -python -o $@ $(srcdir)/nlopt.i
-
-nlopt.py: nlopt-python.cpp
-
-nlopt-enum-renames.i: $(top_srcdir)/api/nlopt.h
- (echo "// AUTOMATICALLY GENERATED -- DO NOT EDIT"; egrep 'NLOPT_[LG][DN]|NLOPT_AUGLAG|NLOPT_G_MLSL|NLOPT_NUM_ALGORITHMS' $(top_srcdir)/api/nlopt.h | sed 's/NLOPT_//g' |tr -d ' ' |tr '/' ',' |tr '=' ',' |cut -d, -f1 |while read name; do echo "%rename(NLOPT_$$name) nlopt::$$name;"; done; egrep 'NLOPT_[A-Z_]* =' $(top_srcdir)/api/nlopt.h | egrep -v 'NLOPT_[LG][DN]|NLOPT_AUGLAG|NLOPT_G_MLSL' | sed 's/NLOPT_//g' |tr -d ' ' |cut -d'=' -f1 | while read name; do echo "%rename(NLOPT_$$name) nlopt::$$name;"; done) > $@
-
-endif
--- /dev/null
+add_custom_target (tests)
+
+# have to add timer.c and mt19937ar.c as symbols are declared extern
+add_executable (testopt EXCLUDE_FROM_ALL testfuncs.c testfuncs.h testopt.cpp ${CMAKE_SOURCE_DIR}/util/timer.c ${CMAKE_SOURCE_DIR}/util/mt19937ar.c)
+target_link_libraries (testopt ${nlopt_lib})
+add_dependencies (tests testopt)
+
+foreach (algo_index RANGE 29)# 42
+ foreach (obj_index RANGE 1)# 21
+ set (enable_ TRUE)
+ # cxx stogo
+ if (NOT WITH_CXX)
+ if (algo_index STREQUAL 8 OR algo_index STREQUAL 9)
+ set (enable_ FALSE)
+ endif ()
+ endif ()
+ # L-BFGS
+ if (algo_index STREQUAL 10)
+ set (enable_ FALSE)
+ endif ()
+ if (enable_)
+ add_test (NAME testopt_algo${algo_index}_obj${obj_index} COMMAND testopt -a ${algo_index} -o ${obj_index})
+ endif ()
+ endforeach ()
+endforeach ()
+
+if (NUMPY_FOUND AND PYTHONLIBS_FOUND AND (SWIG_FOUND OR (EXISTS ${CMAKE_SOURCE_DIR}/swig/nlopt-python.cpp)))
+ set (PYINSTALLCHECK_ENVIRONMENT "LD_LIBRARY_PATH=${INSTALL_DESTDIR}${INSTALL_LIB_DIR}:$ENV{LD_LIBRARY_PATH}"
+ "PYTHONPATH=${INSTALL_DESTDIR}${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_PATH}${PATH_SEP}$ENV{PYTHONPATH}"
+ )
+ add_test (NAME test_std_python COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_std.py)
+ set_tests_properties (test_std_python PROPERTIES ENVIRONMENT "${PYINSTALLCHECK_ENVIRONMENT}")
+endif ()
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/api -I$(top_srcdir)/util
-
-noinst_PROGRAMS = testopt
-
-testopt_SOURCES = testfuncs.c testfuncs.h testopt.cpp
-testopt_LDADD = $(top_builddir)/libnlopt@NLOPT_SUFFIX@.la
-EXTRA_DIST = test_std.py
-
#endif
#ifdef HAVE_GETOPT_H
# include <getopt.h>
+#else
+int opterr = 1, /* if error message should be printed */
+ optind = 1, /* index into parent argv vector */
+ optopt, /* character checked for validity */
+ optreset; /* reset getopt */
+char *optarg; /* argument associated with option */
+
+#define BADCH (int)'?'
+#define BADARG (int)':'
+#define EMSG ""
+
+/*
+* getopt --
+* Parse argc/argv argument vector.
+*/
+int
+ getopt(int nargc, char * const nargv[], const char *ostr)
+{
+ static char *place = EMSG; /* option letter processing */
+ const char *oli; /* option letter list index */
+
+ if (optreset || !*place) { /* update scanning pointer */
+ optreset = 0;
+ if (optind >= nargc || *(place = nargv[optind]) != '-') {
+ place = EMSG;
+ return (-1);
+ }
+ if (place[1] && *++place == '-') { /* found "--" */
+ ++optind;
+ place = EMSG;
+ return (-1);
+ }
+ } /* option letter okay? */
+ if ((optopt = (int)*place++) == (int)':' ||
+ !(oli = strchr(ostr, optopt))) {
+ /*
+ * if the user didn't specify '-' as an option,
+ * assume it means -1.
+ */
+ if (optopt == (int)'-')
+ return (-1);
+ if (!*place)
+ ++optind;
+ if (opterr && *ostr != ':')
+ (void)printf("illegal option -- %c\n", optopt);
+ return (BADCH);
+ }
+ if (*++oli != ':') { /* don't need argument */
+ optarg = NULL;
+ if (!*place)
+ ++optind;
+ }
+ else { /* need an argument */
+ if (*place) /* no white space */
+ optarg = place;
+ else if (nargc <= ++optind) { /* no arg */
+ place = EMSG;
+ if (*ostr == ':')
+ return (BADARG);
+ if (opterr)
+ (void)printf("option requires an argument -- %c\n", optopt);
+ return (BADCH);
+ }
+ else /* white space */
+ optarg = nargv[optind];
+ place = EMSG;
+ ++optind;
+ }
+ return (optopt); /* dump back option letter */
+}
#endif
#define USE_FEENABLEEXCEPT 0
+++ /dev/null
-AM_CPPFLAGS = -I$(top_srcdir)/api
-
-noinst_LTLIBRARIES = libutil.la
-libutil_la_SOURCES = mt19937ar.c sobolseq.c soboldata.h timer.c stop.c nlopt-util.h redblack.c redblack.h qsort_r.c rescale.c
-
-noinst_PROGRAMS = redblack_test
-redblack_test_SOURCES = redblack_test.c
-redblack_test_LDADD = libutil.la
#include "nlopt-util.h"
-#if TIME_WITH_SYS_TIME
+#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
-# if HAVE_SYS_TIME_H
+# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>