Salome HOME
Some bugs were fixed in CMake and Sphinx
[modules/yacs.git] / src / pmml / CMakeLists.txt
1 # Copyright (C) 2012-2014  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 #
21 # TODO  : URANIE AND WIN32 : to compile on Windows, user uranietm 
22 #         
23 #         To adapt when YACS will be available on Windows
24
25 # cmake options are :
26
27 # cmake  
28 # -DURANIE=ON
29 # -DSALOME_BUILD_TESTS=ON
30 # -DSALOME_YACS_USE_SWIG=OFF 
31 # -DCMAKE_VERBOSE_MAKEFILE=ON 
32 # -DSALOME_CMAKE_DEBUG=ON 
33 # -DSALOME_BUILD_DOC:BOOL=FALSE  
34 # -G"NMake Makefiles JOM" 
35 # -DCMAKE_INSTALL_PREFIX=<chemin install>
36 # <chemin sources>
37 #   
38
39 IF(URANIE AND WIN32) 
40   CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)     
41   SET(SALOME_INSTALL_CMAKE_LOCAL adm/cmake CACHE PATH 
42     "Install path: local SALOME CMake files") 
43   ENABLE_TESTING()
44 ENDIF(URANIE AND WIN32) 
45
46 IF(SALOME_YACS_USE_SWIG)
47         FIND_PACKAGE(SalomePython)
48         FIND_PACKAGE(SalomeSWIG)
49         SALOME_LOG_OPTIONAL_PACKAGE(Python SALOME_YACS_USE_SWIG)
50         SALOME_LOG_OPTIONAL_PACKAGE(SWIG   SALOME_YACS_USE_SWIG)
51 ENDIF(SALOME_YACS_USE_SWIG)
52
53 # Directories
54 #
55 # Directories have to be given after prerequisites (to be able to use
56 # Python version string for example).adm_local
57 # ===========
58 SET(SALOME_INSTALL_BINS bin/salome CACHE PATH "Install path: SALOME binaries")
59 SET(SALOME_INSTALL_LIBS lib/salome CACHE PATH "Install path: SALOME libs")
60 SET(SALOME_INSTALL_HEADERS include/salome CACHE PATH "Install path: SALOME headers")
61
62 IF(SALOME_YACS_USE_SWIG)
63   SET(_pydir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
64   SET(SALOME_INSTALL_PYTHON ${_pydir}/salome CACHE PATH "Install path: SALOME Python stuff")
65   SET(SALOME_INSTALL_PYTHON_SHARED ${SALOME_INSTALL_PYTHON}/shared_modules CACHE PATH 
66     "Install path: SALOME Python shared modules")
67 ENDIF(SALOME_YACS_USE_SWIG)
68
69 SET(SALOME_INSTALL_RES share/salome/resources CACHE PATH "Install path: SALOME resources")
70 SET(SALOME_PMML_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/pmml" CACHE PATH "Install path: SALOME PMML specific data")
71
72 # Sources 
73 # ========
74 IF(WIN32)
75   ADD_DEFINITIONS("-D_USE_MATH_DEFINES")
76 ENDIF(WIN32)
77
78 IF(URANIE AND WIN32) 
79     FIND_PACKAGE(LibXml2 REQUIRED) 
80     LINK_DIRECTORIES( ${LIBXML2_LIBRARIES} )
81     INCLUDE_DIRECTORIES( ${LIBXML2_INCLUDE_DIR} )
82 ELSE(URANIE AND WIN32) 
83     FIND_PACKAGE(SalomeLibXml2 REQUIRED) 
84 ENDIF(URANIE AND WIN32)    
85
86 INCLUDE_DIRECTORIES(
87   ${CMAKE_CURRENT_BINARY_DIR}/..
88   ${LIBXML2_INCLUDE_DIR}
89   )
90
91 SET(pmml_SOURCES
92   PMMLlib.cxx
93   )
94
95 ADD_SUBDIRECTORY(resources)
96
97 ADD_LIBRARY(pmmlLib SHARED ${pmml_SOURCES})
98 TARGET_LINK_LIBRARIES(pmmlLib  ${LIBXML2_LIBRARIES} ) 
99 INSTALL(TARGETS pmmlLib EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
100
101 FILE(GLOB pmml_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
102 FILE(GLOB pmml_HEADERS_TXX "${CMAKE_CURRENT_SOURCE_DIR}/*.txx")
103 INSTALL(FILES ${pmml_HEADERS_HXX} ${pmml_HEADERS_TXX} DESTINATION ${SALOME_INSTALL_HEADERS})
104
105 # To allow usage as SWIG dependencies:
106 IF (NOT URANIE)
107     SET(pmml_HEADERS_HXX PARENT_SCOPE)
108     SET(pmml_HEADERS_TXX PARENT_SCOPE)
109 ENDIF (NOT URANIE)
110
111
112
113 IF(SALOME_BUILD_TESTS)
114     ADD_SUBDIRECTORY(Test)
115 ENDIF(SALOME_BUILD_TESTS)
116
117
118 IF(SALOME_YACS_USE_SWIG)
119     ADD_SUBDIRECTORY(pmml_swig)
120 ENDIF(SALOME_YACS_USE_SWIG)
121
122
123 IF(SALOME_BUILD_DOC)
124     ADD_SUBDIRECTORY(doc)
125 ENDIF(SALOME_BUILD_DOC)
126
127 # Configuration export
128 # ====================
129
130 #   - in the install tree:
131 #       Get the relative path of the include directory so 
132 #       we can register it in the generated configuration files:
133 SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
134
135 # Install the export set for use with the install-tree
136 INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" 
137         FILE ${PROJECT_NAME}Targets.cmake)