]> Creatis software - bbtk.git/blob - kernel/cmake/BBTKCreatePackageBBdoc.cmake
no message
[bbtk.git] / kernel / cmake / BBTKCreatePackageBBdoc.cmake
1 MACRO(BBTK_CREATE_PACKAGE_BBDOC PACKAGE_NAME)
2   # Creates output dir if it does not exist
3   MKDIR(${BBTK_BBDOC_BUILD_PATH}/${PACKAGE_NAME})
4
5   # Create file make_doc_${PACKAGE_NAME}.bbs
6   SET(OUTPUT_PATH ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}/appli)
7   SET(OUTPUT_FILE ${OUTPUT_PATH}/make_doc_${PACKAGE_NAME}.bbs)
8   SET(DOC_OUTPUT ${BBTK_BBDOC_BUILD_PATH}/${PACKAGE_NAME}/index.html)
9   FILE(WRITE 
10     "${OUTPUT_FILE}" 
11     "#-----------------------------------------\n"
12     "# Generates the html doc for package '${PACKAGE_NAME}'\n"
13     "# Automatically generated by cmake (macro BBTK_CREATE_PACKAGE_BBDOC)\n")
14   FILE(APPEND 
15     "${OUTPUT_FILE}"
16     "#-----------------------------------------\n"
17     "exec freeze\n"
18     "include ${PACKAGE_NAME}\n"
19     "include ${PACKAGE_NAME}-appli\n"
20     "#-----------------------------------------\n"
21 #    "graph ${PACKAGE_NAME} 0 0 ${DOC_OUTPUT} \"${CMAKE_CURRENT_BINARY_DIR}/header.html\" \"Package ${PACKAGE_NAME} documentation\"\n"
22     "graph ${PACKAGE_NAME} 0 0 ${DOC_OUTPUT} \"${BBTK_BBDOC_BUILD_PATH}/${BBTK_PACKAGE_NAME}/header.html\" \"Package ${PACKAGE_NAME} documentation\"\n"
23
24     )
25   IF(WIN32)
26   INSTALL(
27     FILES ${OUTPUT_FILE}
28     DESTINATION ${BBTK_BBS_REL_PATH}/${BBTK_PACKAGE_NAME}/appli
29     )
30   ELSE(WIN32)
31   INSTALL(
32     FILES ${OUTPUT_FILE}
33     DESTINATION ${BBTK_BBS_INSTALL_PATH}/${BBTK_PACKAGE_NAME}/appli
34     )
35   ENDIF(WIN32)
36   
37
38   #
39   IF(WIN32)
40     SET(USE_DOT TRUE)
41     MAKE_DLL_PATH()
42 #    FILE(TO_NATIVE_PATH ${EXECUTABLE_OUTPUT_PATH}/bb${BBTK_PACKAGE_NAME}.dll  pathCommand2 )   
43     FILE(TO_NATIVE_PATH  ${BBTK_BIN_PATH}/bbtk_config.xml pathCommand2 )        
44     FILE(TO_NATIVE_PATH ${PROJECT_BINARY_DIR}/${BBTK_BBS_REL_PATH} pathCommand1 )
45     set(command1 cd ${pathCommand1}) 
46     set(command2 copy ${pathCommand2} . )   
47     set(command3 ${BBTK_BBI} -N -q ${OUTPUT_FILE}) 
48     set(command4 echo done)
49     #del bb${BBTK_PACKAGE_NAME}.dll)
50     
51     ADD_CUSTOM_COMMAND(
52       OUTPUT ${DOC_OUTPUT}
53       COMMAND 
54       #    cd ${BBTK_BIN_PATH}/../bbs/ && ${BBTK_BBI} -n ${OUTPUT_FILE}
55       set ${DLL_PATH} && ${command1} && ${command2} && ${command3} 
56       #&& ${command4}
57       DEPENDS bb${PACKAGE_NAME} 
58       )
59   ELSE(WIN32)
60     SET(LD_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}:${LIBRARY_OUTPUT_PATH}")
61     ADD_CUSTOM_COMMAND(
62       OUTPUT ${DOC_OUTPUT}
63       COMMAND 
64       cd ${EXECUTABLE_OUTPUT_PATH} && export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} && ${BBTK_BBI} -N -q ${OUTPUT_FILE} ${BBTK_MAKE_INDEX}
65       DEPENDS bb${PACKAGE_NAME} 
66       )
67
68
69   ENDIF(WIN32)
70   ADD_CUSTOM_TARGET(bbdoc_${PACKAGE_NAME} ALL
71     DEPENDS ${DOC_OUTPUT} 
72     )
73
74   IF(WIN32)
75   INSTALL( 
76     DIRECTORY ${BBTK_BBDOC_BUILD_PATH}/${PACKAGE_NAME}
77     DESTINATION ${BBTK_BBDOC_INSTALL_PATH}
78     #DESTINATION ${BBTK_BBDOC_REL_PATH}
79     )   
80   ELSE(WIN32)
81   INSTALL( 
82     DIRECTORY ${BBTK_BBDOC_BUILD_PATH}/${PACKAGE_NAME}
83     #DESTINATION ${BBTK_BBDOC_INSTALL_PATH}
84     DESTINATION ${BBTK_BBDOC_REL_PATH}
85     )   
86   ENDIF(WIN32)
87
88   IF(NOT WIN32)
89     # runs bbtk-make-index as a post install step
90     # does not work on windaube
91     IF(NOT BBTK_CORE_PACKAGE)
92       INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${BBTK_BIN_PATH}/bbtk-make-index)")
93     ENDIF(NOT BBTK_CORE_PACKAGE)
94   ENDIF(NOT WIN32)
95
96   
97 ENDMACRO(BBTK_CREATE_PACKAGE_BBDOC NAME)
98