Salome HOME
Improve build procedure
authorvsr <vsr@opencascade.com>
Mon, 10 Feb 2014 14:35:14 +0000 (18:35 +0400)
committervsr <vsr@opencascade.com>
Mon, 10 Feb 2014 14:35:14 +0000 (18:35 +0400)
17 files changed:
CMakeLists.txt
CMakeModules/FindSimanIOWSO2.cmake [new file with mode: 0644]
CMakeModules/FindWSO2.cmake [new file with mode: 0644]
CMakeModules/SimanIOMacros.cmake [new file with mode: 0644]
misc/SimanIOConfig.cmake.in [new file with mode: 0644]
scripts/CMakeLists.txt [new file with mode: 0644]
src/CMakeLists.txt
src/SimanIO_Activity.cxx
src/SimanIO_Activity.hxx
src/SimanIO_Configuration.cxx
src/SimanIO_Configuration.hxx
src/SimanIO_Document.cxx
src/SimanIO_Document.hxx
src/SimanIO_Link.cxx
src/SimanIO_Link.hxx
src/SimanIO_Version.hxx.in [new file with mode: 0644]
src/TestCreateConfigFile.cpp

index 58f7a6671c8c3200552a930543918c752ec9828e..cfb8da2a93d81370052b3466e6a4df08fc8f3cf4 100644 (file)
@@ -1,5 +1,98 @@
-project(SimanIO)
-cmake_minimum_required(VERSION 2.4)
-add_subdirectory(src lib)
+#  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
+#
 
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
+PROJECT(SimanIO C CXX)
 
