From: ana Date: Wed, 26 Jun 2013 15:29:04 +0000 (+0000) Subject: Win32 compatibility X-Git-Tag: V2_0_0_WIN X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_2_0_0_WIN;p=tools%2Flibbatch.git Win32 compatibility --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e9b6f93..3903dcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,27 +39,7 @@ IF (BUILD_LOCAL_SUBMISSION) find_package (Local) ENDIF (BUILD_LOCAL_SUBMISSION) IF (BUILD_PYTHON_WRAPPING) - FIND_PACKAGE(PythonInterp) - IF (PYTHONINTERP_FOUND) - get_filename_component(PYTHON_BIN_DIR "${PYTHON_EXECUTABLE}" PATH) - get_filename_component(CMAKE_INCLUDE_PATH "${PYTHON_BIN_DIR}/../include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" ABSOLUTE) - get_filename_component(CMAKE_LIBRARY_PATH "${PYTHON_BIN_DIR}/../lib" ABSOLUTE) - ENDIF (PYTHONINTERP_FOUND) - # Set PythonLibs_FIND_VERSION To avoid problems when several versions are in the system - SET(PythonLibs_FIND_VERSION ${PYTHON_VERSION_STRING}) - set(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR} CACHE PATH "Path to Python directory") - if(EXISTS ${PYTHON_ROOT_DIR}) - if(WINDOWS) - if(CMAKE_BUILD_TYPE STREQUAL Debug) - SET(PYTHON_LIB_SUFFIX _d) - else(CMAKE_BUILD_TYPE STREQUAL Debug) - SET(PYTHON_LIB_SUFFIX) - endif(CMAKE_BUILD_TYPE STREQUAL Debug) - set(PYTHON_INCLUDE_DIR ${PYTHON_ROOT_DIR}/include) - set(PYTHON_LIBRARY ${PYTHON_ROOT_DIR}/libs/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}${PYTHON_LIB_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX}) - endif(WINDOWS) - endif(EXISTS ${PYTHON_ROOT_DIR}) - FIND_PACKAGE(PythonLibs) + FIND_PACKAGE(LibbatchPYTHON) FIND_PACKAGE(SWIG) ENDIF (BUILD_PYTHON_WRAPPING) diff --git a/CMakeModules/FindLibbatchPYTHON.cmake b/CMakeModules/FindLibbatchPYTHON.cmake new file mode 100755 index 0000000..1a74a6c --- /dev/null +++ b/CMakeModules/FindLibbatchPYTHON.cmake @@ -0,0 +1,51 @@ +# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Python detection for Salome + +set(PYTHON_ROOT_DIR $ENV{PYTHON_ROOT_DIR} CACHE PATH "Path to Python directory") + +if(WINDOWS) + if(CMAKE_BUILD_TYPE STREQUAL Debug) + SET(PythonInterp_FIND_VERSION _d) + SET(PYTHON_DEFINITIONS "-DHAVE_DEBUG_PYTHON") + endif(CMAKE_BUILD_TYPE STREQUAL Debug) +endif(WINDOWS) + +find_package(PythonInterp REQUIRED) +IF (PYTHONINTERP_FOUND) + get_filename_component(PYTHON_BIN_DIR "${PYTHON_EXECUTABLE}" PATH) + get_filename_component(CMAKE_INCLUDE_PATH "${PYTHON_BIN_DIR}/../include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" ABSOLUTE) + get_filename_component(CMAKE_LIBRARY_PATH "${PYTHON_BIN_DIR}/../lib" ABSOLUTE) +ENDIF (PYTHONINTERP_FOUND) + +# Set PythonLibs_FIND_VERSION To avoid problems when several versions are in the system +SET(PythonLibs_FIND_VERSION ${PYTHON_VERSION_STRING}) +if(EXISTS ${PYTHON_ROOT_DIR}) + if(WINDOWS) + if(CMAKE_BUILD_TYPE STREQUAL Debug) + SET(PYTHON_LIB_SUFFIX _d) + else(CMAKE_BUILD_TYPE STREQUAL Debug) + SET(PYTHON_LIB_SUFFIX) + endif(CMAKE_BUILD_TYPE STREQUAL Debug) + set(PYTHON_INCLUDE_DIR ${PYTHON_ROOT_DIR}/include) + set(PYTHON_LIBRARY ${PYTHON_ROOT_DIR}/libs/python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}${PYTHON_LIB_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX}) + endif(WINDOWS) +endif(EXISTS ${PYTHON_ROOT_DIR}) +find_package(PythonLibs REQUIRED)