Salome HOME
8a7d57d531c963bf65f82ab6277647d7e2bfe697
[modules/yacs.git] / src / pmml / Test / CMakeLists.txt
1 # Copyright (C) 2012-2023  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 # Author : InckA
20
21 #
22 # TODO  : URANIE AND WIN32 : to compile on Windows, user uranietm 
23 #         
24 #         To adapt when YACS will be available on Windows
25
26
27 IF(URANIE AND WIN32) 
28     # Find the CppUnit includes and library
29     #
30     # This module defines
31     # CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
32     # CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
33     # CPPUNIT_FOUND, If false, do not try to use CppUnit.
34
35     # also defined, but not for general use are
36     # CPPUNIT_LIBRARY, where to find the CppUnit library.
37     # CPPUNIT_DEBUG_LIBRARY, where to find the CppUnit library in debug mode.
38
39     FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h)
40
41     # With Win32, important to have both
42
43     FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
44                     ${CPPUNIT_INCLUDE_DIR}/../lib)
45     FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd
46                     ${CPPUNIT_INCLUDE_DIR}/../lib)
47
48     IF(CPPUNIT_INCLUDE_DIR)
49       IF(CPPUNIT_LIBRARY)
50         SET(CPPUNIT_FOUND "YES")
51         SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS})
52         SET(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY} ${CMAKE_DL_LIBS})
53       ENDIF(CPPUNIT_LIBRARY)
54     ENDIF(CPPUNIT_INCLUDE_DIR)
55          
56 ELSE(URANIE AND WIN32) 
57     FIND_PACKAGE(SalomeCppUnit)
58     SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS)     
59 ENDIF(URANIE AND WIN32) 
60
61 ADD_DEFINITIONS(${CPPUNIT_DEFINITIONS})
62
63 IF(URANIE AND WIN32) 
64     INCLUDE_DIRECTORIES(
65       ${CPPUNIT_INCLUDE_DIR}  
66       ${CMAKE_CURRENT_SOURCE_DIR}/ 
67       ${CMAKE_CURRENT_SOURCE_DIR}/.. 
68       )   
69 ELSE(URANIE AND WIN32) 
70     INCLUDE_DIRECTORIES(
71       ${CPPUNIT_INCLUDE_DIRS}
72       ${CMAKE_CURRENT_SOURCE_DIR}/
73       ${CMAKE_CURRENT_SOURCE_DIR}/..
74       )      
75 ENDIF(URANIE AND WIN32) 
76
77 SET(TestPMML_SOURCES
78   TestPMML.cxx
79   PMMLBasicsTest1.cxx
80   tools.cxx
81   )
82
83 ADD_EXECUTABLE(TestPMML ${TestPMML_SOURCES})
84
85 IF(URANIE AND WIN32) 
86     IF(SALOME_CMAKE_DEBUG)
87                 TARGET_LINK_LIBRARIES(TestPMML pmmlLib ${CPPUNIT_DEBUG_LIBRARY} ${PLATFORM_LIBS})
88     ELSE(SALOME_CMAKE_DEBUG)
89                 TARGET_LINK_LIBRARIES(TestPMML pmmlLib ${CPPUNIT_LIBRARY} ${PLATFORM_LIBS})
90         ENDIF(SALOME_CMAKE_DEBUG)       
91 ELSE(URANIE AND WIN32) 
92     TARGET_LINK_LIBRARIES(TestPMML pmmlLib  
93                           ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS})
94 ENDIF(URANIE AND WIN32) 
95
96 ADD_TEST(TestPMML TestPMML)
97
98 FILE(COPY ${PROJECT_SOURCE_DIR}/src/pmml/Test/samples  DESTINATION . )
99 INSTALL(TARGETS TestPMML DESTINATION ${SALOME_INSTALL_BINS})
100
101 #
102
103 SET(LOCAL_TEST_DIR ${SALOME_YACS_INSTALL_TEST}/pmml/Test)
104 INSTALL(TARGETS TestPMML DESTINATION ${LOCAL_TEST_DIR})
105 INSTALL(FILES CTestTestfileInstall.cmake DESTINATION ${LOCAL_TEST_DIR} RENAME CTestTestfile.cmake)
106 FILE(GLOB sample_files  ${PROJECT_SOURCE_DIR}/src/pmml/Test/samples/*)
107 INSTALL(FILES ${sample_files} DESTINATION ${LOCAL_TEST_DIR}/samples)