From d595f3c52fe99c122b3ec7da0023b563defda330 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Thu, 2 Jan 2014 10:48:20 +0100 Subject: Initial import --- CMakeLists.txt | 43 +++++++++++++++++++++++++ DESCRIPTION | 22 +++++++++++++ cmake/Modules/MacroEnsureOutOfSourceBuild.cmake | 17 ++++++++++ mof/CMakeLists.txt | 0 mof/LMI_SSSD.mof | 5 +++ src/CMakeLists.txt | 1 + src/sssd/CMakeLists.txt | 40 +++++++++++++++++++++++ 7 files changed, 128 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/Modules/MacroEnsureOutOfSourceBuild.cmake create mode 100644 mof/CMakeLists.txt create mode 100644 mof/LMI_SSSD.mof create mode 100644 src/CMakeLists.txt create mode 100644 src/sssd/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c30909c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 2.6) +project(openlmi-sssd-provider C) + +# Version of the provider, needed by cim_registration() macro +set(OPENLMI_VERSION_MAJOR 0) +set(OPENLMI_VERSION_MINOR 1) +set(OPENLMI_VERSION_REVISION 0) +set(OPENLMI_VERSION "${OPENLMI_VERSION_MAJOR}.${OPENLMI_VERSION_MINOR}.${OPENLMI_VERSION_REVISION}") + +# Command for MOF registration +set(OPENLMI_MOF_REGISTER "openlmi-mof-register") + +# Where to lookup cmake modules +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) + +# Disallow in-source build +include(MacroEnsureOutOfSourceBuild) +macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.") + +# Set LIB_SUFFIX to 64 on 64bit architectures +if(CMAKE_SIZEOF_VOID_P EQUAL 4) + set(LIB_SUFFIX "") +else(CMAKE_SIZEOF_VOID_P EQUAL 4) + SET(LIB_SUFFIX 64) +endif(CMAKE_SIZEOF_VOID_P EQUAL 4) + +# Set install locations +set(REG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/openlmi-providers") +set(MOF_INSTALL_DIR "${REG_INSTALL_DIR}") +if (DEFINED LIB_INSTALL_DIR) + set(LIB_INSTALL_DIR "${LIB_INSTALL_DIR}/cmpi") +else (DEFINED LIB_INSTALL_DIR) + set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmpi") +endif (DEFINED LIB_INSTALL_DIR) + +# Prerequisites +include(OpenLMIMacros) +find_package(CMPI REQUIRED) +find_package(KonkretCMPI REQUIRED) + +# Add subdirectories +add_subdirectory(mof) +add_subdirectory(src) diff --git a/DESCRIPTION b/DESCRIPTION index 85f8d7c..30b46a2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,2 +1,24 @@ OpenLMI SSSD provider +1. Build dependencies +- konkretcmpi-devel +- openlmi-providers-devel +- sblim-cmpi-devel +- cim-schema + +2. How to build and install the provider +# create a separate build directory +mkdir build +cd build + +# create makefile with cmake +cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr /path/to/source + +# build library +make + +# install +sudo make install + +# register provider with OpenLMI +sudo make register-SSSD diff --git a/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake b/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake new file mode 100644 index 0000000..a2e9480 --- /dev/null +++ b/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake @@ -0,0 +1,17 @@ +# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD() +# MACRO_ENSURE_OUT_OF_SOURCE_BUILD() + +# Copyright (c) 2006, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +macro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage) + + string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource) + if (_insource) + message(SEND_ERROR "${_errorMessage}") + message(FATAL_ERROR "Remove the file CMakeCache.txt in ${CMAKE_SOURCE_DIR} first.") + endif (_insource) + +endmacro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD) diff --git a/mof/CMakeLists.txt b/mof/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/mof/LMI_SSSD.mof b/mof/LMI_SSSD.mof new file mode 100644 index 0000000..181efe5 --- /dev/null +++ b/mof/LMI_SSSD.mof @@ -0,0 +1,5 @@ +[Version("0.1.0")] +class LMI_SSSD +{ + +}; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..57c9763 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(sssd) diff --git a/src/sssd/CMakeLists.txt b/src/sssd/CMakeLists.txt new file mode 100644 index 0000000..2393a6f --- /dev/null +++ b/src/sssd/CMakeLists.txt @@ -0,0 +1,40 @@ +# Names +set(PROVIDER_NAME SSSD) +set(LIBRARY_NAME cmpiLMI_${PROVIDER_NAME}) +set(MOF LMI_${PROVIDER_NAME}.mof) +set(REG LMI_${PROVIDER_NAME}.reg) + +# CFLAGS +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -ggdb3 -O0") + +# Generate headers and sources from the MOF file +konkretcmpi_generate(${MOF} CIM_PROVIDERS CIM_HEADERS CIM_CLASSES) + +# Include directories +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMPI_INCLUDE_DIR}) + +# Source files +set(provider_SRCS LMI_${PROVIDER_NAME}Provider.c) + +# Define library +add_library(${LIBRARY_NAME} SHARED + ${provider_SRCS} + ${CIM_PROVIDERS} + ${CIM_HEADERS}) + +target_link_libraries(${LIBRARY_NAME} + openlmicommon + ${KONKRETCMPI_LIBRARIES}) + +# Create registration file +cim_registration(${PROVIDER_NAME} ${LIBRARY_NAME} ${MOF} ${REG_INSTALL_DIR}) + +# Install +install(TARGETS ${LIBRARY_NAME} DESTINATION ${LIB_INSTALL_DIR}) +install(FILES ../../mof/${MOF} DESTINATION ${MOF_INSTALL_DIR}) + +# Uninstall +add_custom_target(uninstall-${PROVIDER_NAME} + rm ${REG_INSTALL_DIR}/${REG} + ${MOF_INSTALL_DIR}/${MOF} + ${LIB_INSTALL_DIR}/lib${LIBRARY_NAME}.so) -- cgit