]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
CMake:
authormpa <mpa@opencascade.com>
Fri, 15 Nov 2013 04:45:23 +0000 (04:45 +0000)
committermpa <mpa@opencascade.com>
Fri, 15 Nov 2013 04:45:23 +0000 (04:45 +0000)
- update documentation considering new CMake build system

doc/calculator.rst
doc/cppsalome.rst
doc/pysalome.rst
doc/ref/yacs.dox
doc/yacsgen.rst

index bebb02a4e8f11c7425633fd1f14e8bbf6d427cd7..b457151d64d899da66e35d91f911cd5a9719344f 100644 (file)
@@ -65,21 +65,16 @@ The first step when developing a new SALOME module is to create a directories tr
 
 
 
-The remaining charge for the developer is to define the module interface (by writing a CORBA IDL file), and to implement it. But before, you may want to check that your  duplicated module still compiles :
+The remaining charge for the developer is to define the module interface (by writing a CORBA IDL file), and to implement it. But before, you may want to check that your  duplicated module still compiles ::
 
-
-
-::
-
-    CALCULATOR_SRC/build_configure
     mkdir CALCULATOR_BUILD
     mkdir CALCULATOR_INSTALL
     cd CALCULATOR_BUILD
-    ../CALCULATOR_SRC/configure --prefix=installDir
+    cmake -DCMAKE_BUILD_TYPE=<Mode> -DCMAKE_INSTALL_PREFIX=CALCULATOR_INSTALL ../CALCULATOR_SRC
     make && make install
 
 
-
+Where <Mode> is build mode (Release or Debug)
 
 
 Modification of interface (IDL)
index 33a9bbe5b9b0b7b6389489b187c81a28f77746fe..91cca5922c82ec00bea6bb94526025f26ad2d5f8 100644 (file)
@@ -23,7 +23,7 @@ The various steps of the development will be as follows:
  - create a SALOME component that can be loaded by a C++ container
  - configure the module so that the component is known to SALOME
  - add a graphic GUI
- - make the component useable in the YACS module.
+ - make the component usable in the YACS module.
 
 Creating the module tree structure
 =======================================
@@ -32,25 +32,24 @@ example module.  Therefore, all that is necessary is an idl interface and a C++
 We need to reproduce the following standard file tree structure, to use it in a SALOME module::
 
   + HELLO1_SRC
-    + build_configure
-    + configure.in.base
-    + Makefile.in
+    + CMakeLists.txt
     + adm_local
-      + unix
-        + make_commence.in
-        + make_omniorb.in
-        + config_files
+      + CMakeLists.txt
+      + cmake_files
+        + CMakeLists.txt
+        + FindSalomeHELLO.cmake
     + bin
+      + CMakeLists.txt
       + VERSION
       + runAppli.in
       + runSalome.py
     + idl
-      + Makefile.in
+      + CMakeLists.txt
       + HELLO_Gen.idl
     + src
-      + Makefile.in
+      + CMakeLists.txt
       + HELLO
-        + Makefile.in
+        + CMakeLists.txt
         + HELLO.cxx 
         + HELLO.hxx 
     + doc
@@ -165,37 +164,50 @@ hello, goodbye and copyOrMove are given in the source file (HELLO.cxx)::
        ...
        }
 
-Makefile
+CMakeLists.txt
 --------
