|
@@ -8,6 +8,110 @@ macro(subdirlist result curdir)
|
8
|
8
|
endforeach()
|
9
|
9
|
set(${result} ${dirlist})
|
10
|
10
|
endmacro()
|
|
11
|
+
|
|
12
|
+macro (upm_CREATE_INSTALL_PKGCONFIG generated_file install_location)
|
|
13
|
+ configure_file (${PROJECT_SOURCE_DIR}/src/pkgconfig.in
|
|
14
|
+ ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
|
|
15
|
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
|
|
16
|
+endmacro (upm_CREATE_INSTALL_PKGCONFIG)
|
|
17
|
+
|
|
18
|
+macro(upm_SWIG_PYTHON)
|
|
19
|
+ if(BUILDSWIGPYTHON)
|
|
20
|
+ set (CMAKE_C_FLAGS -DSWIGPYTHON=${SWIG_FOUND})
|
|
21
|
+ set_source_files_properties (pyupm_${libname}.i PROPERTIES CPLUSPLUS ON)
|
|
22
|
+ swig_add_module (pyupm_${libname} python pyupm_${libname}.i ${libname}.cxx)
|
|
23
|
+ swig_link_libraries (pyupm_${libname} ${PYTHON_LIBRARIES} ${MAA_LIBRARIES})
|
|
24
|
+ target_include_directories ( ${SWIG_MODULE_pyupm_${libname}_REAL_NAME}
|
|
25
|
+ PUBLIC
|
|
26
|
+ "${PYTHON_INCLUDE_PATH}"
|
|
27
|
+ "${PYTHON_INCLUDE_DIRS}"
|
|
28
|
+ )
|
|
29
|
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/_pyupm_${libname}.so
|
|
30
|
+ ${CMAKE_CURRENT_BINARY_DIR}/pyupm_${libname}.py
|
|
31
|
+ DESTINATION lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/
|
|
32
|
+ COMPONENT ${libname})
|
|
33
|
+ endif()
|
|
34
|
+endmacro()
|
|
35
|
+
|
|
36
|
+macro(upm_SWIG_NODE)
|
|
37
|
+ if(BUILDSWIGNODE)
|
|
38
|
+ set (CMAKE_CXX_FLAGS -DBUILDING_NODE_EXTENSION)
|
|
39
|
+ set_source_files_properties (jsupm_${libname}.i PROPERTIES CPLUSPLUS ON)
|
|
40
|
+ set_source_files_properties (jsupm_${libname}.i PROPERTIES SWIG_FLAGS "-node")
|
|
41
|
+ swig_add_module (jsupm_${libname} javascript jsupm_${libname}.i ${libname}.cxx)
|
|
42
|
+ swig_link_libraries (jsupm_${libname} ${MAA_LIBRARIES} ${NODE_LIBRARIES})
|
|
43
|
+ target_include_directories ( ${SWIG_MODULE_jsupm_${libname}_REAL_NAME}
|
|
44
|
+ PUBLIC
|
|
45
|
+ "${NODE_INCLUDE_DIRS}"
|
|
46
|
+ )
|
|
47
|
+ set_target_properties (jsupm_${libname} PROPERTIES
|
|
48
|
+ PREFIX ""
|
|
49
|
+ SUFFIX ".node"
|
|
50
|
+ )
|
|
51
|
+ createpackagejson(${libname})
|
|
52
|
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/jsupm_${libname}.node
|
|
53
|
+ DESTINATION lib/node_modules/jsupm_${libname} COMPONENT ${libname})
|
|
54
|
+ endif()
|
|
55
|
+endmacro()
|
|
56
|
+
|
|
57
|
+macro(upm_doxygen)
|
|
58
|
+ if (DOXYGEN_FOUND)
|
|
59
|
+ set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
|
|
60
|
+ add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${libname}_doc.i
|
|
61
|
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../doxy2swig.py -n
|
|
62
|
+ ${CMAKE_BINARY_DIR}/xml/${libname}_8h.xml
|
|
63
|
+ ${CMAKE_CURRENT_BINARY_DIR}/${libname}_doc.i
|
|
64
|
+ DEPENDS ${CMAKE_BINARY_DIR}/xml/${libname}_8h.xml
|
|
65
|
+ )
|
|
66
|
+ add_custom_target (${libname}doc_i DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${libname}_doc.i)
|
|
67
|
+ add_dependencies (${libname}doc_i doc)
|
|
68
|
+ add_dependencies (${SWIG_MODULE_pyupm_${libname}_REAL_NAME} ${libname}doc_i)
|
|
69
|
+ endif ()
|
|
70
|
+endmacro()
|
|
71
|
+
|
|
72
|
+if (SWIG_FOUND)
|
|
73
|
+ if(BUILDSWIGPYTHON)
|
|
74
|
+ find_package (PythonLibs)
|
|
75
|
+ string (REPLACE "." ";" PYTHON_VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
|
|
76
|
+ list (GET PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR)
|
|
77
|
+ list (GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
|
|
78
|
+ endif(BUILDSWIGPYTHON)
|
|
79
|
+ if(BUILDSWIGNODE)
|
|
80
|
+ find_path (NODE_ROOT_DIR "node/node.h")
|
|
81
|
+ set (NODE_INCLUDE_DIRS
|
|
82
|
+ ${NODE_ROOT_DIR}/src
|
|
83
|
+ ${NODE_ROOT_DIR}/node
|
|
84
|
+ ${NODE_ROOT_DIR}/deps/v8/include
|
|
85
|
+ ${NODE_ROOT_DIR}/deps/uv/include
|
|
86
|
+ )
|
|
87
|
+ macro(createpackagejson)
|
|
88
|
+ configure_file (${PROJECT_SOURCE_DIR}/src/package.json.in ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY)
|
|
89
|
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/package.json
|
|
90
|
+ DESTINATION lib/node_modules/jsupm_${libname} COMPONENT ${libname})
|
|
91
|
+ endmacro()
|
|
92
|
+
|
|
93
|
+ endif(BUILDSWIGNODE)
|
|
94
|
+endif()
|
|
95
|
+
|
|
96
|
+macro(upm_module_init)
|
|
97
|
+ include_directories (${MAA_INCLUDE_DIR} .)
|
|
98
|
+ target_link_libraries (${libname} ${MAA_LIBRARIES})
|
|
99
|
+ set_target_properties(${libname} PROPERTIES PREFIX "libupm-")
|
|
100
|
+ upm_create_install_pkgconfig (upm-${libname}.pc lib${LIB_SUFFIX}/pkgconfig)
|
|
101
|
+ if (SWIG_FOUND)
|
|
102
|
+ upm_swig_python()
|
|
103
|
+ upm_swig_node()
|
|
104
|
+ upm_doxygen()
|
|
105
|
+ endif()
|
|
106
|
+ install (TARGETS ${libname} DESTINATION lib COMPONENT ${libname})
|
|
107
|
+ install (FILES ${libname}.h DESTINATION include/upm COMPONENT ${libname})
|
|
108
|
+
|
|
109
|
+ if (IPK)
|
|
110
|
+ cpack_add_component (${libname} DISPLAY_NAME ${libname} REQUIRED INSTALL_TYPES all)
|
|
111
|
+ set(CPACK_COMPONENT_${libname}_DESCRIPTION "${libdescription}")
|
|
112
|
+ endif()
|
|
113
|
+endmacro(upm_module_init)
|
|
114
|
+
|
11
|
115
|
subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR})
|
12
|
116
|
foreach(subdir ${SUBDIRS})
|
13
|
117
|
add_subdirectory(${subdir})
|