-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (72 loc) · 3.16 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Copyright (C) 2019 EDF R&D
#
# 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
#
# Author: Anthony Geay, anthony.geay@edf.fr, EDF R&D
cmake_minimum_required(VERSION 2.6)
project(AdaoExchangeLayer)
##
find_package(PythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "Python interp not found ! We absolutely need it !")
endif(NOT PYTHONINTERP_FOUND)
set(ADAOEXCHANGELAYER_VERSION "9.14.0")
set(ADAO_INTERFACE_PYTHON_MODULE "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/salome")
set(BUILD_SHARED_LIBS TRUE)
set(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
if(EXISTS ${CONFIGURATION_ROOT_DIR})
list(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
include(SalomeMacros)
include(SalomeSetupPlatform)
else(EXISTS ${CONFIGURATION_ROOT_DIR})
message(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
endif(EXISTS ${CONFIGURATION_ROOT_DIR})
##
option(AEL_ENABLE_TESTS "Build tests (default ON)." ON)
if(AEL_ENABLE_TESTS)
if(EXISTS ${PY2CPP_ROOT_DIR})
set(PY2CPP_ROOT_DIR $ENV{PY2CPP_ROOT_DIR} CACHE PATH "Path to Py2cpp")
set(Py2cpp_DIR "${PY2CPP_ROOT_DIR}/lib/cmake/py2cpp")
find_package(Py2cpp REQUIRED)
find_package(SalomeCppUnit)
else(EXISTS ${PY2CPP_ROOT_DIR})
message(FATAL_ERROR "PY2CPP declared as enabled whereas not found !")
endif(EXISTS ${PY2CPP_ROOT_DIR})
endif(AEL_ENABLE_TESTS)
##
find_package(SalomePythonInterp REQUIRED)
find_package(SalomePythonLibs REQUIRED)
##
include_directories(
${PYTHON_INCLUDE_DIRS}
${CPPUNIT_INCLUDE_DIRS}
)
set(adaoexchange_SOURCES AdaoExchangeLayer.cxx AdaoModelKeyVal.cxx)
add_library(adaoexchange ${adaoexchange_SOURCES})
target_link_libraries(adaoexchange ${PYTHON_LIBRARIES})
install(FILES AdaoExchangeLayer.hxx PyObjectRAII.hxx AdaoExchangeLayerException.hxx AdaoModelKeyVal.hxx DESTINATION include)
install(TARGETS adaoexchange DESTINATION lib)
##
if(AEL_ENABLE_TESTS)
add_executable(TestAdaoExchange TestAdaoExchange.cxx)
target_link_libraries(TestAdaoExchange adaoexchange py2cpp ${CPPUNIT_LIBRARIES})
install(TARGETS TestAdaoExchange DESTINATION bin)
endif(AEL_ENABLE_TESTS)
SALOME_SETUP_VERSION(${ADAOEXCHANGELAYER_VERSION})
file(WRITE ${CMAKE_INSTALL_PREFIX}/${ADAO_INTERFACE_PYTHON_MODULE}/salome/adao_interface/__init__.py
"__version__ = \"${ADAOEXCHANGELAYER_VERSION}\"\n__sha1__ = \"${ADAOEXCHANGELAYER_GIT_SHA1}\""
)