+# Versioning
+# ===========
+# Project name, upper case
+STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
+
+SET(${PROJECT_NAME_UC}_MAJOR_VERSION 0)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 1)
+SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
+SET(${PROJECT_NAME_UC}_VERSION
+  ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
+
+# Our own set of macros:
+LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
+INCLUDE(SimanIOMacros)
+
+# User options
+# ============
+IF(WIN32 AND NOT CYGWIN)
+  SET(INSTALL_CMAKE_CONFIG_DIR cmake)
+ELSE()
+  SET(INSTALL_CMAKE_CONFIG_DIR share/cmake/simanio)
+ENDIF()
+SET(INSTALL_INCLUDE_DIR include)
+
+# Prerequisites detection:
+# ========================
+FIND_PACKAGE(SimanIOWSO2 REQUIRED)
+
+# Configure
+# =========
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/SimanIO_Version.hxx.in ${CMAKE_CURRENT_BINARY_DIR}/src/SimanIO_Version.hxx @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/SimanIO_Version.hxx DESTINATION include)
+
+ADD_SUBDIRECTORY(src)
+ADD_SUBDIRECTORY(scripts)
+
+# Export logic
+# ============
+INCLUDE(CMakePackageConfigHelpers)
+
+# Add all targets to the build-tree export set
+EXPORT(TARGETS SimanIO FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
+
+# Create the configuration files:
+#   - in the build tree:
+
+#      Ensure the variables are always defined for the configure:
+SET(WSO2_ROOT_DIR "${WSO2_ROOT_DIR}")
+SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
+CONFIGURE_PACKAGE_CONFIG_FILE(misc/${PROJECT_NAME}Config.cmake.in 
+    ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
+    INSTALL_DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}"
+    PATH_VARS CONF_INCLUDE_DIRS INSTALL_CMAKE_CONFIG_DIR CMAKE_INSTALL_PREFIX WSO2_ROOT_DIR)
+
+#   - in the install tree:
+#       Get the relative path of the include directory so 
+#       we can register it in the generated configuration files:
+SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
+CONFIGURE_PACKAGE_CONFIG_FILE(misc/${PROJECT_NAME}Config.cmake.in 
+    ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
+    INSTALL_DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}"
+    PATH_VARS CONF_INCLUDE_DIRS INSTALL_CMAKE_CONFIG_DIR CMAKE_INSTALL_PREFIX WSO2_ROOT_DIR)
+
+WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
+    VERSION ${${PROJECT_NAME_UC}_VERSION}
+    COMPATIBILITY AnyNewerVersion)
+  
+# Install the CMake configuration files:
+INSTALL(FILES
+  "${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake"
+  "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
+  DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}")
+
+# Install the export set for use with the install-tree
+INSTALL(EXPORT ${PROJECT_NAME}Targets DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}")
diff --git a/CMakeModules/FindSimanIOWSO2.cmake b/CMakeModules/FindSimanIOWSO2.cmake
new file mode 100644 (file)
index 0000000..2a30aaa
--- /dev/null
@@ -0,0 +1,25 @@
+# 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
+#
+
+# WSO2 WSF/C++ cpp detection for SimanIO
+#
+#  !! Please read the generic detection procedure in SimanIOMacros.cmake !!
+#
+SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(WSO2 WSO2_INCLUDE_DIR 1)
+MARK_AS_ADVANCED(WSO2_LIBRARIES WSO2_INCLUDES WSO2_INCLUDE_DIR)
diff --git a/CMakeModules/FindWSO2.cmake b/CMakeModules/FindWSO2.cmake
new file mode 100644 (file)
index 0000000..7ebffd6
--- /dev/null
@@ -0,0 +1,60 @@
+# - Find WSO2 WSF/C++
+# This module finds an installed WSO2 WSF/C++ using the variable WSO2_ROOT_DIR 
+# as a lookup path.
+# It sets the following variables:
+#   WSO2_FOUND       - set to true if WSO2 WSF/C++ is found
+#   WSO2_INCLUDE_DIR - the directories where the main include files are located
+#   WSO2_INCLUDES    - the list of directories for headers search path
+#   WSO2_LIBRARIES   - WSO2 WSF/C++ libraries to be linked against 
+
+#############################################################
+#  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
+#
+#############################################################
+
+IF (NOT WSO2_FIND_QUIETLY)
+    MESSAGE(STATUS "Looking for WSO2 WSF/C++...")
+ENDIF ()
+
+SET(WSO2_ROOT_DIR $ENV{WSO2_ROOT_DIR})
+
+IF(WSO2_ROOT_DIR)
+  LIST(APPEND CMAKE_PREFIX_PATH "${WSO2_ROOT_DIR}")
+ENDIF(WSO2_ROOT_DIR)
+
+FIND_PATH(WSO2_INCLUDE_DIR  WSFDefines.h PATH_SUFFIXES include)
+# TODO: detect axis includes automatically, without below hardcoded search path
+FIND_PATH(WSO2_INCLUDE_DIR_axis2 axutil_version.h PATH_SUFFIXES include include/axis2-1.6.0)
+
+SET(WSO2_INCLUDES ${WSO2_INCLUDE_DIR})
+IF(WSO2_INCLUDE_DIR_axis2)
+  LIST(APPEND WSO2_INCLUDES ${WSO2_INCLUDE_DIR_axis2} ${WSO2_INCLUDE_DIR_axis2}/platforms)
+ENDIF()
+
+FIND_LIBRARY(WSO2_LIBRARY_axis2_axiom  NAMES axis2_axiom)
+FIND_LIBRARY(WSO2_LIBRARY_axis2_engine NAMES axis2_engine)
+FIND_LIBRARY(WSO2_LIBRARY_wso2_wsf     NAMES wso2_wsf)
+
+SET(WSO2_LIBRARIES)
+SET(WSO2_LIBRARIES ${WSO2_LIBRARIES} ${WSO2_LIBRARY_axis2_axiom})
+SET(WSO2_LIBRARIES ${WSO2_LIBRARIES} ${WSO2_LIBRARY_axis2_engine})
+SET(WSO2_LIBRARIES ${WSO2_LIBRARIES} ${WSO2_LIBRARY_wso2_wsf})
+
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(WSO2 REQUIRED_VARS WSO2_INCLUDE_DIR WSO2_INCLUDES WSO2_LIBRARIES)
diff --git a/CMakeModules/SimanIOMacros.cmake b/CMakeModules/SimanIOMacros.cmake
new file mode 100644 (file)
index 0000000..78fde01
--- /dev/null
@@ -0,0 +1,302 @@
+#  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
+#
+
+###
+# SALOME_CHECK_EQUAL_PATHS(result path1 path2)
+#  Check if two paths are identical, resolving links. If the paths do not exist a simple
+#  text comparison is performed.
+#  result is a boolean.
+###
+MACRO(SALOME_CHECK_EQUAL_PATHS varRes path1 path2)  
+  SET("${varRes}" OFF)
+  IF(EXISTS "${path1}")
+    GET_FILENAME_COMPONENT(_tmp1 "${path1}" REALPATH)
+  ELSE()
+    SET(_tmp1 "${path1}")
+  ENDIF() 
+
+  IF(EXISTS "${path2}")
+    GET_FILENAME_COMPONENT(_tmp2 "${path2}" REALPATH)
+  ELSE()
+    SET(_tmp2 "${path2}")
+  ENDIF() 
+
+  IF("${_tmp1}" STREQUAL "${_tmp2}")
+    SET("${varRes}" ON)
+  ENDIF()
+#  MESSAGE(${${varRes}})
+ENDMACRO()
+
+####
+# SALOME_FIND_PACKAGE(englobingPackageName standardPackageName modus [onlyTryQuietly])
+#
+# example:  SALOME_FIND_PACKAGE(SalomeVTK VTK CONFIG)
+#
+# Encapsulate the call to the standard FIND_PACKAGE(standardPackageName) passing all the options
+# given when calling the command FIND_PACKAGE(SimanIOXyz). Those options are stored implicitly in 
+# CMake variables: Xyz_FIND_QUIETLY, Xyz_FIND_REQUIRED, etc ...
+# 
+# If a list of components was specified when invoking the initial FIND_PACKAGE(SimanIOXyz ...) this is 
+# also handled properly.
+#
+# Modus is either MODULE or CONFIG (cf standard FIND_PACKAGE() documentation).
+# The last argument is optional and if set to TRUE will force the search to be OPTIONAL and QUIET.
+# If the package is looked for in CONFIG mode, the standard system paths are skipped. If you still want a 
+# system installation to be found in this mode, you have to set the ROOT_DIR variable explicitly to /usr (for
+# example). 
+#  
+# This macro is to be called from within the FindSimanIOXyz.cmake files (where Xyz is some package to be detected).
+#
+####
+MACRO(SALOME_FIND_PACKAGE englobPkg stdPkg mode)
+  SET(_OPT_ARG ${ARGV3})
+  # Only bother if the package was not already found:
+  # Some old packages use the lower case version - standard should be to always use
+  # upper case:
+  STRING(TOUPPER ${stdPkg} stdPkgUC)
+  IF(NOT (${stdPkg}_FOUND OR ${stdPkgUC}_FOUND))
+    IF(${englobPkg}_FIND_QUIETLY OR _OPT_ARG)
+      SET(_tmp_quiet "QUIET")
+    ELSE()
+      SET(_tmp_quiet)
+    ENDIF()  
+    IF(${englobPkg}_FIND_REQUIRED AND NOT _OPT_ARG)
+      SET(_tmp_req "REQUIRED")
+    ELSE()
+      SET(_tmp_req)
+    ENDIF()  
+    IF(${englobPkg}_FIND_VERSION_EXACT)
+      SET(_tmp_exact "EXACT")
+    ELSE()
+      SET(_tmp_exact)
+    ENDIF()
+
+    # Call the CMake FIND_PACKAGE() command:    
+    STRING(TOLOWER ${stdPkg} _pkg_lc)
+    IF(("${mode}" STREQUAL "NO_MODULE") OR ("${mode}" STREQUAL "CONFIG"))
+      # Hope to find direclty a CMake config file, indicating the SALOME CMake file
+      # paths (the command already looks in places like "share/cmake", etc ... by default)
+      # Note the options NO_CMAKE_BUILDS_PATH, NO_CMAKE_PACKAGE_REGISTRY to avoid (under Windows)
+      # looking into a previous CMake build done via a GUI, or into the Win registry.
+      # NO_CMAKE_SYSTEM_PATH and NO_SYSTEM_ENVIRONMENT_PATH ensure any _system_ files like 'xyz-config.cmake' 
+      # don't get loaded (typically Boost). To force their loading, set the XYZ_ROOT_DIR variable to '/usr'. 
+      # See documentation of FIND_PACKAGE() for full details.
+      
+      # Do we need to call the signature using components?
+      IF(${englobPkg}_FIND_COMPONENTS)
+        FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
+              NO_MODULE ${_tmp_quiet} ${_tmp_req} COMPONENTS ${${englobPkg}_FIND_COMPONENTS}
+              NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH
+                NO_SYSTEM_ENVIRONMENT_PATH)
+      ELSE()
+        FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
+              NO_MODULE ${_tmp_quiet} ${_tmp_req}
+              NO_CMAKE_BUILDS_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PATH
+                 NO_SYSTEM_ENVIRONMENT_PATH)
+      ENDIF()
+      MARK_AS_ADVANCED(${stdPkg}_DIR)
+      
+    ELSEIF("${mode}" STREQUAL "MODULE")
+    
+      # Do we need to call the signature using components?
+      IF(${englobPkg}_FIND_COMPONENTS)
+        FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
+              MODULE ${_tmp_quiet} ${_tmp_req} COMPONENTS ${${englobPkg}_FIND_COMPONENTS})
+      ELSE()
+        FIND_PACKAGE(${stdPkg} ${${englobPkg}_FIND_VERSION} ${_tmp_exact} 
+              MODULE ${_tmp_quiet} ${_tmp_req})
+      ENDIF()
+      
+    ELSE()
+    
+      MESSAGE(FATAL_ERROR "Invalid mode argument in the call to the macro SALOME_FIND_PACKAGE. Should be CONFIG or MODULE.")
+      
+    ENDIF()
+    
+  ENDIF()
+ENDMACRO()
+
+
+####################################################################
+# SALOME_FIND_PACKAGE_DETECT_CONFLICTS(pkg referenceVariable upCount)
+#    pkg              : name of the system package to be detected
+#    referenceVariable: variable containing a path that can be browsed up to 
+# retrieve the package root directory (xxx_ROOT_DIR)
+#    upCount          : number of times we have to go up from the path <referenceVariable>
+# to obtain the package root directory.
+#   
+# For example:  SALOME_FIND_PACKAGE_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2) 
+#
+# Generic detection (and conflict check) procedure for package XYZ:
+# 1. Load a potential env variable XYZ_ROOT_DIR as a default choice for the cache entry XYZ_ROOT_DIR
+#    If empty, load a potential XYZ_ROOT_DIR_EXP as default value (path exposed by another package depending
+# directly on XYZ)
+# 2. Invoke FIND_PACKAGE() in this order:
+#    * in CONFIG mode first (if possible): priority is given to a potential 
+#    "XYZ-config.cmake" file
+#    * then switch to the standard MODULE mode, appending on CMAKE_PREFIX_PATH 
+# the above XYZ_ROOT_DIR variable
+# 3. Extract the path actually found into a temp variable _XYZ_TMP_DIR
+# 4. Warn if XYZ_ROOT_DIR is set and doesn't match what was found (e.g. when CMake found the system installation
+#    instead of what is pointed to by XYZ_ROOT_DIR - happens when a typo in the content of XYZ_ROOT_DIR).
+# 5. Conflict detection:
+#    * check the temp variable against a potentially existing XYZ_ROOT_DIR_EXP
+# 6. Finally expose what was *actually* found in XYZ_ROOT_DIR.  
+# 7. Specific stuff: for example exposing a prerequisite of XYZ to the rest of the world for future 
+# conflict detection. This is added after the call to the macro by the callee.
+#
+MACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS pkg referenceVariable upCount)
+  ##
+  ## 0. Initialization
+  ##
+  
+  # Package name, upper case
+  STRING(TOUPPER ${pkg} pkg_UC)
+
+  ##
+  ## 1. Load environment or any previously detected root dir for the package
+  ##
+  IF(DEFINED ENV{${pkg_UC}_ROOT_DIR})
+    FILE(TO_CMAKE_PATH "$ENV{${pkg_UC}_ROOT_DIR}" _${pkg_UC}_ROOT_DIR_ENV)
+    SET(_dflt_value "${_${pkg_UC}_ROOT_DIR_ENV}")
+  ELSE()
+    # will be blank if no package was previously loaded:
+    SET(_dflt_value "${${pkg_UC}_ROOT_DIR_EXP}")
+  ENDIF()
+
+  # Detect if the variable has been set on the command line or elsewhere:
+  IF(DEFINED ${pkg_UC}_ROOT_DIR)
+     SET(_var_already_there TRUE)
+  ELSE()
+     SET(_var_already_there FALSE)
+  ENDIF()
+  #   Make cache entry 
+  SET(${pkg_UC}_ROOT_DIR "${_dflt_value}" CACHE PATH "Path to ${pkg_UC} directory")
+
+  ##
+  ## 2. Find package - try CONFIG mode first (i.e. looking for XYZ-config.cmake)
+  ##
+  
+  # Override the variable - don't append to it, as it would give precedence
+  # to what was stored there before!  
+  SET(CMAKE_PREFIX_PATH "${${pkg_UC}_ROOT_DIR}")
+    
+  # Try find_package in config mode. This has the priority, but is 
+  # performed QUIET and not REQUIRED:
+  SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} NO_MODULE TRUE)
+  
+  IF (${pkg_UC}_FOUND OR ${pkg}_FOUND)
+    MESSAGE(STATUS "Found ${pkg} in CONFIG mode!")
+  ENDIF()
+
+  # Otherwise try the standard way (module mode, with the standard CMake Find*** macro):
+  # We do it quietly to produce our own error message, except if we are in debug mode:
+  IF(SALOME_CMAKE_DEBUG)
+    SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE FALSE)
+  ELSE()
+    SALOME_FIND_PACKAGE("Salome${pkg}" ${pkg} MODULE TRUE)
+  ENDIF()
+  
+  # Set the "FOUND" variable for the SALOME wrapper:
+  IF(${pkg_UC}_FOUND OR ${pkg}_FOUND)
+    SET(SALOME${pkg_UC}_FOUND TRUE)
+  ELSE()
+    SET(SALOME${pkg_UC}_FOUND FALSE)
+    IF(NOT Salome${pkg}_FIND_QUIETLY)
+      IF(Salome${pkg}_FIND_REQUIRED)
+         MESSAGE(FATAL_ERROR "Package ${pkg} couldn't be found - did you set the corresponing root dir correctly? "
+         "It currently contains ${pkg_UC}_ROOT_DIR=${${pkg_UC}_ROOT_DIR}  "
+         "Append -DSALOME_CMAKE_DEBUG=ON on the command line if you want to see the original CMake error.")
+      ELSE()
+         MESSAGE(WARNING "Package ${pkg} couldn't be found - did you set the corresponing root dir correctly? "
+         "It currently contains ${pkg_UC}_ROOT_DIR=${${pkg_UC}_ROOT_DIR}  "
+         "Append -DSALOME_CMAKE_DEBUG=ON on the command line if you want to see the original CMake error.")
+      ENDIF()
+    ENDIF()
+  ENDIF()
+  
+  IF (${pkg_UC}_FOUND OR ${pkg}_FOUND)
+    ## 3. Set the root dir which was finally retained by going up "upDir" times
+    ## from the given reference path. The variable "referenceVariable" may be a list.
+    ## In this case we take its first element. 
+    
+    # First test if the variable exists, warn otherwise:
+    IF(NOT DEFINED ${referenceVariable})
+      MESSAGE(WARNING "${pkg}: the reference variable '${referenceVariable}' used when calling the macro "
+      "SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS() is not defined.")
+    ENDIF()
+    
+    LIST(LENGTH ${referenceVariable} _tmp_len)
+    IF(_tmp_len)
+       LIST(GET ${referenceVariable} 0 _tmp_ROOT_DIR)
+    ELSE()
+       #  Note the double de-reference of "referenceVariable":
+       SET(_tmp_ROOT_DIR "${${referenceVariable}}")
+    ENDIF()
+    IF(${upCount}) 
+      FOREACH(_unused RANGE 1 ${upCount})        
+        GET_FILENAME_COMPONENT(_tmp_ROOT_DIR "${_tmp_ROOT_DIR}" PATH)
+      ENDFOREACH()
+    ENDIF()
+
+    ##
+    ## 4. Warn if CMake found something not located under ENV(XYZ_ROOT_DIR)
+    ##
+    IF(DEFINED ENV{${pkg_UC}_ROOT_DIR})
+      SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${_${pkg_UC}_ROOT_DIR_ENV}")
+      IF(NOT _res)
+        MESSAGE(WARNING "${pkg} was found, but not at the path given by the "
+            "environment ${pkg_UC}_ROOT_DIR! Is the variable correctly set? "
+            "The two paths are: ${_tmp_ROOT_DIR} and: ${_${pkg_UC}_ROOT_DIR_ENV}")
+        
+      ELSE()
+        MESSAGE(STATUS "${pkg} found directory matches what was specified in the ${pkg_UC}_ROOT_DIR variable, all good!")    
+      ENDIF()
+    ELSE()
+        IF(NOT _var_already_there) 
+          MESSAGE(STATUS "Variable ${pkg_UC}_ROOT_DIR was not explicitly defined. "
+          "An installation was found anyway: ${_tmp_ROOT_DIR}")
+        ENDIF()
+    ENDIF()
+
+    ##
+    ## 5. Conflict detection
+    ##     From another prerequisite using the package:
+    ##
+    IF(${pkg_UC}_ROOT_DIR_EXP)
+        SALOME_CHECK_EQUAL_PATHS(_res "${_tmp_ROOT_DIR}" "${${pkg_UC}_ROOT_DIR_EXP}") 
+        IF(NOT _res)
+           MESSAGE(WARNING "Warning: ${pkg}: detected version conflicts with a previously found ${pkg}!"
+                           " The two paths are " ${_tmp_ROOT_DIR} " vs " ${${pkg_UC}_ROOT_DIR_EXP})
+        ELSE()
+            MESSAGE(STATUS "${pkg} directory matches what was previously exposed by another prereq, all good!")
+        ENDIF()        
+    ENDIF()
+    
+    ##
+    ## 6. Save the detected installation
+    ##
+    SET(${pkg_UC}_ROOT_DIR "${_tmp_ROOT_DIR}")
+     
+  ELSE()
+    MESSAGE(STATUS "${pkg} was not found.")  
+  ENDIF()
+  
+  SET(Salome${pkg}_FOUND "${pkg}_FOUND")
+ENDMACRO(SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS)
diff --git a/misc/SimanIOConfig.cmake.in b/misc/SimanIOConfig.cmake.in
new file mode 100644 (file)
index 0000000..f066615
--- /dev/null
@@ -0,0 +1,52 @@
+# - Config file for the @PROJECT_NAME@ package
+# It defines the following variables. 
+# Specific to the package @PROJECT_NAME@ itself:
+#  @PROJECT_NAME_UC@_INCLUDE_DIRS - include directories 
+#  @PROJECT_NAME_UC@_LIBRARIES    - libraries to link against
+#  @PROJECT_NAME_UC@_ROOT_DIR_EXP - the root path of the installation providing this CMake file
+#
+###############################################################
+#  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
+###############################################################
+
+### Initialisation performed by CONFIGURE_PACKAGE_CONFIG_FILE:
+@PACKAGE_INIT@
+
+### First the generic stuff for a standard module:
+SET(SIMANIO_INCLUDE_DIRS "@PACKAGE_CONF_INCLUDE_DIRS@")
+
+# Load the dependencies for the libraries of @PROJECT_NAME@ 
+# (contains definitions for IMPORTED targets). This is only 
+# imported if we are not built as a subproject (in this case targets are already there)
+IF(NOT SimanIO AND NOT @PROJECT_NAME@_BINARY_DIR)
+  INCLUDE("@PACKAGE_INSTALL_CMAKE_CONFIG_DIR@/@PROJECT_NAME@Targets.cmake")
+ENDIF()   
+
+# These are IMPORTED targets created by @PROJECT_NAME@Targets.cmake
+SET(SIMANIO_LIBRARIES SimanIO)
+
+# Package root dir:
+SET_AND_CHECK(SIMANIO_ROOT_DIR_EXP "@PACKAGE_CMAKE_INSTALL_PREFIX@")
+
+#### Now the specificities
+
+# Options exported by the package:
+
+SET_AND_CHECK(WSO2_ROOT_DIR_EXP "@PACKAGE_WSO2_ROOT_DIR@")
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4ad82fa
--- /dev/null
@@ -0,0 +1,24 @@
+#  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
+#
+
+# [ files to be installed ]
+FILE(GLOB _install_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.sh")
+
+LIST(APPEND _install_FILES INSTALL_Applications.txt README)
+INSTALL(FILES ${_install_FILES} DESTINATION share/simanio/misc)
index 7c2b65a16d1aa84ffdfa8db335cc16e707ff14b2..173f5dfc89879413259b8e35938a3f0e0f2b3831 100644 (file)
@@ -1,19 +1,73 @@
-project(SimanSrc CXX)
+#  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
+#
 
-set(SimanSrc_SRCS SimanIO_Activity.cxx SimanIO_Configuration.cxx SimanIO_Document.cxx SimanIO_Link.cxx CheckIn.cpp CheckInResponse.cpp CreateConfigFile.cpp CreateConfigFileResponse.cpp GetFile.cpp GetFileResponse.cpp PutFile.cpp PutFileResponse.cpp SimanSalomeServiceStub.cpp)
-set(SimanSrc_HEADERS SimanIO_Activity.hxx SimanIO_Configuration.hxx SimanIO_Document.hxx SimanIO_Link.hxx CheckIn.h CheckInResponse.h CreateConfigFile.h CreateConfigFileResponse.h GetFile.h GetFileResponse.h ISimanSalomeServiceCallback.h PutFile.h PutFileResponse.h SimanSalomeServiceStub.h)
-include_directories($(PROJECT_SOURCE_DIR) $ENV{WSFCPP_HOME}/include $ENV{WSFCPP_HOME}/include/axis2-1.6.0 $ENV{WSFCPP_HOME}/include/axis2-1.6.0/platforms)
+# [ additional include dirs ]
+INCLUDE_DIRECTORIES(
+  ${WSO2_INCLUDES}
+  ${CMAKE_CURRENT_SOURCE_DIR}
+)
 
-add_library(SimanIO SHARED ${SimanSrc_SRCS} ${SimanSrc_HEADERS} $ENV{WSFCPP_HOME}/lib)
-target_link_libraries(SimanIO $ENV{WSFCPP_HOME}/lib $ENV{WSFCPP_HOME}/lib/libaxis2_axiom.so $ENV{WSFCPP_HOME}/lib/libaxis2_engine.so $ENV{WSFCPP_HOME}/lib/libwso2_wsf.so)
+# [ headers to be installed ]
+SET(SimanIO_HEADERS
+  SimanIO_Activity.hxx
+  SimanIO_Configuration.hxx
+  SimanIO_Document.hxx
+  SimanIO_Link.hxx
+)
 
-install(TARGETS SimanIO DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
-install(FILES ${SimanSrc_HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
-
-# add_executable(TestCreateConfigFile TestCreateConfigFile.cpp)
-# target_link_libraries(TestCreateConfigFile ${CMAKE_INSTALL_PREFIX}/lib/libSimanIO.so $ENV{WSFCPP_HOME}/lib/libaxis2_axiom.so $ENV{WSFCPP_HOME}/lib/libaxis2_engine.so $ENV{WSFCPP_HOME}/lib/libwso2_wsf.so)
-# install(TARGETS TestCreateConfigFile DESTINATION bin)
+# [ generated sources ]
+# TODO: add procedure of automatic generation of the sources from the skeleton
+# TODO: this will raise dependency of SimanIO on SIMAN (where skeleton file is)
+#       and Apache Axis2/Java (which is used to generate wrappings)
+SET(_generated_SOURCES
+  CheckIn.cpp
+  CheckInResponse.cpp
+  CreateConfigFile.cpp
+  CreateConfigFileResponse.cpp
+  GetFile.cpp
+  GetFileResponse.cpp
+  PutFile.cpp
+  PutFileResponse.cpp
+  SimanSalomeServiceStub.cpp
+)
 
+# [ static sources ]
+SET(_other_SOURCES
+  SimanIO_Activity.cxx
+  SimanIO_Configuration.cxx
+  SimanIO_Document.cxx
+  SimanIO_Link.cxx
+)
 
+# [ all sources to be compiled ]
+SET(SimanIO_SOURCES
+  ${_generated_SOURCES}
+  ${_other_SOURCES}
+)
 
+# [ target: library ]
+ADD_LIBRARY(SimanIO SHARED ${SimanIO_SOURCES})
+TARGET_LINK_LIBRARIES(SimanIO ${PLATFORM_LIBS} ${WSO2_LIBRARIES})
+INSTALL(TARGETS SimanIO EXPORT ${PROJECT_NAME}Targets DESTINATION lib)
+INSTALL(FILES ${SimanIO_HEADERS} DESTINATION include)
 
+# [ target: test ]
+ADD_EXECUTABLE(TestCreateConfigFile TestCreateConfigFile.cpp)
+TARGET_LINK_LIBRARIES(TestCreateConfigFile SimanIO)
+INSTALL(TARGETS TestCreateConfigFile DESTINATION bin)
index 870a58d5a51349cd054b269036b2e8d333c34bd2..ad6e421bb3840e23be56b32e600af7aa1eb06668 100644 (file)
@@ -1,6 +1,23 @@
-#include <SimanIO_Activity.hxx>
+// 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
+//
 
-using namespace std;
+#include "SimanIO_Activity.hxx"
 
 SimanIO_Activity::SimanIO_Activity()
 {
index 6fada146b9c1829fe3fece0bf9fa4fc55e7aea1b..828da48ef8984926390bef9f0ebe51af03c697cc 100644 (file)
@@ -1,8 +1,28 @@
+// 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
+//
+
 #ifndef SIMANIO_ACTIVITY_H
 #define SIMANIO_ACTIVITY_H
 
-#include <SimanIO_Document.hxx>
+#include "SimanIO_Document.hxx"
 
+#include <string>
 #include <map>
 
 /**
index 22aedb9059a89f33b0af1d1e2f06eab09c2a30d8..2843627ac6095046b2a17ebc1224f91b98925cde 100644 (file)
@@ -1,4 +1,23 @@
-#include <SimanIO_Configuration.hxx>
+// 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
+//
+
+#include "SimanIO_Configuration.hxx"
 
 #include <stdlib.h>
 
index 9c08fe1129d5d3a6029d0e9c51669243258f9275..3821d61f27531c61efea4f773491b460b9db6de6 100644 (file)
@@ -1,7 +1,27 @@
+// 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
+//
+
 #ifndef SIMANIO_CONFIGURATION_H
 #define SIMANIO_CONFIGURATION_H
 
-#include <SimanIO_Activity.hxx>
+#include "SimanIO_Activity.hxx"
+
 #include <fstream>
 #include <iostream>
 
index 9053d9a427fda76e7450c890af35f8eb96af9480..88a5a2a6d084f2f75a51219843c3a835a04ab8ba 100644 (file)
@@ -1,6 +1,23 @@
-#include <SimanIO_Document.hxx>
+// 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
+//
 
-using namespace std;
+#include "SimanIO_Document.hxx"
 
 SimanIO_Document::SimanIO_Document()
 {
index d002986b945fbacac56965ce03a21098c409b9ab..1d0d8df1169b3459ba35aa3393c7e87c2b6236da 100644 (file)
@@ -1,3 +1,22 @@
+// 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
+//
+
 #ifndef SIMANIO_DOCUMENT_H
 #define SIMANIO_DOCUMENT_H
 
index 6542279ae17dea3e09413bcb3902fcb301aebf1a..8987a93bdad7651a59eab30409f9fd2bcc4b9e64 100644 (file)
@@ -1,3 +1,22 @@
+// 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
+//
+
 #include "CreateConfigFile.h"
 #include "CreateConfigFileResponse.h"
 #include "GetFile.h"
 #include "PutFileResponse.h"
 #include "SimanSalomeServiceStub.h"
 
+#include "SimanIO_Link.hxx"
+
 #include <Environment.h>
+#include <ServiceClient.h>
+
 #include <iostream>
 #include <fstream>
 #include <sstream>
-#include <ServiceClient.h>
-#include <SimanIO_Link.hxx>
-
-
 #include <algorithm>
 
-
-using namespace std;
 using namespace org_splat_ws_server_service_salome;
 using namespace wso2wsf;
 
@@ -34,7 +51,7 @@ bool SimanIO_Link::IsConnected()
 }
 
 // unification of the error handling in the RetrieveConf and StoreConf  methods
-#define CONFIGURSION_ERROR(message) {cerr<<message<<endl;}
+#define CONFIGURSION_ERROR(message) {std::cerr<<message<<std::endl;}
 
 SimanIO_Configuration SimanIO_Link::RetrieveConf()
 {
@@ -49,8 +66,8 @@ SimanIO_Configuration SimanIO_Link::RetrieveConf()
     return aResult;
   }
   
-  string aSimanWSHost(aSimanHost);
-  string anEndpointUri = "http://" + aSimanWSHost + "/Siman-WS/services/SimanSalomeService";
+  std::string aSimanWSHost(aSimanHost);
+  std::string anEndpointUri = "http://" + aSimanWSHost + "/Siman-WS/services/SimanSalomeService";
   
   Environment::initialize("SimanSalomeService.log",AXIS2_LOG_LEVEL_DEBUG);
   char* aClientHomeEnv = getenv("WSFCPP_HOME");
@@ -61,7 +78,7 @@ SimanIO_Configuration SimanIO_Link::RetrieveConf()
     return aResult;
   }
   
-  string aClientHome = AXIS2_GETENV("WSFCPP_HOME");
+  std::string aClientHome = AXIS2_GETENV("WSFCPP_HOME");
   SimanSalomeServiceStub* aStub = new SimanSalomeServiceStub(aClientHome, anEndpointUri);
   ServiceClient *client = aStub->getServiceClient();
   
@@ -82,16 +99,15 @@ SimanIO_Configuration SimanIO_Link::RetrieveConf()
   aCreateConfigFileRequest->setArgs1(atoll(myScenario.c_str()));
   aCreateConfigFileRequest->setArgs2(atoll(myUser.c_str()));
   
-  //cout<<"StudyId = " << atoll(myStudy.c_str()) << "\n";
-  //cout<<"ScenarioId = " << atoll(myScenario.c_str()) << "\n";
-  //cout<<"UserId = " << atoll(myUser.c_str()) << "\n";
+  //std::cout<<"StudyId = " << atoll(myStudy.c_str()) << "\n";
+  //std::cout<<"ScenarioId = " << atoll(myScenario.c_str()) << "\n";
+  //std::cout<<"UserId = " << atoll(myUser.c_str()) << "\n";
   
   CreateConfigFileResponse* aCreateConfigFileResponse = new CreateConfigFileResponse();
   aCreateConfigFileResponse = aStub->createConfigFile(aCreateConfigFileRequest);
+  std::string aResponseFilePath = aCreateConfigFileResponse->get_return();
   
-  string aResponseFilePath = aCreateConfigFileResponse->get_return();
-  
-  string aResponseFileName = aResponseFilePath.substr(aResponseFilePath.find_last_of("/\\")+1);
+  std::string aResponseFileName = aResponseFilePath.substr(aResponseFilePath.find_last_of("/\\")+1);
   
   //Get the created config file to client
   
@@ -104,18 +120,18 @@ SimanIO_Configuration SimanIO_Link::RetrieveConf()
   aGetFileResponse = aStub->getFile(aGetFileRequest);
   
   //Parse the response and get the filename
-  string aTmpDir = "/tmp";
-  string aClientFileDir = aTmpDir + "/SimanSalome/" + myStudy + "/" + myScenario + "/" + myUser + "/";
-  //string aClientFileDir = aTmpDir + "/SimanSalome/" +  myUser + "/download/";
-  string aClientFilePath = aClientFileDir + aResponseFileName;
+  std::string aTmpDir = "/tmp";
+  std::string aClientFileDir = aTmpDir + "/SimanSalome/" + myStudy + "/" + myScenario + "/" + myUser + "/";
+  //std::string aClientFileDir = aTmpDir + "/SimanSalome/" +  myUser + "/download/";
+  std::string aClientFilePath = aClientFileDir + aResponseFileName;
   
   //Create the directories
   system(("mkdir -p " + aClientFileDir).c_str());
   system(("chmod -Rf g+w " + aTmpDir + "/SimanSalome/").c_str());
   
   //Download the siman-salome.conf file
-  ofstream outputStream;
-  outputStream.open(aClientFilePath.c_str(), ofstream::binary);
+  std::ofstream outputStream;
+  outputStream.open(aClientFilePath.c_str(), std::ofstream::binary);
   int aBufferSize = axutil_base64_binary_get_decoded_binary_len(aGetFileResponse->get_return(), Environment::getEnv());
   int* aBufSize = new int[aBufferSize];
   unsigned char* aCopyBuffer = axutil_base64_binary_get_plain_binary(aGetFileResponse->get_return(), Environment::getEnv(), aBufSize);
@@ -135,13 +151,13 @@ SimanIO_Configuration SimanIO_Link::RetrieveConf()
       /*const*/ SimanIO_Document& aDoc = aDocIter.Document();
       SimanIO_Document::FilesIterator aFileIter(aDoc);
       for(; aFileIter.More(); aFileIter.Next()) {
-        string aURL = aFileIter.URL();
-        string aFileName = aURL.substr(aURL.find_last_of("/\\")+1);
+        std::string aURL = aFileIter.URL();
+        std::string aFileName = aURL.substr(aURL.find_last_of("/\\")+1);
         int startUnderlineIndex = aFileName.find_first_of("_") + 1;
-        string aSourceFileName = aFileName.substr(startUnderlineIndex);
+        std::string aSourceFileName = aFileName.substr(startUnderlineIndex);
         
-        //cout << "aURL = " << aURL << "\n";
-        string aPathToVault = aResponseFilePath.substr(0, aResponseFilePath.find("download")) + "vault/";
+        //std::cout << "aURL = " << aURL << "\n";
+        std::string aPathToVault = aResponseFilePath.substr(0, aResponseFilePath.find("download")) + "vault/";
         
         //only for test only for WIN
         //replace(aURL.begin(),aURL.end(),'/','\\');
@@ -152,7 +168,7 @@ SimanIO_Configuration SimanIO_Link::RetrieveConf()
         aGetFileRequest->setArgs0(aPathToVault + aURL);
         aGetFileResponse = aStub->getFile(aGetFileRequest);
         
-        outputStream.open((aClientFileDir + aSourceFileName).c_str(), ofstream::binary);
+        outputStream.open((aClientFileDir + aSourceFileName).c_str(), std::ofstream::binary);
         int aBufferSize = axutil_base64_binary_get_decoded_binary_len(aGetFileResponse->get_return(), Environment::getEnv());
         int* aBufSize = new int[aBufferSize];
         unsigned char* aCopyBuffer = axutil_base64_binary_get_plain_binary(aGetFileResponse->get_return(), Environment::getEnv(), aBufSize);
@@ -163,7 +179,7 @@ SimanIO_Configuration SimanIO_Link::RetrieveConf()
 
         //Set new URLs
         aFileIter.SetURL((aClientFileDir + aSourceFileName).c_str());
-        //cout << "New location of the files " << aClientFileDir + aFileName << "\n";
+        //std::cout << "New location of the files " << aClientFileDir + aFileName << "\n";
       }//aFileIter
     }//aDocIter
   }//actIter
@@ -183,15 +199,15 @@ SimanIO_Configuration SimanIO_Link::RetrieveConf()
 
 void SimanIO_Link::StoreConf(/*const*/ SimanIO_Configuration& theConf)
 {
-  cout << "StoreConf method is started\n";
+  std::cout << "StoreConf method is started\n";
   char* aSimanHost = getenv("SIMAN_WS_HOST");
   if (aSimanHost == NULL)
   {
     CONFIGURSION_ERROR("The SIMAN_WS_HOST variable does not exist. Please set it.\n");
   }
   
-  string aSimanWSHost(aSimanHost);
-  string anEndpointUri = "http://" + aSimanWSHost + "/Siman-WS/services/SimanSalomeService";
+  std::string aSimanWSHost(aSimanHost);
+  std::string anEndpointUri = "http://" + aSimanWSHost + "/Siman-WS/services/SimanSalomeService";
   
   Environment::initialize("SimanSalomeService.log",AXIS2_LOG_LEVEL_DEBUG);
   char* aClientHomeEnv = getenv("WSFCPP_HOME");
@@ -201,7 +217,7 @@ void SimanIO_Link::StoreConf(/*const*/ SimanIO_Configuration& theConf)
     CONFIGURSION_ERROR("The WSFCPP_HOME variable does not exist. Please set it.\n");
   }
   
-  string aClientHome = AXIS2_GETENV("WSFCPP_HOME");
+  std::string aClientHome = AXIS2_GETENV("WSFCPP_HOME");
   SimanSalomeServiceStub* aStub = new SimanSalomeServiceStub(aClientHome, anEndpointUri);
   ServiceClient *client = aStub->getServiceClient();
   
@@ -220,11 +236,11 @@ void SimanIO_Link::StoreConf(/*const*/ SimanIO_Configuration& theConf)
   PutFileResponse* aPutFileResponse = new PutFileResponse();
   
   //Prepare salome-siman.conf file
-  string aTmpDir = "/tmp";
-  string aClientFileDir = aTmpDir + "/SimanSalome/" + myStudy + "/" + myScenario + "/" + myUser + "/";
-  //string aClientFileDir = aTmpDir + "/SimanSalome/" +  myUser + "/download/";
-  string aClientFilePath = aClientFileDir + "salome-siman.conf";
-  ofstream aSalomeSimanFile;
+  std::string aTmpDir = "/tmp";
+  std::string aClientFileDir = aTmpDir + "/SimanSalome/" + myStudy + "/" + myScenario + "/" + myUser + "/";
+  //std::string aClientFileDir = aTmpDir + "/SimanSalome/" +  myUser + "/download/";
+  std::string aClientFilePath = aClientFileDir + "salome-siman.conf";
+  std::ofstream aSalomeSimanFile;
   aSalomeSimanFile.open(aClientFilePath.c_str());
   
   //Get the actual file URLs and put these files onto server.
@@ -236,13 +252,13 @@ void SimanIO_Link::StoreConf(/*const*/ SimanIO_Configuration& theConf)
       /*const*/ SimanIO_Document& aDoc = aDocIter.Document();
       SimanIO_Document::FilesIterator aFileIter(aDoc);
       for(; aFileIter.More(); aFileIter.Next()) {
-        string aURL = aFileIter.URL();
-        string aFileName = aURL.substr(aURL.find_last_of("/\\")+1);
-        cout << "aURL = " << aURL << "\n";
-        cout << " aFileName= " << aFileName << "\n";
+        std::string aURL = aFileIter.URL();
+        std::string aFileName = aURL.substr(aURL.find_last_of("/\\")+1);
+        std::cout << "aURL = " << aURL << "\n";
+        std::cout << "aFileName= " << aFileName << "\n";
         //get size of the input file
-        ifstream inputStream (aURL.c_str(), ifstream::binary);
-        inputStream.seekg(0,ifstream::end);
+       std::ifstream inputStream (aURL.c_str(), std::ifstream::binary);
+        inputStream.seekg(0,std::ifstream::end);
         int aSize = inputStream.tellg();
         inputStream.seekg(0);
         
@@ -250,6 +266,7 @@ void SimanIO_Link::StoreConf(/*const*/ SimanIO_Configuration& theConf)
         char* aCopyBuffer;
         aCopyBuffer = new char [aSize];
         inputStream.read(aCopyBuffer,aSize);
+        std::cout << "Upload a file with the size" << aSize << "\n";
         axutil_base64_binary_t* aRequestDH = axutil_base64_binary_create_with_plain_binary(Environment::getEnv(), reinterpret_cast<unsigned char*>(aCopyBuffer), aSize);
         inputStream.close();
         delete[] aCopyBuffer;
@@ -261,12 +278,16 @@ void SimanIO_Link::StoreConf(/*const*/ SimanIO_Configuration& theConf)
         
         aPutFileResponse = aStub->putFile(aPutFileRequest);
         
+        std::cout << "End of upload. New file locaton is: " << aPutFileResponse->get_return() << "\n";
+        
         //Write information into salome-siman.conf file
-        ostringstream activityId;
-        ostringstream documentId;
+       std::ostringstream activityId;
+       std::ostringstream documentId;
         activityId << actIter.ActivityId();
         documentId << aDocIter.DocId();
         aSalomeSimanFile << myScenario +  "," +  myUser + "," + activityId.str() +  "," + documentId.str() + "," + aPutFileResponse->get_return() + "\n";
+       std::cout << "Line in the SalomeSimanFile " << myScenario +  "," +  myUser + "," + activityId.str() +  "," + documentId.str() + "," + aPutFileResponse->get_return() <<"\n";
+        std::cout <<"==========\n";
 
       }//aFileIter
     }//aDocIter
@@ -275,8 +296,8 @@ void SimanIO_Link::StoreConf(/*const*/ SimanIO_Configuration& theConf)
   aSalomeSimanFile.close();
   
   //Put the salome-siman.conf file onto server
-  ifstream inputStream (aClientFilePath.c_str(), ifstream::binary);
-  inputStream.seekg(0,ifstream::end);
+  std::ifstream inputStream (aClientFilePath.c_str(), std::ifstream::binary);
+  inputStream.seekg(0,std::ifstream::end);
   int aSize = inputStream.tellg();
   inputStream.seekg(0);
   
index b56c80a8e17fd94203db58726b686cbd91de0f9b..0e99439657a5ecca736272a3a0418907e453dc14 100644 (file)
@@ -1,7 +1,26 @@
+// 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
+//
+
 #ifndef SIMANIO_LINK_H
 #define SIMANIO_LINK_H
 
-#include <SimanIO_Configuration.hxx>
+#include "SimanIO_Configuration.hxx"
 
 /**
  * \brief Class for creation of connection with SIMAN database.
diff --git a/src/SimanIO_Version.hxx.in b/src/SimanIO_Version.hxx.in
new file mode 100644 (file)
index 0000000..e012f96
--- /dev/null
@@ -0,0 +1,39 @@
+// 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
+//
+
+#if !defined(SIMANIO_VERSION_H)
+#define SIMANIO_VERSION_H
+
+/*!
+  Specify version of SimanIO library, as follows
+
+  SIMANIO_VERSION_MAJOR       : (integer) number identifying major version
+  SIMANIO_VERSION_MINOR       : (integer) number identifying minor version
+  SIMANIO_VERSION_PATCH       : (integer) number identifying patch version
+  SIMANIO_VERSION_STR         : (string)  complete version number "major.minor.patch"
+  SIMANIO_VERSION             : (hex)     complete version number (major << 16) + (minor << 8) + patch
+*/
+
+#define SIMANIO_VERSION_MAJOR       @SIMANIO_MAJOR_VERSION@
+#define SIMANIO_VERSION_MINOR       @SIMANIO_MINOR_VERSION@
+#define SIMANIO_VERSION_PATCH       @SIMANIO_PATCH_VERSION@
+#define SIMANIO_VERSION_STR         "@SIMANIO_VERSION@"
+#define SIMANIO_VERSION             (SIMANIO_VERSION_MAJOR << 16 | SIMANIO_VERSION_MINOR << 8 | SIMANIO_VERSION_PATCH)
+
+#endif // SIMANIO_VERSION_H
index 50ff3229e321bc42a96613c72252b28bf2d9e34c..a3c40b1b42c7803e8f24689425e2d711141214df 100644 (file)
@@ -1,3 +1,22 @@
+// 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
+//
+
 #include "CreateConfigFile.h"
 #include "CreateConfigFileResponse.h"
 #include "GetFile.h"
@@ -6,9 +25,9 @@
 #include "PutFileResponse.h"
 #include "SimanSalomeServiceStub.h"
 #include <Environment.h>
+#include <ServiceClient.h>
 #include <iostream>
 #include <fstream>
-#include <ServiceClient.h>
 
 #include <axiom.h>
 #include <axis2_util.h>
@@ -16,8 +35,6 @@
 #include <axis2_client.h>
 #include <axutil_uuid_gen.h>
 
-
-using namespace std;
 using namespace org_splat_ws_server_service_salome;
 using namespace wso2wsf;
 
@@ -27,14 +44,14 @@ int main(int argc, char *argv[])
        
        char * ttest = getenv("SIMAN_WS_HOS");
        if (ttest == NULL)
-           cout<<"expected\n";
+         std::cout<<"expected\n";
        else
-           cout<<"unexpected\n";
+         std::cout<<"unexpected\n";
        
-       string aSimanWSHost(getenv("SIMAN_WS_HOST"));
-       string endpointUriTT = "http://" + aSimanWSHost + "/Siman-WS/services/SimanSalomeService";
+       std::string aSimanWSHost(getenv("SIMAN_WS_HOST"));
+       std::string endpointUriTT = "http://" + aSimanWSHost + "/Siman-WS/services/SimanSalomeService";
        
-       cout<<"enpoint uri" << endpointUriTT << "\n";
+       std::cout<<"enpoint uri" << endpointUriTT << "\n";
 
        Environment::initialize("SimanSalomeService.log",AXIS2_LOG_LEVEL_DEBUG);
 
@@ -61,7 +78,7 @@ int main(int argc, char *argv[])
        long long studyId = 1000;
        long long scenarioId = 1001;
        long long userId = 8;
-       string newUserId = "8";
+       std::string newUserId = "8";
 
        aRequest->setArgs0(studyId);
        aRequest->setArgs1(scenarioId);
@@ -71,12 +88,12 @@ int main(int argc, char *argv[])
 
        aResponse = aStub->createConfigFile(aRequest);
 
-       cout<< "Response:: "<<aResponse->get_return()<<endl;
+       std::cout<< "Response:: "<<aResponse->get_return()<<std::endl;
        
        //Parse the response and get the filename
        std::string aResponseFilePath = aResponse->get_return();
        std::string aResponseFileName = aResponseFilePath.substr(aResponseFilePath.find_last_of("/\\")+1);
-       cout << aResponseFileName << "\n";
+       std::cout << aResponseFileName << "\n";
        
        //Set options
        axis2_options_set_action(axis2options, Environment::getEnv(), "urn:getFile");
@@ -89,11 +106,11 @@ int main(int argc, char *argv[])
        std::ofstream outputStream;
        std::string aClientFilePath = "/dn24/SIMAN/siman_temp/download/" + aResponseFileName;
        
-       outputStream.open(aClientFilePath.c_str(), ofstream::binary);
+       outputStream.open(aClientFilePath.c_str(), std::ofstream::binary);
        
        int aBufferSize = axutil_base64_binary_get_decoded_binary_len(aGetFileResponse->get_return(), Environment::getEnv());
        
-       cout<<aBufferSize<<"\n";
+       std::cout<<aBufferSize<<"\n";
        int* aBufSize = new int[aBufferSize];
        unsigned char* aCopyBuffer = axutil_base64_binary_get_plain_binary(aGetFileResponse->get_return(), Environment::getEnv(), aBufSize);
        //char* aCopyBuf = aCopyBuf;
@@ -105,13 +122,13 @@ int main(int argc, char *argv[])
        outputStream.close();
        
        //Second test
-       /*string aSourceLoc = "W:\\testvideo\\Darvin.avi";
+       /*std::string aSourceLoc = "W:\\testvideo\\Darvin.avi";
        aGetFileRequest->setArgs0(aSourceLoc);
        aGetFileResponse = aStub->getFile(aGetFileRequest);
        
-       outputStream.open("/dn24/SIMAN/siman_temp/download/Darvin.avi", ofstream::binary);
+       outputStream.open("/dn24/SIMAN/siman_temp/download/Darvin.avi", std::ofstream::binary);
        aBufferSize = axutil_base64_binary_get_decoded_binary_len(aGetFileResponse->get_return(), Environment::getEnv());
-       cout<<aBufferSize<<"\n";
+       std::cout<<aBufferSize<<"\n";
        
        aBufSize = new int[aBufferSize];
        aCopyBuffer = axutil_base64_binary_get_plain_binary(aGetFileResponse->get_return(), Environment::getEnv(), aBufSize);
@@ -122,7 +139,7 @@ int main(int argc, char *argv[])
        outputStream.close();
        */
        //End second test
-       cout << "See file on path" << aClientFilePath << "\n";
+       std::cout << "See file on path" << aClientFilePath << "\n";
        
        //Upload test
        axis2_options_set_action(axis2options, Environment::getEnv(), "urn:putFile");
@@ -131,10 +148,10 @@ int main(int argc, char *argv[])
        //char* aSourceFile = "/dn24/SIMAN/siman_temp/download/Mesh_1.med";
        
        //get size of the input file
-       ifstream infile ("/dn24/SIMAN/siman_temp/download/Mesh_1.med",ifstream::binary);
-       infile.seekg(0,ifstream::end);
+       std::ifstream infile ("/dn24/SIMAN/siman_temp/download/Mesh_1.med",std::ifstream::binary);
+       infile.seekg(0,std::ifstream::end);
        int aSize = infile.tellg();
-       cout << "Size of the input file is: " << aSize << "\n";
+       std::cout << "Size of the input file is: " << aSize << "\n";
        infile.seekg(0);
        
        char * inBuffer;
@@ -151,12 +168,12 @@ int main(int argc, char *argv[])
        aPutFileRequest->setArgs1("Mesh_1.med");
        aPutFileRequest->setArgs2(userId);
        
-       cout << "test" <<"\n";
+       std::cout << "test" <<"\n";
        
        PutFileResponse* aPutFileResponse = new PutFileResponse();
        aPutFileResponse = aStub->putFile(aPutFileRequest);
        
-       cout<< "Response:: "<<aPutFileResponse->get_return()<<endl;
+       std::cout<< "Response:: "<<aPutFileResponse->get_return()<<std::endl;
        
        delete aResponse;
        delete aRequest;
@@ -165,4 +182,4 @@ int main(int argc, char *argv[])
        delete aPutFileResponse;
        delete aPutFileRequest;
        delete aStub;
-}
\ No newline at end of file
+}