From 1cd17428f25bfb9b5f5171d6c9a90db6e4166786 Mon Sep 17 00:00:00 2001 From: ana Date: Wed, 19 Sep 2012 11:22:18 +0000 Subject: [PATCH] Compilation SALOME by CMake(windows/linux) --- salome_adm/cmake_files/FindPLATFORM.cmake | 45 ++++++++++++++++------- salome_adm/cmake_files/FindPTHREADS.cmake | 3 +- salome_adm/cmake_files/UseOMNIORB.cmake | 15 ++++++-- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/salome_adm/cmake_files/FindPLATFORM.cmake b/salome_adm/cmake_files/FindPLATFORM.cmake index b6a36caca..9266320ac 100644 --- a/salome_adm/cmake_files/FindPLATFORM.cmake +++ b/salome_adm/cmake_files/FindPLATFORM.cmake @@ -79,29 +79,46 @@ IF(CMAKE_BUILD_TYPE) ENDIF(WINDOWS) ENDIF(CMAKE_BUILD_TYPE) -SET(PLATFORM_CPPFLAGS) -SET(PLATFORM_LDFLAGS) -SET(PLATFORM_LIBADD) +SET(PLATFORM_CPPFLAGS) # to be removed +SET(PLATFORM_LDFLAGS) # to be removed +SET(PLATFORM_LIBADD) # to be removed + +SET(PLATFORM_LIBS) +SET(PLATFORM_DEFINITIONS) + IF(WINDOWS) - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} /W0) - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_CRT_SECURE_NO_WARNINGS) # To disable windows warnings for strcpy, fopen, ... - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_SCL_SECURE_NO_WARNINGS) # To disable windows warnings std::copy, std::transform, ... - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT) - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DPPRO_NT) # For medfile - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_USE_MATH_DEFINES) # At least for MEDMEM - SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_WIN32_WINNT=0x0500) # Windows 2000 or later API is required - SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Ws2_32.lib) - SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Userenv.lib) # At least for GEOM suit + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} /W0) # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_CRT_SECURE_NO_WARNINGS) # To disable windows warnings for strcpy, fopen, ... # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_SCL_SECURE_NO_WARNINGS) # To disable windows warnings std::copy, std::transform, ... # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT) # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DPPRO_NT) # For medfile # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_USE_MATH_DEFINES) # At least for MEDMEM # to be removed + SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_WIN32_WINNT=0x0500) # Windows 2000 or later API is required # to be removed + SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Ws2_32.lib) # to be removed + SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Userenv.lib) # At least for GEOM suit # to be removed + + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} /W0") + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_CRT_SECURE_NO_WARNINGS") # To disable windows warnings for strcpy, fopen, ... + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SCL_SECURE_NO_WARNINGS") # To disable windows warnings std::copy, std::transform, ... + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DWNT") + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DPPRO_NT") # For medfile + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_USE_MATH_DEFINES") # At least for MEDMEM + SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_WIN32_WINNT=0x0500") # Windows 2000 or later API is required + SET(PLATFORM_LIBS ${PLATFORM_LIBS} Ws2_32.lib) + SET(PLATFORM_LIBS ${PLATFORM_LIBS} Userenv.lib) # At least for GEOM suit + ELSE(WINDOWS) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wparentheses) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wreturn-type) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wmissing-declarations) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wunused) # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wall) - SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl) + SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl) # to be removed + SET(PLATFORM_LIBS ${PLATFORM_LIBS} -ldl) ENDIF(WINDOWS) -SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${CMAKE_SIZEOF_VOID_P} -DSIZEOF_INT=4) +SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${CMAKE_SIZEOF_VOID_P} -DSIZEOF_INT=4") # to be removed +SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${CMAKE_SIZEOF_VOID_P} -DSIZEOF_INT=4") SET(COMPILATION_WITH_CMAKE ON) diff --git a/salome_adm/cmake_files/FindPTHREADS.cmake b/salome_adm/cmake_files/FindPTHREADS.cmake index f9ba97e55..ce8231e4a 100644 --- a/salome_adm/cmake_files/FindPTHREADS.cmake +++ b/salome_adm/cmake_files/FindPTHREADS.cmake @@ -79,7 +79,8 @@ IF(PTHREADS_STATUS) FIND_PATH(PTHREADS_INCLUDE_DIR ${PTHREADS_INCLUDE_TO_FIND} PATHS ${PTHREADS_INCLUDE_PATHS} ${PTHREADS_FIND_PATHS_OPTION}) IF(PTHREADS_INCLUDE_DIR) IF(PTHREADS_ROOT_USER) - SET(PTHREAD_CFLAGS -I${PTHREADS_INCLUDE_DIR}) + SET(PTHREAD_CFLAGS -I${PTHREADS_INCLUDE_DIR}) # to remove + SET(PTHREAD_INCLUDE_DIRS ${PTHREADS_INCLUDE_DIR}) ENDIF(PTHREADS_ROOT_USER) MESSAGE(STATUS "${PTHREADS_INCLUDE_TO_FIND} found in ${PTHREADS_INCLUDE_DIR}") ELSE(PTHREADS_INCLUDE_DIR) diff --git a/salome_adm/cmake_files/UseOMNIORB.cmake b/salome_adm/cmake_files/UseOMNIORB.cmake index 9cfcbb35b..d6f8e6f9c 100644 --- a/salome_adm/cmake_files/UseOMNIORB.cmake +++ b/salome_adm/cmake_files/UseOMNIORB.cmake @@ -36,19 +36,25 @@ ENDMACRO(OMNIORB_COMPILE_IDL_FORPYTHON_ON_INSTALL)") # MYMODULE is a string that will be used to create a target with sources containing *.cc coming from the compilation of ${MYIDLFILES} # MYIDLFILES containing all idl files to be compiled. # MYIDLCXXFLAGS containing all directories (only directories) where to find *.idl which depend ${MYIDLFILES}. -MACRO(OMNIORB_ADD_MODULE MYMODULE MYIDLFILES MYIDLCXXFLAGS) +# TYPE contains type of the library +MACRO(OMNIORB_ADD_MODULE MYMODULE MYIDLFILES MYIDLCXXFLAGS TYPE) SET(MYSOURCES) FOREACH(input ${MYIDLFILES}) - STRING(REGEX REPLACE ".idl" "" base ${input}) + GET_FILENAME_COMPONENT(base ${input} NAME_WE) +# STRING(REGEX REPLACE ".idl" "" base ${input}) SET(OMNIORB_IDLCXXFLAGS2 "${OMNIORB_IDLCXXFLAGS}") SET(src ${CMAKE_CURRENT_BINARY_DIR}/${base}SK.cc) SET(MYSOURCES ${MYSOURCES} ${src}) SET(outputs ${src}) SET(dynsrc ${CMAKE_CURRENT_BINARY_DIR}/${base}DynSK.cc) + SET(MYSOURCES ${MYSOURCES} ${dynsrc}) SET(outputs ${outputs} ${dynsrc}) SET(inc ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh) SET(outputs ${outputs} ${inc}) - SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) + GET_FILENAME_COMPONENT(path ${input} PATH) + IF(NOT path) + SET(input ${CMAKE_CURRENT_SOURCE_DIR}/${input}) + ENDIF(NOT path) SET(flags ${OMNIORB_IDLCXXFLAGS2}) STRING(REGEX MATCH "-bcxx" ISBCXX ${flags}) IF(NOT ISBCXX) @@ -76,5 +82,6 @@ MACRO(OMNIORB_ADD_MODULE MYMODULE MYIDLFILES MYIDLCXXFLAGS) STRING(REPLACE "\\" "/" IDLPYFLAGS ${IDLPYFLAGS}) INSTALL(CODE "OMNIORB_COMPILE_IDL_FORPYTHON_ON_INSTALL( \"${OMNIORB_IDL_PYTHON}\" \"${IDLPYFLAGS}\" \"${input}\" \"${CMAKE_INSTALL_PREFIX}/\${INSTALL_PYIDL_DIR}\" )") ENDFOREACH(input ${MYIDLFILES}) - ADD_LIBRARY(${MYMODULE} SHARED ${MYSOURCES}) + ADD_LIBRARY(${MYMODULE} ${TYPE} ${MYSOURCES}) + ENDMACRO(OMNIORB_ADD_MODULE) -- 2.39.2