]> SALOME platform Git repositories - modules/shaper.git/blob - CMakeCommon/PythonAPI.cmake
Salome HOME
Issue #2561: CEA 2018-1 Cut
[modules/shaper.git] / CMakeCommon / PythonAPI.cmake
1 ## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 find_package(SWIG REQUIRED)
4 include(${SWIG_USE_FILE})
5
6 #TODO(spo): is -threads necessary?
7 set(CMAKE_SWIG_FLAGS -threads -Wall)
8
9 # Using doxy2swig:
10 # Add to ModuleName.i before any %inlcude:
11 #   %include "doxyhelp.i"
12 # Add to CMakeLists.txt before SWIG_ADD_MODULE(...):
13 #   SET(SWIG_MODULE_ModuleName_EXTRA_DEPS ${SWIG_MODULE_ModuleName_EXTRA_DEPS} doxyhelp.i)
14
15 #TODO(spo): why not use FindDoxygen.cmake module?
16 if(WIN32)
17   find_program(DOXYGEN_EXECUTABLE Doxygen)
18 else()
19   find_program(DOXYGEN_EXECUTABLE doxygen)
20 endif()
21
22 set(EXCLUDE_DOC_DIR "*/Test/* */Mock/*")
23
24 configure_file(${PROJECT_SOURCE_DIR}/doc/swig/doxyfile.in doxyfile @ONLY)
25
26 set(doc_sources)
27 foreach(it "*.h;*.cpp;*.hpp;*.cxx")
28   file(GLOB doc_source RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${it})
29   list(APPEND doc_sources ${doc_source})
30 endforeach()
31 #message(STATUS "${doc_sources}")
32
33 add_custom_command(OUTPUT doxyhelp.i
34   COMMAND "${DOXYGEN_EXECUTABLE}"
35   COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/doxy2swig.py xml/index.xml doxyhelp.i
36   DEPENDS ${doc_sources} ${PROJECT_SOURCE_DIR}/doc/swig/doxyfile.in
37 )