From 29ecc013bb24d6ba6e3d8961f7f9d1c81f0d0eec Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 27 Feb 2009 16:45:32 +0000 Subject: [PATCH] Compatibility release compilation on windows --- salome_adm/cmake_files/FindHDF5.cmake | 6 +++++- salome_adm/cmake_files/FindPLATFORM.cmake | 15 +++++++++++++++ salome_adm/cmake_files/FindPTHREADS.cmake | 6 +++++- salome_adm/cmake_files/FindPYTHON.cmake | 17 ++++++++++++++--- salome_adm/cmake_files/am2cmake.py | 8 ++++++++ 5 files changed, 47 insertions(+), 5 deletions(-) diff --git a/salome_adm/cmake_files/FindHDF5.cmake b/salome_adm/cmake_files/FindHDF5.cmake index c0f0a60c1..27b784a83 100644 --- a/salome_adm/cmake_files/FindHDF5.cmake +++ b/salome_adm/cmake_files/FindHDF5.cmake @@ -29,7 +29,11 @@ FIND_PATH(HDF5_INCLUDES H5public.h ${HDF5_ROOT}/include) SET(HDF5_INCLUDES -I${HDF5_INCLUDES}) IF(WINDOWS) - FIND_LIBRARY(HDF5_LIBS hdf5d ${HDF5_ROOT}/lib) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + FIND_LIBRARY(HDF5_LIBS hdf5 ${HDF5_ROOT}/lib) + ELSE(CMAKE_BUILD_TYPE STREQUAL Release) + FIND_LIBRARY(HDF5_LIBS hdf5d ${HDF5_ROOT}/lib) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) ELSE(WINDOWS) FIND_LIBRARY(HDF5_LIBS hdf5 ${HDF5_ROOT}/lib) ENDIF(WINDOWS) diff --git a/salome_adm/cmake_files/FindPLATFORM.cmake b/salome_adm/cmake_files/FindPLATFORM.cmake index 068623d19..28fd28803 100644 --- a/salome_adm/cmake_files/FindPLATFORM.cmake +++ b/salome_adm/cmake_files/FindPLATFORM.cmake @@ -42,6 +42,21 @@ ELSE(WINDOWS) # SET(RM /bin/rm) ENDIF(WINDOWS) +IF(WINDOWS) + SET(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE}) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + MARK_AS_ADVANCED(CLEAR CMAKE_CONFIGURATION_TYPES) + SET(CMAKE_CONFIGURATION_TYPES Release CACHE STRING "compilation types" FORCE) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) +ENDIF(WINDOWS) + +IF(WINDOWS) + SET(CMAKE_INSTALL_PREFIX_ENV $ENV{CMAKE_INSTALL_PREFIX}) + IF(CMAKE_INSTALL_PREFIX_ENV) + SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX_ENV} CACHE PATH "installation prefix" FORCE) + ENDIF(CMAKE_INSTALL_PREFIX_ENV) +ENDIF(WINDOWS) + ## SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_DEBUG_) #SET(RCP rcp) diff --git a/salome_adm/cmake_files/FindPTHREADS.cmake b/salome_adm/cmake_files/FindPTHREADS.cmake index 0fe504c3f..514f2ed52 100644 --- a/salome_adm/cmake_files/FindPTHREADS.cmake +++ b/salome_adm/cmake_files/FindPTHREADS.cmake @@ -25,5 +25,9 @@ IF(PTHREADS_ROOT) IF(PTHREADS_INCLUDE_DIR) SET(PTHREADS_INCLUDES -I${PTHREADS_INCLUDE_DIR}) ENDIF(PTHREADS_INCLUDE_DIR) - FIND_LIBRARY(PTHREADS_LIBRARY pthreadVSE2d ${PTHREADS_ROOT}/lib) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + FIND_LIBRARY(PTHREADS_LIBRARY pthreadVSE2 ${PTHREADS_ROOT}/lib) + ELSE(CMAKE_BUILD_TYPE STREQUAL Release) + FIND_LIBRARY(PTHREADS_LIBRARY pthreadVSE2d ${PTHREADS_ROOT}/lib) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) ENDIF(PTHREADS_ROOT) diff --git a/salome_adm/cmake_files/FindPYTHON.cmake b/salome_adm/cmake_files/FindPYTHON.cmake index 4b84d7c58..d97820a0a 100644 --- a/salome_adm/cmake_files/FindPYTHON.cmake +++ b/salome_adm/cmake_files/FindPYTHON.cmake @@ -20,7 +20,11 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # IF(WINDOWS) - FIND_PROGRAM(PYTHON_EXECUTABLE python_d) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + FIND_PROGRAM(PYTHON_EXECUTABLE python) + ELSE(CMAKE_BUILD_TYPE STREQUAL Release) + FIND_PROGRAM(PYTHON_EXECUTABLE python_d) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) ELSE(WINDOWS) FIND_PROGRAM(PYTHON_EXECUTABLE python) ENDIF(WINDOWS) @@ -38,7 +42,11 @@ FIND_PATH(PYTHON_INCLUDE_PATH Python.h PATHS ${PYTHON_ROOT}/include ${PYTHON_ROO IF(WINDOWS) STRING(REPLACE "." "" PYTHON_VERSION_WITHOUT_DOT ${PYTHON_VERSION}) - FIND_LIBRARY(PYTHON_LIBRARIES python${PYTHON_VERSION_WITHOUT_DOT}_d ${PYTHON_ROOT}/libs) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + FIND_LIBRARY(PYTHON_LIBRARIES python${PYTHON_VERSION_WITHOUT_DOT} ${PYTHON_ROOT}/libs) + ELSE(CMAKE_BUILD_TYPE STREQUAL Release) + FIND_LIBRARY(PYTHON_LIBRARIES python${PYTHON_VERSION_WITHOUT_DOT}_d ${PYTHON_ROOT}/libs) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) ELSE(WINDOWS) FIND_LIBRARY(PYTHON_LIBRARIES python${PYTHON_VERSION} ${PYTHON_ROOT}/lib) ENDIF(WINDOWS) @@ -47,5 +55,8 @@ SET(PYTHON_INCLUDES -I${PYTHON_INCLUDE_PATH}) SET(PYTHON_LIBS ${PYTHON_LIBRARIES}) IF(WINDOWS) - SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -DHAVE_DEBUG_PYTHON) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + ELSE(CMAKE_BUILD_TYPE STREQUAL Release) + SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -DHAVE_DEBUG_PYTHON) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) ENDIF(WINDOWS) diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index 69108a07c..31a7fd163 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -1090,7 +1090,11 @@ class CMakeFile(object): SET(targets ${targets} medimportcxx) FOREACH(target ${targets}) IF(name STREQUAL ${target}) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT") + ELSE(CMAKE_BUILD_TYPE STREQUAL Release) SET_TARGET_PROPERTIES(${name} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMTD") + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) ENDIF(name STREQUAL ${target}) ENDFOREACH(target ${targets}) SET(targets) @@ -1472,7 +1476,11 @@ class CMakeFile(object): ELSE(BEGIN_WITH_lib) IF(WINDOWS) INSTALL(TARGETS ${name} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome) + IF(CMAKE_BUILD_TYPE STREQUAL Release) + INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome/${name}.dll DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.pyd) + ELSE(CMAKE_BUILD_TYPE STREQUAL Release) INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome/${name}.dll DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}_d.pyd) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) ELSE(WINDOWS) GET_TARGET_PROPERTY(version ${name} VERSION) GET_TARGET_PROPERTY(soversion ${name} SOVERSION) -- 2.39.2