-In makefile, some targets have to be defined::
-
-       # header files 
-       salomeinclude_HEADERS = HELLO.hxx
-
-       # Libraries targets
-       lib_LTLIBRARIES = libHELLOEngine.la
-       dist_libHELLOEngine_la_SOURCES = \
-               HELLO.cxx
-
-       libHELLOEngine_la_CPPFLAGS = \
-               $(CORBA_CXXFLAGS) \
-               $(CORBA_INCLUDES) \
-               $(KERNEL_CXXFLAGS) \
-               -I$(top_builddir)/idl
-
-       libHELLOEngine_la_LDFLAGS = \
-               ../../idl/libSalomeIDLHELLO.la \
-               $(KERNEL_LDFLAGS) \
-               -lSalomeContainer \
-               -lOpUtil \
-               -lSalomeIDLKernel
+Create and add library to the project::        
+
+    # --- options ---
+    # additional include directories
+    INCLUDE_DIRECTORIES(
+      ${KERNEL_INCLUDE_DIRS}
+      ${OMNIORB_INCLUDE_DIR}
+      ${PROJECT_BINARY_DIR}
+      ${PROJECT_BINARY_DIR}/idl
+    )
+    # libraries to link to
+    SET(_link_LIBRARIES
+      ${OMNIORB_LIBRARIES}
+      ${KERNEL_SalomeIDLKernel}
+      ${KERNEL_OpUtil}
+      ${KERNEL_SalomeContainer}
+      SalomeIDLHELLO
+    )
+    # --- headers ---
+    # header files / no moc processing
+    SET(HELLO_HEADERS
+      HELLO.hxx
+    )
+    # --- sources ---
+    # sources / static
+    SET(HELLO_SOURCES
+      HELLO.cxx
+    )
+    # --- rules ---
+    ADD_LIBRARY(HELLOEngine ${HELLO_SOURCES})
+    TARGET_LINK_LIBRARIES(HELLOEngine ${_link_LIBRARIES} )
+    INSTALL(TARGETS HELLOEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+    INSTALL(FILES ${HELLO_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
        
-Review each of these targets
+Review some of components:
 
-- salomeinclude_HEADERS contains the header files.
-- lib_LTLIBRARIES contains the normalized name (lib<Nom_Module>Engine.la) of the library, LIB_SRC defines the name of source files, and VPATH defines the directories in which they can be found.
-- The path for the include files used has to be added to CPPFLAGS (SALOME.config.h, SALOME_Component_i.hxx and utilities.h are located in ${KERNEL_ROOT_DIR}/include/salome).
-- The HELLO class uses lib libraries (for Engines_Component_i) and libOptUtil (for PortableServer and Salome_Exception).  Therefore, the name of these libraries and their path in LDFLAGS will be indicated.  Other libraries are often useful, for example libsalomeDS if persistence is implemented, or libSalomeNS if the naming service is used.
+- HELLO_HEADERS contains the header files.
+- HELLO_SOURCES defines the name of source files
+- HELLOEngine - library name.
+- SALOME_INSTALL_LIBS path defines the directories in which library will be install.
+- Command INCLUDE_DIRECTORIES used to add /bin directories of some modules and packages.
+- Variable _link_LIBRARIES contains path to libraries of dependent modules and packages.
 
 Controlling the component from Python (TUI mode)
 =====================================================
@@ -262,6 +274,7 @@ the HELLO module. In particular, these files specify menus, toolbars,
 dialog boxes and other such staff.
 
 - src/HELLOGUI/HELLO_msg_en.ts
+- src/HELLOGUI/HELLO_msg_fr.ts
 - src/HELLOGUI/HELLO_icons.ts
 
 These files provide a description (internationalization) of GUI
index 1a66964fa8d7ee0116b62a88081c355dd5955ba0..d7a3d76423a84da95c3b5f269dc49437283e88ba 100644 (file)
@@ -32,29 +32,24 @@ all that are necessary.
 The following file structure is necessary so that this can be implemented in a SALOME module::
 
   + PYHELLO1_SRC
-    + build_configure
-    + configure.ac
-    + Makefile.am
+    + CMakeLists.txt
     + adm_local
-      + Makefile.am
-      + unix
-        + Makefile.am
-        + make_common_starter.am
-        + config_files
-          + Makefile.am
-          + check_PYHELLO.m4
+      + CMakeLists.txt
+      + cmake_files
+        + CMakeLists.txt
+        + FindSalomePYHELLO.cmake
     + bin
-      + Makefile.am
+      + CMakeLists.txt
       + VERSION.in
       + runAppli.in
       + myrunSalome.py
     + idl
-      + Makefile.am
+      + CMakeLists.txt
       + PYHELLO_Gen.idl
     + src
-      + Makefile.am
+      + CMakeLists.txt
       + PYHELLO
-        + Makefile.am
+        + CMakeLists.txt
         + PYHELLO.py 
     + doc
 
@@ -69,33 +64,37 @@ The runAppli.in and runSalome.py files are not essential but make the example ea
    the files of the basic platform (KERNEL) must not be copied to initialise a module tree structure.  
    It is usually preferable to copy files from another module such as GEOM or MED.
 
-Implementation of automake, configure
+Implementation of CMake
 --------------------------------------
-SALOME uses autoconf and automake to build the configure script that is used for the installation to test 
-the system configuration and to preconfigure the module construction Makefile files.  
-The build_configure file contains a procedure that starts from configure.ac and uses automake to build 
-the configure script.  
-automake starts from Makefile.am files to build Makefile.in files.
-All files with an "in" extension are skeletons that will be transformed by the configure process.
-
-Almost all files used for this process are located in the basic platform that is referenced by the 
-KERNEL_ROOT_DIR environment variable as well as GUI_ROOT_DIR for the graphical user interface (GUI).  
-However, some files must be modified as a function of the target 
-module.  This is the case for build_configure and configure.ac files that usually need to be adapted.
-
-The basic files for configuration of the KERNEL module and other modules are collected in the salome_adm 
-directory of the KERNEL module.  However, in order to be able to use the CORBA objects of the KERNEL module, 
-the files in the salome_adm directory have to be overwritten, using the make_common_starter.am file in 
-the adm_local directory of the example module.
-
-config_files is a directory in which the m4 files that are used to test the configuration of the system in the 
-configure process can be placed.  If the salome_adm files are not sufficient, others can be added in adm_local.
+The  CMakeLists.txt files are used to describe the build procedure,
+in particular:
+- Test platform;
+- Test system configuration;
+- Detect pre-requisites;
+- Generate build rules (for example, standard UNIX makefiles on Linux, MSVC solutions, etc).
+
+Project's root directory provides main CMake configuration that allows build all targets into one 
+set of binaries and libraries. Each sub-directory also includes CMake configuration file (CMakeLists.txt) 
+that specifies targets being build.
+
+The file CMakeLists.txt in root directory of the PYHELLO module provides basic build rules to be used 
+in other CMakeLists.txt files. 
+It sets main properties of project: name, version, pre-requisites, installation paths, programming languages 
+being used by the project, tree of sub-directories, etc.
+
+A lot of files used by the build procedure of HELLO module are located in SALOME KERNEL module 
+(that is referenced by the KERNEL_ROOT_DIR environment variable), namely in its salome_adm sub-folder.
+Similarly, the GUI_ROOT_DIR environment variable is used for the graphical user interface (GUI) module of SALOME; 
+this module also provides a set of configuration utilities (*.cmake files) in its adm_local folder.
 
 The idl directory
 --------------------------------------
-The idl directory requires a Makefile.am that must make the compilation of the idl PYHELLO_Gen.idl file 
-and install all the generated files in the right module installation directories.  The BASE_IDL_FILES target has 
-to be modified to reach this goal.
+The idl directory requires a CMakeLists.txt that must make the compilation of the idl PYHELLO_Gen.idl file 
+and install all the generated files in the right module installation directories.
+This is done by using OMNIORB_ADD_MODULE() CMake macro::
+
+   OMNIORB_ADD_MODULE(SalomeIDLPYHELLO PYHELLO_Gen.idl ${KERNEL_ROOT_DIR}/idl/salome ${KERNEL_SalomeIDLKernel})
+   INSTALL(TARGETS SalomeIDLPYHELLO EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 The idl file itself must define a CORBA module for which the name must be different from the module 
 name to avoid name conflicts and define a CORBA interface that is derived at least from the EngineComponent interface of the Engines module.  
@@ -109,12 +108,13 @@ its own directory.
 For the moment, the module will only contain a single directory for the engine of the PYHELLO component 
 and its name will be PYHELLO.
 
-The Makefile.am will simply trigger the path of sub-directories described by the SUBDIRS target.
+The CMakeLists.txt file triggers the path of sub-directories described
+by the \a ADD_SUBDIRECTORY() command.
 
 The PYHELLO directory
 '''''''''''''''''''''''
 This directory contains the Python module that represents the component and therefore contains the PYHELLO class 
-and a Makefile.am file that simply exports the PYHELLO.py module into the installation directory of the SALOME module.
+and a CMakeLists.txt file that simply exports the PYHELLO.py module into the installation directory of the SALOME module.
 
 The PYHELLO.py module contains the PYHELLO class that is derived from the PYHELLO_Gen interface of the CORBA 
 PYHELLO_ORB_POA module and the SALOME_ComponentPy_i class of the SALOME_ComponentPy module.
@@ -149,14 +149,15 @@ Construction, installation
 In PYHELLO1_SRC, enter::
 
      export KERNEL_ROOT_DIR=<KERNEL installation path>
-     ./build_configure
 
 Go into ../PYHELLO1_BUILD and enter::
 
-     ../PYHELLO1_SRC/configure --prefix=<PYHELLO1 installation path>
+     cmake -DCMAKE_BUILD_TYPE=<Mode> -DCMAKE_INSTALL_PREFIX=<PYHELLO1 installation path> ../PYHELLO1_SRC
      make
      make install
 
+Where <Mode> is build mode (Release or Debug).
+
 Running the platform
 -------------------------------
 Move into the <PYHELLO1 module installation path> and enter::
@@ -214,9 +215,7 @@ the resources directory.
 Updated tree structure::
 
   + PYHELLO1_SRC
-    + build_configure
-    + configure.ac
-    + Makefile.am
+    + CMakeLists.txt
     + adm_local
     + bin
     + idl
@@ -226,15 +225,14 @@ Updated tree structure::
       + PYHELLOCatalog.xml
 
 The remainder of the files are identical, apart from adding the resources directory and the PYHELLOCatalog.xml file.  
-However, the Makefile.am has to be modified so that the catalog is actually installed in the installation 
-directory.  It simply needs to be specified in the salomeres_SCRIPTS target.
+However, the CMakeLists.txt has to be modified so that the catalog is actually installed in the installation 
+directory.
 
 Construction, installation
 ---------------------------------
 There is no need to do another configure to take account of this modification.  
 All that is necessary is to enter PYHELLO1_BUILD and then::
 
-    ./config.status
     make 
     make install
 
@@ -290,14 +288,8 @@ button bar that are integrated into the menu bar and into the IAPP button bar.
 Python module implanting the behaviour of the GUI
 -----------------------------------------------------
 The behaviour of the PYHELLO component GUI is implanted in the Python PYHELLOGUI.py module in the 
-PYHELLOGUI sub-directory.  The Makefile.am located in the src directory must be updated to include
-the PYHELLOGUI subdirectory.  A Makefile.am must be added into the PYHELLOGUI subdirectory.  
-Important targets are salomescript_SCRIPTS and salomeres_DATA.
-
-The salomescript_SCRIPTS target must be updated with the name of the Python modules to be made visible in Salome, in other 
-words mainly so that they are importable (Python import command).
-
-The salomeres_DATA target must be updated with the names of files that are used for multi-linguism.  
+PYHELLOGUI sub-directory.  The CMakeLists.txt located in the src directory must be updated to include
+the PYHELLOGUI subdirectory.  A CMakeLists.txt must be added into the PYHELLOGUI subdirectory.  
 
 Menu bar and button bar
 ----------------------------------
index 0c817962955929f52199ce286baa328d3467ea7d..77608b68904f3aa2780aa9a6d8f7fe069d89f8a2 100644 (file)
  If you want to install %YACS with SALOME GUI, you need to set environment 
  variable: \b GUI_ROOT_DIR.
 
- The building process is the traditional configure/make/make install:
- - configure --prefix=path_to_install
+ The building process is the traditional cmake/make/make install:
+ - cmake -DCMAKE_INSTALL_PREFIX=path_to_install ../src_path
  - make
 
  Then you can run unit tests if cppunits is installed :
- - make check
+ - make test
 
  Then you can run a small demo in Demo directory:
  - cd Demo
index cda4c320581bff3d41d9e53543e19166e1131887..18cc28bbef7e2d1cc50e79f4ff37a701e8e73f83 100644 (file)
@@ -1268,7 +1268,7 @@ Here is an excerpt from cppgui1 example that shows how to add a C++ GUI to a mod
 The C++ GUI is very similar to the python GUI except that the cppcomposGUI.h file is processed by the moc and the demo.ui
 is processed by the uic qt tool.
 
-By default, a Makefile.am and a SalomeApp.xml files are generated but you can put your own Makefile.am or SalomeApp.xml
+By default, a CMakeLists.txt and a SalomeApp.xml files are generated but you can put your own CMakeLists.txt or SalomeApp.xml
 in the list to override this default.
 
 Add an online documentation
@@ -1279,7 +1279,7 @@ To add a documentation use the *doc* parameter of the module. It must be a list
 (name with extension .rst) in the reStructured format (see http://docutils.sourceforge.net/) and image files (\*.png, ...).
 The main file must be named index.rst.
 
-By default, a sphinx configuration file conf.py and a Makefile.am are generated but you can put your own Makefile.am or conf.py
+By default, a sphinx configuration file conf.py and a CMakeLists.txt are generated but you can put your own CMakeLists.txt or conf.py
 in the list to override this default.
 
 Here is an excerpt from pygui1 example that shows how to add a documentation to a module::