OPTION(YDEFX_BUILD_GUI "Generate widgets" ON)
+FIND_PACKAGE(Py2cpp REQUIRED)
+
+# SalomeKERNEL can be useful in order to define SALOME_INSTALL directories and
+# for using salome test, but it is not a c++ dependency.
+FIND_PACKAGE(SalomeKERNEL NO_MODULE)
+
+IF(NOT SalomeKERNEL_FOUND)
+ MESSAGE("SalomeKERNEL not found. Salome installation paths will not be used")
+ENDIF()
+
+IF(NOT DEFINED SALOME_INSTALL_PYTHON)
+ EXECUTE_PROCESS ( COMMAND ${PYTHON_EXECUTABLE} -c
+ "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))"
+ OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
+ RESULT_VARIABLE _PYTHON_pythonlib_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE )
+
+ IF (_PYTHON_pythonlib_result)
+ MESSAGE (SEND_ERROR "Could not set SALOME_INSTALL_PYTHON!")
+ ENDIF ()
+ GET_FILENAME_COMPONENT(_ABS_PYTHON_MODULE_PATH
+ ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE)
+ FILE(RELATIVE_PATH SALOME_INSTALL_PYTHON
+ ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH})
+ENDIF(NOT DEFINED SALOME_INSTALL_PYTHON)
+
+IF(NOT DEFINED SALOME_INSTALL_BINS)
+ SET(SALOME_INSTALL_BINS "bin")
+ENDIF()
+IF(NOT DEFINED SALOME_INSTALL_LIBS)
+ SET(SALOME_INSTALL_LIBS "lib")
+ENDIF()
+IF(NOT DEFINED SALOME_INSTALL_HEADERS)
+ SET(SALOME_INSTALL_HEADERS "include")
+ENDIF()
+IF(NOT DEFINED SALOME_INSTALL_CMAKE)
+ SET(SALOME_INSTALL_CMAKE "lib/cmake/ydefx")
+ENDIF()
+
+SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Path to install Python files")
+SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Path to install binary files")
+SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Path to install libraries")
+SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Path to install headers")
+SET(SALOME_INSTALL_CMAKE "${SALOME_INSTALL_CMAKE}" CACHE PATH "Path to install cmake configuration files")
+
+# there are some problems if the configuration tools are included before the
+# detection of py2cpp and SalomeKERNEL
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")
FIND_PACKAGE(SalomePythonInterp REQUIRED)
FIND_PACKAGE(SalomePythonLibs REQUIRED)
-SET(PY2CPP_ROOT_DIR $ENV{PY2CPP_ROOT_DIR} CACHE PATH "Path to py2cpp")
-IF( EXISTS ${PY2CPP_ROOT_DIR} )
- LIST(APPEND CMAKE_MODULE_PATH "${PY2CPP_ROOT_DIR}/lib/cmake/py2cpp")
-ELSE()
- MESSAGE(FATAL_ERROR "We absolutely need py2cpp, please define PY2CPP_ROOT_DIR")
-ENDIF()
-FIND_PACKAGE(Py2cpp REQUIRED)
-
IF(YDEFX_BUILD_GUI)
FIND_PACKAGE(Qt5Widgets CONFIG REQUIRED)
ENDIF(YDEFX_BUILD_GUI)
-SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install Python files")
-
ADD_SUBDIRECTORY(src)
+
+INSTALL(EXPORT ydefxCfg_cmake DESTINATION ${SALOME_INSTALL_CMAKE} FILE ydefxConfig.cmake)
JobParametersProxy.hxx
Sample.hxx
SamplePyConversions.hxx
+ PyConversions.hxx
Exceptions.hxx
MonoPyJob.hxx
TMonoPyJob.hxx
TARGET_LINK_LIBRARIES(ydefx ${ydefx_LINK})
TARGET_INCLUDE_DIRECTORIES(ydefx PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/cpp>
- $<INSTALL_INTERFACE:include>)
+ $<INSTALL_INTERFACE:${SALOME_INSTALL_HEADERS}>)
-INSTALL(TARGETS ydefx DESTINATION lib)
-INSTALL(TARGETS ydefx EXPORT Findydefx LIBRARY DESTINATION lib)
-INSTALL(FILES ${ydefx_HEADERS} DESTINATION include/ydefx)
-INSTALL(EXPORT Findydefx DESTINATION lib/cmake/ydefx)
+INSTALL(TARGETS ydefx DESTINATION ${SALOME_INSTALL_LIBS})
+INSTALL(TARGETS ydefx EXPORT ydefxCfg_cmake LIBRARY DESTINATION ${SALOME_INSTALL_LIBS})
+INSTALL(FILES ${ydefx_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}/ydefx)
ADD_SUBDIRECTORY(Test)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQtExt)
-#INCLUDE_DIRECTORIES(
-# ${QT_INCLUDES}
-# ${PROJECT_SOURCE_DIR}/src/cpp
-#)
-
-#ADD_DEFINITIONS(
-# ${QT_DEFINITIONS}
-# ${GUI_DEFINITIONS}
-# ${PYTHON_DEFINITIONS}
-#)
SET(CMAKE_AUTOMOC ON)
INCLUDE_DIRECTORIES(
${PYTHON_DEFINITIONS}
)
-SET(YDEFX_SOURCES
+SET(YDEFXGUI_SOURCES
ResourceWidget.cxx
ParamsConfig.cxx
PathsConfig.cxx
QuickConfig.cxx
)
-SET(YDEFX_HEADERS
+SET(YDEFXGUI_HEADERS
ResourceWidget.hxx
)
-SET(YDEFX_link_LIBRARIES
+SET(YDEFXGUI_link_LIBRARIES
Qt5::Widgets
ydefx
)
-ADD_LIBRARY(ydefxgui ${YDEFX_SOURCES})
-TARGET_LINK_LIBRARIES(ydefxgui ${YDEFX_link_LIBRARIES})
+ADD_LIBRARY(ydefxgui ${YDEFXGUI_SOURCES})
+TARGET_LINK_LIBRARIES(ydefxgui ${YDEFXGUI_link_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(ydefxgui PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/gui>
- $<INSTALL_INTERFACE:include>)
+ $<INSTALL_INTERFACE:${SALOME_INSTALL_HEADERS}>)
ADD_EXECUTABLE(ydefxgui.exe ydefxgui.cxx)
TARGET_LINK_LIBRARIES(ydefxgui.exe ydefxgui)
+
+INSTALL(TARGETS ydefxgui DESTINATION ${SALOME_INSTALL_LIBS})
+INSTALL(TARGETS ydefxgui EXPORT ydefxCfg_cmake LIBRARY DESTINATION ${SALOME_INSTALL_LIBS})
+INSTALL(FILES ${YDEFXGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}/ydefx)