1. Ruben Martinez
  2. BayesOpt

Commits

Ruben Martinez  committed b71b35c

Trying to compile Python in Windows

Comments (0)

Files changed (2)

File CMakeLists.txt Modified

View file
  • Ignore whitespace
  • Hide word diff
 
 IF(BAYESOPT_PYTHON_INTERFACE)
   INCLUDE(PythonMagic)
-#  INCLUDE(FindPython)
   INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
+#  find_package(python)
+#  find_python_module(numpy REQUIRED)
+#  string(REGEX REPLACE "__init.py.*" "core/include/${module}" 
+#	    		PY_MOD_INCLUDE "PY_NUMPY")
+#  include_directories(${PYTHON_INCLUDE_DIRS} ${PY_NUMPY_INCLUDE_DIRS} )
 
   ADD_LIBRARY(esopt MODULE ${BAYESOPT_SRCS}   
     ${WRAPPPERS_SRC} ${UTILS_SRC} ./python/bayesopt.cpp)

File cmake/FindPython.cmake Modified

View file
  • Ignore whitespace
  • Hide word diff
 endif()
 set(PYTHON_EXEC "${PYTHON_EXEC_}" CACHE FILEPATH "Path to Python interpreter")
 
-string(REGEX REPLACE "/bin/python.*" "" PYTHON_PREFIX "${PYTHON_EXEC_}")
-string(REGEX REPLACE "/bin/python.*" "" PYTHON_PREFIX2 "${PYTHON_EXEC}")
+if("${PYTHON_EXEC_}" MATCHES ".*/bin/.*")
+   string(REGEX REPLACE "/bin/python.*" "" PYTHON_PREFIX "${PYTHON_EXEC_}")
+   string(REGEX REPLACE "/bin/python.*" "" PYTHON_PREFIX2 "${PYTHON_EXEC}")
+else()
+   string(REGEX REPLACE "/python.*" "" PYTHON_PREFIX "${PYTHON_EXEC_}")
+   string(REGEX REPLACE "/python.*" "" PYTHON_PREFIX2 "${PYTHON_EXEC}")
+endif()
 
 execute_process(COMMAND "${PYTHON_EXEC}" "-c"
     "import sys; print('%d.%d' % (sys.version_info[0],sys.version_info[1]))"
     NAMES "python${PYTHON_VERSION_NO_DOTS}" "python${PYTHON_VERSION}"
     PATHS
         "${PYTHON_PREFIX}/lib"
+        "${PYTHON_PREFIX}/libs"
         [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${PYTHON_VERSION}\\InstallPath]/libs
     PATH_SUFFIXES "" "python${PYTHON_VERSION}/config"
     DOC "Python libraries" NO_DEFAULT_PATH)
 
+
 find_path(PYTHON_INCLUDE_DIRS "Python.h"
     PATHS
         "${PYTHON_PREFIX}/include"
         if(NOT _${module}_status)
             set(PY_${module_upper} ${_${module}_location} CACHE STRING
                 "Location of Python module ${module}")
+            set(PY_${module_upper}_INCLUDE_DIRS PY_MOD_INCLUDE CACHE STRING
+                "Location of Python module ${module}")
         endif(NOT _${module}_status)
     endif(NOT PY_${module_upper})
-    find_package_handle_standard_args(PY_${module} DEFAULT_MSG PY_${module_upper})
+    find_package_handle_standard_args(PY_${module} DEFAULT_MSG PY_${module_upper} PY_${module_upper}_INCLUDE_DIRS)
 endfunction(find_python_module)
 
 set(PYTHON_ARCH "unknown")