diff options
author | 2018-01-04 13:43:33 +0800 | |
---|---|---|
committer | 2018-01-05 11:59:39 +0800 | |
commit | 812ff6ca9fcd3e629e49d4328905f33eee8ca3f5 (patch) | |
tree | 04ece7b4da00d9d2f98093774594f4057ae561d4 /src/ceph/cmake/modules/Distutils.cmake | |
parent | 15280273faafb77777eab341909a3f495cf248d9 (diff) |
initial code repo
This patch creates initial code repo.
For ceph, luminous stable release will be used for base code,
and next changes and optimization for ceph will be added to it.
For opensds, currently any changes can be upstreamed into original
opensds repo (https://github.com/opensds/opensds), and so stor4nfv
will directly clone opensds code to deploy stor4nfv environment.
And the scripts for deployment based on ceph and opensds will be
put into 'ci' directory.
Change-Id: I46a32218884c75dda2936337604ff03c554648e4
Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Diffstat (limited to 'src/ceph/cmake/modules/Distutils.cmake')
-rw-r--r-- | src/ceph/cmake/modules/Distutils.cmake | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/ceph/cmake/modules/Distutils.cmake b/src/ceph/cmake/modules/Distutils.cmake new file mode 100644 index 0000000..24d1a50 --- /dev/null +++ b/src/ceph/cmake/modules/Distutils.cmake @@ -0,0 +1,89 @@ +include(CMakeParseArguments) + +function(distutils_install_module name) + set(py_srcs setup.py README.rst requirements.txt test-requirements.txt bin ${name}) + foreach(src ${py_srcs}) + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${src}) + list(APPEND py_clone ${CMAKE_CURRENT_BINARY_DIR}/${src}) + add_custom_command( + OUTPUT ${src} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${src} + COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${src}) + endif() + endforeach() + add_custom_target(${name}-clone ALL + DEPENDS ${py_clone}) + cmake_parse_arguments(DU "" INSTALL_SCRIPT "" ${ARGN}) + install(CODE " + set(options --prefix=${CMAKE_INSTALL_PREFIX}) + if(DEFINED ENV{DESTDIR}) + if(EXISTS /etc/debian_version) + list(APPEND options --install-layout=deb) + endif() + list(APPEND options --root=\$ENV{DESTDIR}) + if(NOT \"${DU_INSTALL_SCRIPT}\" STREQUAL \"\") + list(APPEND options --install-script=${DU_INSTALL_SCRIPT}) + endif() + endif() + execute_process( + COMMAND ${PYTHON${PYTHON_VERSION}_EXECUTABLE} + setup.py install \${options} + WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")") +endfunction(distutils_install_module) + +function(distutils_add_cython_module name src) + get_property(compiler_launcher GLOBAL PROPERTY RULE_LAUNCH_COMPILE) + get_property(link_launcher GLOBAL PROPERTY RULE_LAUNCH_LINK) + set(PY_CC \"${compiler_launcher} ${CMAKE_C_COMPILER}\") + set(PY_CXX \"${compiler_launcher} ${CMAKE_CXX_COMPILER}\") + set(PY_LDSHARED \"${link_launcher} ${CMAKE_C_COMPILER} -shared\") + add_custom_target(${name} ALL + COMMAND + env + CC=${PY_CC} + CXX=${PY_CXX} + LDSHARED=${PY_LDSHARED} + OPT=\"-DNDEBUG -g -fwrapv -O2 -w\" + LDFLAGS=-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + CYTHON_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR} + CEPH_LIBDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + CFLAGS=\"-iquote${CMAKE_SOURCE_DIR}/src/include -w\" + ${PYTHON${PYTHON_VERSION}_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py + build --verbose --build-base ${CYTHON_MODULE_DIR} + --build-platlib ${CYTHON_MODULE_DIR}/lib.${PYTHON${PYTHON_VERSION}_VERSION_MAJOR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${src}) +endfunction(distutils_add_cython_module) + +function(distutils_install_cython_module name) + install(CODE " + set(options --prefix=${CMAKE_INSTALL_PREFIX}) + if(DEFINED ENV{DESTDIR}) + if(EXISTS /etc/debian_version) + list(APPEND options --install-layout=deb) + endif() + list(APPEND options --root=\$ENV{DESTDIR}) + else() + list(APPEND options --root=/) + endif() + execute_process( + COMMAND env + CYTHON_BUILD_DIR=${CMAKE_CURRENT_BINARY_DIR} + CEPH_LIBDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + CC=${CMAKE_C_COMPILER} + CPPFLAGS=\"-iquote${CMAKE_SOURCE_DIR}/src/include\" + LDFLAGS=\"-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\" + ${PYTHON${PYTHON_VERSION}_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py + build --verbose --build-base ${CYTHON_MODULE_DIR} + --build-platlib ${CYTHON_MODULE_DIR}/lib.${PYTHON${PYTHON_VERSION}_VERSION_MAJOR} + build_ext --cython-c-in-temp --build-temp ${CMAKE_CURRENT_BINARY_DIR} --cython-include-dirs ${PROJECT_SOURCE_DIR}/src/pybind/rados + install \${options} --single-version-externally-managed --record /dev/null + egg_info --egg-base ${CMAKE_CURRENT_BINARY_DIR} + --verbose + WORKING_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\" + RESULT_VARIABLE install_res) + if(NOT \"\${install_res}\" STREQUAL 0) + message(FATAL_ERROR \"Failed to build and install ${name} python module\") + endif() + ") +endfunction(distutils_install_cython_module) |