diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 46 | ||||
-rwxr-xr-x | build.sh | 74 | ||||
-rw-r--r-- | cmake/Modules/EFLCheck.cmake | 12 | ||||
-rw-r--r-- | cmake/Modules/EFLlcov.cmake | 31 | ||||
-rw-r--r-- | cmake/Modules/FindCheck.cmake | 28 | ||||
-rw-r--r-- | cmake/Modules/FindCompilerAttribute.cmake | 9 | ||||
-rw-r--r-- | cmake/Modules/FindEcore.cmake | 59 | ||||
-rw-r--r-- | cmake/Modules/FindEdje.cmake | 28 | ||||
-rw-r--r-- | cmake/Modules/FindEet.cmake | 28 | ||||
-rw-r--r-- | cmake/Modules/FindEfreet.cmake | 28 | ||||
-rw-r--r-- | cmake/Modules/FindEina.cmake | 28 | ||||
-rw-r--r-- | cmake/Modules/FindElementary.cmake | 28 | ||||
-rw-r--r-- | cmake/Modules/FindEvas.cmake | 28 | ||||
-rw-r--r-- | cmake/Modules/MakeDistcheck.cmake | 122 | ||||
-rw-r--r-- | cmakeconfig.h.in | 13 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/lib/CMakeLists.txt | 22 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 20 |
19 files changed, 607 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..665282a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +eiotas-build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..bd88453 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 2.6) +project(eiotas) +set(EIOTAS_VERSION_MAJOR 0) +set(EIOTAS_VERSION_MINOR 0) +set(EIOTAS_VERSION_MICRO 1) +set(EIOTAS_VERSION ${EIOTAS_VERSION_MAJOR}.${EIOTAS_VERSION_MINOR}.${EIOTAS_VERSION_MICRO}) + +set(PACKAGE ${CMAKE_PROJECT_NAME}) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + +# debug +IF(WANT_DEBUG) + SET(CMAKE_BUILD_TYPE Debug) + SET(EIOTAS_HAVE_DEBUG TRUE) +ELSE() + SET(CMAKE_BUILD_TYPE Release) + SET(EIOTAS_HAVE_DEBUG FALSE) +ENDIF() + +# c flags +SET(CMAKE_C_FLAGS "-O2") +SET(CMAKE_C_FLAGS_RELEASE "") +SET(CMAKE_C_FLAGS_DEBUG "-g -Winline") + +# requirements +include(FindCompilerAttribute) +find_package(Eina REQUIRED) +include(EFLCheck) + +# definitions +ADD_DEFINITIONS(-DPACKAGE_BIN_DIR="${CMAKE_INSTALL_PREFIX}/bin" + -DPACKAGE_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/${CMAKE_PROJECT_NAME}" + -DPACKAGE_LIB_DIR="${CMAKE_INSTALL_PREFIX}/src") + +# CONFIG +ADD_DEFINITIONS(-DHAVE_CONFIG_H) +configure_file ( + "${PROJECT_SOURCE_DIR}/cmakeconfig.h.in" + "${PROJECT_BINARY_DIR}/src/include/eiotas_config.h" + ) +include_directories ("${PROJECT_BINARY_DIR}/src/include") + +# subdirectories +add_subdirectory(src) +add_subdirectory(tests) + diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..eca2464 --- /dev/null +++ b/build.sh @@ -0,0 +1,74 @@ +#! /bin/bash + +VERBOSE=${VERBOSE:-0} +CMAKE_OPTIONS=" + -DCMAKE_COLOR_MAKEFILE=1 \ + -DWANT_DEBUG=1 \ +" +MAKE_OPTS="-j 3" +BUILD_DIR=./eiotas-build + +[ -f cmake_opts ] && source cmake_opts + +function cmake_init() { + echo -e " * cmake init\n" + if [ ! -d $BUILD_DIR ]; then + mkdir $BUILD_DIR || exit 1 + fi + cd $BUILD_DIR || exit 1 + if [ ! -e CMakeCache.txt ]; then + cmake ${CMAKE_OPTIONS} .. || exit 1 + fi + cd .. || exit 1 +} + +function cmake_clean() { + echo -e " * clean cmake files\n" && rm $BUILD_DIR/CMakeCache.txt 2>/dev/null +} + +function cmake_rm() { + echo -e " * rm cmake files\n" && rm -fr $BUILD_DIR 2>/dev/null +} + +function cmake_make() { + cmake_init + echo -e " * cmake make\n" && cd $BUILD_DIR || exit 1 + if [ $VERBOSE -eq 1 ]; then + VERBOSE=1 make $MAKE_OPTS || exit 1 + else + make $MAKE_OPTS || exit 1 + fi + cd .. +} + +function cmake_exec() { + cmake_init + echo -e " * execute tests\n" && $BUILD_DIR/tests/tests || exit 1 +} + +if [ $# -eq 0 ]; then + echo "usage $0 [cmds list]" + echo "cmds may be" + echo " r[m] => all built, temp and cache files" + echo " c[lean] => remove cache files" + echo " m[ake] => launch the build process" + echo " x|exec => execute" + echo "ex: $0 r m pkg x" + exit 1 +fi + +for arg in $@; do + case $arg in + c|clean) + cmd="cmake_clean";; + r|rm) + cmd="cmake_rm";; + m|make) + cmd="cmake_make";; + x|exec) + cmd="cmake_exec";; + *) + echo "unknown command ${arg}" && exit 1 + esac + $cmd +done diff --git a/cmake/Modules/EFLCheck.cmake b/cmake/Modules/EFLCheck.cmake new file mode 100644 index 0000000..f729325 --- /dev/null +++ b/cmake/Modules/EFLCheck.cmake @@ -0,0 +1,12 @@ +include(CTest) +ENABLE_TESTING() +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) + +find_package(Check) +set (CHECK_ENABLED ${CHECK_FOUND}) + +set(EFL_COVERAGE false CACHE BOOL "Whether coverage support should be built.'") +if (EFL_COVERAGE) + include(EFLlcov REQUIRED) + ENABLE_COVERAGE() +endif (EFL_COVERAGE) diff --git a/cmake/Modules/EFLlcov.cmake b/cmake/Modules/EFLlcov.cmake new file mode 100644 index 0000000..e151df9 --- /dev/null +++ b/cmake/Modules/EFLlcov.cmake @@ -0,0 +1,31 @@ +macro(ENABLE_COVERAGE) + if (CHECK_ENABLED) + find_program(LCOV_BINARY lcov HINTS ${EFL_LCOV_PATH}) + find_program(GENHTML_BINARY genhtml HINTS ${EFL_LCOV_PATH}) + set(EFL_COVERAGE_CFLAGS "-fprofile-arcs -ftest-coverage") + set(EFL_COVERAGE_LIBS "gcov") + endif (CHECK_ENABLED) + + if (DEFINED LCOV_BINARY) + set(EFL_COVERAGE_ENABLED true) + add_custom_target(lcov-reset + COMMAND rm -rf ${CMAKE_BINARY_DIR}/coverage + COMMAND find ${CMAKE_BINARY_DIR} -name "*.gcda" -delete + COMMAND ${LCOV_BINARY} --zerocounters --directory ${CMAKE_BINARY_DIR} + ) + + add_custom_target(lcov-report + COMMAND mkdir ${CMAKE_BINARY_DIR}/coverage + COMMAND ${LCOV_BINARY} --capture --compat-libtool --output-file ${CMAKE_BINARY_DIR}/coverage/coverage.info --directory ${CMAKE_BINARY_DIR} + COMMAND ${LCOV_BINARY} --remove ${CMAKE_BINARY_DIR}/coverage/coverage.info '*.h' --output-file ${CMAKE_BINARY_DIR}/coverage/coverage.cleaned.info + COMMAND ${GENHTML_BINARY} -t "${PACKAGE}" -o "${CMAKE_BINARY_DIR}/coverage/html" "${CMAKE_BINARY_DIR}/coverage/coverage.cleaned.info" + COMMAND echo "Coverage Report at ${CMAKE_BINARY_DIR}/coverage/html" + ) + + add_custom_target(coverage + COMMAND ${CMAKE_MAKE_PROGRAM} lcov-reset + COMMAND ${CMAKE_MAKE_PROGRAM} check + COMMAND ${CMAKE_MAKE_PROGRAM} lcov-report + ) + endif (DEFINED LCOV_BINARY) +endmacro(ENABLE_COVERAGE) diff --git a/cmake/Modules/FindCheck.cmake b/cmake/Modules/FindCheck.cmake new file mode 100644 index 0000000..795b615 --- /dev/null +++ b/cmake/Modules/FindCheck.cmake @@ -0,0 +1,28 @@ +# - Try to find check +# Once done this will define +# CHECK_FOUND - System has check +# CHECK_INCLUDE_DIRS - The check include directories +# CHECK_LIBRARIES - The libraries needed to use check +# CHECK_DEFINITIONS - Compiler switches required for using check + +find_package(PkgConfig) +pkg_check_modules(PC_LIBCHECK QUIET check) +set(CHECK_DEFINITIONS ${PC_LIBCHECK_CFLAGS_OTHER}) + +find_path(CHECK_INCLUDE_DIR check.h + HINTS ${PC_LIBCHECK_INCLUDEDIR} ${PC_LIBCHECK_INCLUDE_DIRS} + PATH_SUFFIXES check ) + +find_library(CHECK_LIBRARY NAMES check + HINTS ${PC_LIBCHECK_LIBDIR} ${PC_LIBCHECK_LIBRARY_DIRS} ) + +set(CHECK_LIBRARIES ${CHECK_LIBRARY} ) +set(CHECK_INCLUDE_DIRS ${CHECK_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set CHECK_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(check DEFAULT_MSG + CHECK_LIBRARY CHECK_INCLUDE_DIR) + +mark_as_advanced(CHECK_INCLUDE_DIR CHECK_LIBRARY ) diff --git a/cmake/Modules/FindCompilerAttribute.cmake b/cmake/Modules/FindCompilerAttribute.cmake new file mode 100644 index 0000000..6ecd6ff --- /dev/null +++ b/cmake/Modules/FindCompilerAttribute.cmake @@ -0,0 +1,9 @@ +INCLUDE(CheckCSourceCompiles) +SET(HAVE___ATTRIBUTE__) +CHECK_C_SOURCE_COMPILES( + "void foo (int bar __attribute__((unused)) ) { } + static void baz (void) __attribute__((unused)); + static void baz (void) { } + int main(){} + " HAVE___ATTRIBUTE__ + ) diff --git a/cmake/Modules/FindEcore.cmake b/cmake/Modules/FindEcore.cmake new file mode 100644 index 0000000..9778347 --- /dev/null +++ b/cmake/Modules/FindEcore.cmake @@ -0,0 +1,59 @@ +# - Try to find ecore +# Once done this will define +# ECORE_FOUND - System has ecore +# ECORE_INCLUDE_DIRS - The ecore include directories +# ECORE_LIBRARIES - The libraries needed to use ecore +# ECORE_DEFINITIONS - Compiler switches required for using ecore + +# Use FIND_PACKAGE( Ecore COMPONENTS ... ) to enable modules +IF( Ecore_FIND_COMPONENTS ) + FOREACH( component ${Ecore_FIND_COMPONENTS} ) + STRING( TOUPPER ${component} _COMPONENT ) + SET( ECORE_USE_${_COMPONENT} 1 ) + ENDFOREACH( component ) +ENDIF( Ecore_FIND_COMPONENTS ) + +find_package(PkgConfig) +pkg_check_modules(PC_LIBECORE QUIET ecore) +set(ECORE_DEFINITIONS ${PC_LIBECORE_CFLAGS_OTHER}) + +find_path(ECORE_INCLUDE_DIR Ecore.h + HINTS ${PC_LIBECORE_INCLUDEDIR} ${PC_LIBECORE_INCLUDE_DIRS} + PATH_SUFFIXES ecore ) + +find_library(ECORE_LIBRARY NAMES ecore + HINTS ${PC_LIBECORE_LIBDIR} ${PC_LIBECORE_LIBRARY_DIRS} ) + +set(ECORE_LIBRARIES ${ECORE_LIBRARY} ) +set(ECORE_INCLUDE_DIRS ${ECORE_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set ECORE_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(ecore DEFAULT_MSG + ECORE_LIBRARY ECORE_INCLUDE_DIR) + +mark_as_advanced( ECORE_INCLUDE_DIR ECORE_LIBRARY ) + +if (ECORE_USE_ECORE-X) + pkg_check_modules(PC_LIBECORE_X QUIET ecore-x) + set(ECORE_X_DEFINITIONS ${PC_LIBECORE_X_CFLAGS_OTHER}) + + find_path(ECORE_X_INCLUDE_DIR Ecore_X.h + HINTS ${PC_LIBECORE_X_INCLUDEDIR} ${PC_LIBECORE_X_INCLUDE_DIRS} + PATH_SUFFIXES ecore ) + + find_library(ECORE_X_LIBRARY NAMES ecore_x + HINTS ${PC_LIBECORE_X_LIBDIR} ${PC_LIBECORE_X_LIBRARY_DIRS} ) + + set(ECORE_X_LIBRARIES ${ECORE_X_LIBRARY} ) + set(ECORE_X_INCLUDE_DIRS ${ECORE_X_INCLUDE_DIR} ) + + include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set ECORE_X_FOUND to TRUE +# if all listed variables are TRUE + find_package_handle_standard_args(ecore_x DEFAULT_MSG + ECORE_X_LIBRARY ECORE_X_INCLUDE_DIR) + + mark_as_advanced( ECORE_X_INCLUDE_DIR ECORE_X_LIBRARY ) +endif (ECORE_USE_ECORE-X) diff --git a/cmake/Modules/FindEdje.cmake b/cmake/Modules/FindEdje.cmake new file mode 100644 index 0000000..927b31d --- /dev/null +++ b/cmake/Modules/FindEdje.cmake @@ -0,0 +1,28 @@ +# - Try to find edje +# Once done this will define +# EDJE_FOUND - System has edje +# EDJE_INCLUDE_DIRS - The edje include directories +# EDJE_LIBRARIES - The libraries needed to use edje +# EDJE_DEFINITIONS - Compiler switches required for using edje + +find_package(PkgConfig) +pkg_check_modules(PC_LIBEDJE QUIET edje) +set(EDJE_DEFINITIONS ${PC_LIBEDJE_CFLAGS_OTHER}) + +find_path(EDJE_INCLUDE_DIR Edje.h + HINTS ${PC_LIBEDJE_INCLUDEDIR} ${PC_LIBEDJE_INCLUDE_DIRS} + PATH_SUFFIXES edje ) + +find_library(EDJE_LIBRARY NAMES edje + HINTS ${PC_LIBEDJE_LIBDIR} ${PC_LIBEDJE_LIBRARY_DIRS} ) + +set(EDJE_LIBRARIES ${EDJE_LIBRARY} ) +set(EDJE_INCLUDE_DIRS ${EDJE_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set EDJE_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(edje DEFAULT_MSG + EDJE_LIBRARY EDJE_INCLUDE_DIR) + +mark_as_advanced(EDJE_INCLUDE_DIR EDJE_LIBRARY ) diff --git a/cmake/Modules/FindEet.cmake b/cmake/Modules/FindEet.cmake new file mode 100644 index 0000000..ae215d3 --- /dev/null +++ b/cmake/Modules/FindEet.cmake @@ -0,0 +1,28 @@ +# - Try to find eet +# Once done this will define +# EET_FOUND - System has eet +# EET_INCLUDE_DIRS - The eet include directories +# EET_LIBRARIES - The libraries needed to use eet +# EET_DEFINITIONS - Compiler switches required for using eet + +find_package(PkgConfig) +pkg_check_modules(PC_LIBEET QUIET eet) +set(EET_DEFINITIONS ${PC_LIBEET_CFLAGS_OTHER}) + +find_path(EET_INCLUDE_DIR Eet.h + HINTS ${PC_LIBEET_INCLUDEDIR} ${PC_LIBEET_INCLUDE_DIRS} + PATH_SUFFIXES eet ) + +find_library(EET_LIBRARY NAMES eet + HINTS ${PC_LIBEET_LIBDIR} ${PC_LIBEET_LIBRARY_DIRS} ) + +set(EET_LIBRARIES ${EET_LIBRARY} ) +set(EET_INCLUDE_DIRS ${EET_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set EET_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(eet DEFAULT_MSG + EET_LIBRARY EET_INCLUDE_DIR) + +mark_as_advanced( EET_INCLUDE_DIR EET_LIBRARY ) diff --git a/cmake/Modules/FindEfreet.cmake b/cmake/Modules/FindEfreet.cmake new file mode 100644 index 0000000..d245206 --- /dev/null +++ b/cmake/Modules/FindEfreet.cmake @@ -0,0 +1,28 @@ +# - Try to find efreet +# Once done this will define +# EFREET_FOUND - System has efreet +# EFREET_INCLUDE_DIRS - The efreet include directories +# EFREET_LIBRARIES - The libraries needed to use efreet +# EFREET_DEFINITIONS - Compiler switches required for using efreet + +find_package(PkgConfig) +pkg_check_modules(PC_LIBEFREET QUIET efreet) +set(EFREET_DEFINITIONS ${PC_LIBEFREET_CFLAGS_OTHER}) + +find_path(EFREET_INCLUDE_DIR Efreet.h + HINTS ${PC_LIBEFREET_INCLUDEDIR} ${PC_LIBEFREET_INCLUDE_DIRS} + PATH_SUFFIXES efreet ) + +find_library(EFREET_LIBRARY NAMES efreet + HINTS ${PC_LIBEFREET_LIBDIR} ${PC_LIBEFREET_LIBRARY_DIRS} ) + +set(EFREET_LIBRARIES ${EFREET_LIBRARY} ) +set(EFREET_INCLUDE_DIRS ${EFREET_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set EFREET_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(efreet DEFAULT_MSG + EFREET_LIBRARY EFREET_INCLUDE_DIR) + +mark_as_advanced(EFREET_INCLUDE_DIR EFREET_LIBRARY ) diff --git a/cmake/Modules/FindEina.cmake b/cmake/Modules/FindEina.cmake new file mode 100644 index 0000000..acbd799 --- /dev/null +++ b/cmake/Modules/FindEina.cmake @@ -0,0 +1,28 @@ +# - Try to find eina +# Once done this will define +# EINA_FOUND - System has eina +# EINA_INCLUDE_DIRS - The eina include directories +# EINA_LIBRARIES - The libraries needed to use eina +# EINA_DEFINITIONS - Compiler switches required for using eina + +find_package(PkgConfig) +pkg_check_modules(PC_LIBEINA QUIET eina) +set(EINA_DEFINITIONS ${PC_LIBEINA_CFLAGS_OTHER}) + +find_path(EINA_INCLUDE_DIR Eina.h + HINTS ${PC_LIBEINA_INCLUDEDIR} ${PC_LIBEINA_INCLUDE_DIRS} + PATH_SUFFIXES eina ) + +find_library(EINA_LIBRARY NAMES eina + HINTS ${PC_LIBEINA_LIBDIR} ${PC_LIBEINA_LIBRARY_DIRS} ) + +set(EINA_LIBRARIES ${EINA_LIBRARY} ) +set(EINA_INCLUDE_DIRS ${EINA_INCLUDE_DIR} "${EINA_INCLUDE_DIR}/eina" ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set EINA_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(eina DEFAULT_MSG + EINA_LIBRARY EINA_INCLUDE_DIR) + +mark_as_advanced(EINA_INCLUDE_DIR EINA_LIBRARY ) diff --git a/cmake/Modules/FindElementary.cmake b/cmake/Modules/FindElementary.cmake new file mode 100644 index 0000000..5b75bfc --- /dev/null +++ b/cmake/Modules/FindElementary.cmake @@ -0,0 +1,28 @@ +# - Try to find elementary +# Once done this will define +# ELEMENTARY_FOUND - System has elementary +# ELEMENTARY_INCLUDE_DIRS - The elementary include directories +# ELEMENTARY_LIBRARIES - The libraries needed to use elementary +# ELEMENTARY_DEFINITIONS - Compiler switches required for using elementary + +find_package(PkgConfig) +pkg_check_modules(PC_LIBELEMENTARY QUIET elementary) +set(ELEMENTARY_DEFINITIONS ${PC_LIBELEMENTARY_CFLAGS_OTHER}) + +find_path(ELEMENTARY_INCLUDE_DIR Elementary.h + HINTS ${PC_LIBELEMENTARY_INCLUDEDIR} ${PC_LIBELEMENTARY_INCLUDE_DIRS} + PATH_SUFFIXES elementary ) + +find_library(ELEMENTARY_LIBRARY NAMES elementary + HINTS ${PC_LIBELEMENTARY_LIBDIR} ${PC_LIBELEMENTARY_LIBRARY_DIRS} ) + +set(ELEMENTARY_LIBRARIES ${ELEMENTARY_LIBRARY} ) +set(ELEMENTARY_INCLUDE_DIRS ${PC_LIBELEMENTARY_INCLUDEDIR} ${PC_LIBELEMENTARY_INCLUDE_DIRS} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set ELEMENTARY_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(elementary DEFAULT_MSG + ELEMENTARY_LIBRARY ELEMENTARY_INCLUDE_DIR) + +mark_as_advanced(ELEMENTARY_INCLUDE_DIR ELEMENTARY_LIBRARY ) diff --git a/cmake/Modules/FindEvas.cmake b/cmake/Modules/FindEvas.cmake new file mode 100644 index 0000000..fe980d3 --- /dev/null +++ b/cmake/Modules/FindEvas.cmake @@ -0,0 +1,28 @@ +# - Try to find evas +# Once done this will define +# EVAS_FOUND - System has evas +# EVAS_INCLUDE_DIRS - The evas include directories +# EVAS_LIBRARIES - The libraries needed to use evas +# EVAS_DEFINITIONS - Compiler switches required for using evas + +find_package(PkgConfig) +pkg_check_modules(PC_LIBEVAS QUIET evas) +set(EVAS_DEFINITIONS ${PC_LIBEVAS_CFLAGS_OTHER}) + +find_path(EVAS_INCLUDE_DIR Evas.h + HINTS ${PC_LIBEVAS_INCLUDEDIR} ${PC_LIBEVAS_INCLUDE_DIRS} + PATH_SUFFIXES evas ) + +find_library(EVAS_LIBRARY NAMES evas + HINTS ${PC_LIBEVAS_LIBDIR} ${PC_LIBEVAS_LIBRARY_DIRS} ) + +set(EVAS_LIBRARIES ${EVAS_LIBRARY} ) +set(EVAS_INCLUDE_DIRS ${EVAS_INCLUDE_DIR} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set EVAS_FOUND to TRUE +# if all listed variables are TRUE +find_package_handle_standard_args(evas DEFAULT_MSG + EVAS_LIBRARY EVAS_INCLUDE_DIR) + +mark_as_advanced(EVAS_INCLUDE_DIR EVAS_LIBRARY ) diff --git a/cmake/Modules/MakeDistcheck.cmake b/cmake/Modules/MakeDistcheck.cmake new file mode 100644 index 0000000..1f383a5 --- /dev/null +++ b/cmake/Modules/MakeDistcheck.cmake @@ -0,0 +1,122 @@ +# - adds support for the 'make distcheck' command -*- cmake -*- +# Dependencies: +# 1. CPack generating ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz. +# 2. Having a "dist" target, e.g: +# add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) +# Usage: +# add_distcheck() ... called exactly once per project in the top-level +# CMakeLists.txt; it adds the 'dist' and 'distcheck' +# targets +# +# This module implements the 'make dist' and 'make distcheck' +# commands. +# It supports the following variables: +# +# DISTCHECK_TMPDIR ... directory for temporary files +# DISTCHECK_FILENAME ... basename of existing tar.gz.; defaults to +# ${CPACK_SOURCE_PACKAGE_FILE_NAME} +# DISTCHECK_CMAKEFLAGS +# ... flags which are given to 'cmake' by 'make distcheck' +# DISTCHECK_BUILDTARGETS +# ... the build-targets tried by 'make distcheck'; +# defaults to nothing (--> all) +# DISTCHECK_INSTALLTARGETS +# ... the install-targets tried by 'make distcheck'; +# defaults to 'install' +# +# Example: +# --- top-level CMakeLists.txt --- +# add_subdirectory(foo) +# ... +# ... +# set(CPACK_PACKAGE_VERSION_MAJOR ${ECRIRE_VERSION_MAJOR}) +# set(CPACK_PACKAGE_VERSION_MINOR ${ECRIRE_VERSION_MINOR}) +# set(CPACK_PACKAGE_VERSION_PATCH ${ECRIRE_VERSION_MICRO}) +# set(CPACK_SOURCE_GENERATOR "TGZ") +# set(CPACK_SOURCE_IGNORE_FILES +# "${CMAKE_BINARY_DIR};/.git/;~$;${CPACK_SOURCE_IGNORE_FILES}") +# include(CPack) +# add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) +# +# find_package(Distcheck) +# add_distcheck() +# +# +# Copyright (C) 2012 Tom Hacohen <tom@stosb.com> +# Based on the work done by: +# Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de> +# +# Redistribution and use, with or without modification, are permitted +# provided that the following conditions are met: +# +# 1. Redistributions must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# 2. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +macro(add_distcheck) + set(MakeDist_FOUND 1) + + set(DISTCHECK_TMPDIR "${CMAKE_BINARY_DIR}/.make-dist" CACHE PATH "directory for temporary files created by'make dist*'") + set(DISTCHECK_FILENAME ${CPACK_SOURCE_PACKAGE_FILE_NAME} CACHE PATH "basename of the tarball created by 'make dist'") + set(DISTCHECK_CMAKEFLAGS CACHE STRING "flags which are given to 'cmake' by 'make distcheck'") + set(DISTCHECK_BUILDTARGETS "" CACHE STRING "build-target(s) tried by 'make distcheck'") + set(DISTCHECK_INSTALLTARGETS install CACHE STRING "install-target(s) tried by 'make distcheck'") + + mark_as_advanced(DISTCHECK_TMPDIR DISTCHECK_FILENAME DISTCHECK_CMAKEFLAGS DISTCHECK_BUILDTARGETS DISTCHECK_INSTALLTARGETS) + + set(DISTCHECK_BASESOURCEDIR "${DISTCHECK_TMPDIR}/source") + set(DISTCHECK_SOURCEDIR "${DISTCHECK_BASESOURCEDIR}/${DISTCHECK_FILENAME}") + set(DISTCHECK_BUILDDIR "${DISTCHECK_TMPDIR}/build") + set(DISTCHECK_INSTALLTARGETS "install") + add_custom_target(distcheck + # Create the tarball + COMMAND ${CMAKE_MAKE_PROGRAM} dist + + # Create the temp dir. + COMMAND chmod -Rf a+w "${DISTCHECK_TMPDIR}" 2>/dev/null || : + COMMAND rm -rf "${DISTCHECK_TMPDIR}" + COMMAND mkdir -p "${DISTCHECK_SOURCEDIR}" "${DISTCHECK_BUILDDIR}" + + # extract tarball + COMMAND tar xzf ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz -C "${DISTCHECK_BASESOURCEDIR}" + # write-protect sources to detect modifies-sourcetree bugs + COMMAND chmod -R a-w "${DISTCHECK_SOURCEDIR}" + + COMMAND cd "${DISTCHECK_BUILDDIR}" && ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX:PATH="${DISTCHECK_TMPDIR}/install" ${DISTCHECK_CMAKEFLAGS} "${DISTCHECK_SOURCEDIR}" + + COMMAND cd "${DISTCHECK_BUILDDIR}" && ${CMAKE_MAKE_PROGRAM} ${DISTCHECK_BUILDTARGETS} + + # execute 'make install' without DESTDIR + COMMAND cd "${DISTCHECK_BUILDDIR}" && ${CMAKE_MAKE_PROGRAM} ${DISTCHECK_INSTALLTARGETS} DESTDIR= + # write protect installation path to detect writing outside of DESTDIR + COMMAND chmod -R a-w "${DISTCHECK_TMPDIR}/install" + # execute 'make install' with DESTDIR and move the files to a better location + COMMAND cd "${DISTCHECK_BUILDDIR}" && ${CMAKE_MAKE_PROGRAM} ${DISTCHECK_INSTALLTARGETS} DESTDIR="${DISTCHECK_TMPDIR}/install-tmp" + COMMAND mv "${DISTCHECK_TMPDIR}/install-tmp/${DISTCHECK_TMPDIR}/install" "${DISTCHECK_TMPDIR}/install-destdir" + + # generate list of files which were installed by the both 'make + # install' commands above and compare them + COMMAND cd "${DISTCHECK_TMPDIR}/install" && find -type f | sort > ../files.install + COMMAND cd "${DISTCHECK_TMPDIR}/install-destdir" && find -type f | sort > ../files.destdir + COMMAND cd "${DISTCHECK_TMPDIR}" && diff files.install files.destdir + + # cleanup tmpdir + COMMAND chmod -R u+Xw "${DISTCHECK_TMPDIR}" 2>/dev/null || : + COMMAND rm -rf "${DISTCHECK_TMPDIR}" + ) +endmacro(add_distcheck) + diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in new file mode 100644 index 0000000..301f61f --- /dev/null +++ b/cmakeconfig.h.in @@ -0,0 +1,13 @@ +#define PACKAGE "@CMAKE_PROJECT_NAME@" +#define PACKAGE_NAME "@PACKAGE@" +#define VERSION "@EIOTAS_VERSION@" +#define VMAJ @EIOTAS_VERSION_MAJOR@ +#define VMIN @EIOTAS_VERSION_MINOR@ +#define VMIC @EIOTAS_VERSION_MICRO@ + +#cmakedefine HAVE___ATTRIBUTE__ +#ifdef HAVE___ATTRIBUTE__ +#define __UNUSED__ __attribute__((unused)) +#else +#define __UNUSED__ +#endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..3ea7a41 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(lib) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt new file mode 100644 index 0000000..cf5d693 --- /dev/null +++ b/src/lib/CMakeLists.txt @@ -0,0 +1,22 @@ +LIST(APPEND EIOTAS_CC_SOURCES + eiotas_main.c + eiotas_iota.c + eiotas_spin.c + eiotas_room.c + eiotas_door.c + eiotas_board.c + ) + +include_directories( + ${EINA_INCLUDE_DIRS} + ${PROJECT_SOURCE_DIR}/src/include + ) + +add_library(eiotas SHARED ${EIOTAS_CC_SOURCES}) +target_link_libraries(eiotas + ${EINA_LIBRARIES} + ) + +set_target_properties(eiotas PROPERTIES + VERSION ${EIOTAS_VERSION} SOVERSION ${EIOTAS_VERSION_MAJOR}) +set_target_properties(eiotas PROPERTIES OUTPUT_NAME "eiotas") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..20b3e39 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,20 @@ +LIST(APPEND TESTS_CC_SOURCES + main.c + ) + +include_directories( + ${EINA_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/src/include + ) + +add_executable(tests ${TESTS_CC_SOURCES}) + +get_target_property(eiotas_LIB_FILE eiotas LOCATION) +target_link_libraries(tests + ${EINA_LIBRARIES} + ${eiotas_LIB_FILE} + ) + +add_dependencies(tests eiotas) + +add_test(Example_tests tests) |