diff options
Diffstat (limited to 'cmake-e')
-rw-r--r-- | cmake-e/.gitignore | 5 | ||||
-rw-r--r-- | cmake-e/CMakeLists.txt | 45 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/EFLCheck.cmake | 12 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/EFLlcov.cmake | 31 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/FindCheck.cmake | 28 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/FindEcore.cmake | 59 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/FindEdje.cmake | 28 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/FindEet.cmake | 28 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/FindEfreet.cmake | 28 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/FindEina.cmake | 28 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/FindElementary.cmake | 28 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/FindEvas.cmake | 28 | ||||
-rw-r--r-- | cmake-e/cmake/Modules/MakeDistcheck.cmake | 122 | ||||
-rw-r--r-- | cmake-e/cmakeconfig.h.in | 13 | ||||
-rw-r--r-- | cmake-e/examples/hello/CMakeLists.txt | 20 | ||||
-rw-r--r-- | cmake-e/examples/hello/main.c | 10 | ||||
-rw-r--r-- | cmake-e/lib/CMakeLists.txt | 19 | ||||
-rw-r--r-- | cmake-e/lib/ecmake.c | 59 | ||||
-rw-r--r-- | cmake-e/lib/ecmake.h | 7 | ||||
-rwxr-xr-x | cmake-e/test | 3 |
20 files changed, 601 insertions, 0 deletions
diff --git a/cmake-e/.gitignore b/cmake-e/.gitignore new file mode 100644 index 0000000..030ee40 --- /dev/null +++ b/cmake-e/.gitignore @@ -0,0 +1,5 @@ +*.swp +Session.vim +tags +.clang_complete +/build diff --git a/cmake-e/CMakeLists.txt b/cmake-e/CMakeLists.txt new file mode 100644 index 0000000..103665b --- /dev/null +++ b/cmake-e/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 2.6) +project(ecmake) +set(ECMAKE_VERSION_MAJOR 0) +set(ECMAKE_VERSION_MINOR 1) +set(ECMAKE_VERSION_MICRO 0) +set(ECMAKE_VERSION ${ECMAKE_VERSION_MAJOR}.${ECMAKE_VERSION_MINOR}.${ECMAKE_VERSION_MICRO}) + +set(PACKAGE ${CMAKE_PROJECT_NAME}) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + +include_directories ("${PROJECT_BINARY_DIR}") + +find_package(Eina REQUIRED) +find_package(Evas REQUIRED) +find_package(Elementary REQUIRED) + +# likely put this into an FindCompilerAttribute.cmake: +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__ + ) + +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}/lib") + +ADD_DEFINITIONS(-DHAVE_CONFIG_H) + +configure_file ( + "${PROJECT_SOURCE_DIR}/cmakeconfig.h.in" + "${PROJECT_BINARY_DIR}/config.h" + ) + +include(EFLCheck) + +add_subdirectory(lib) +add_subdirectory(examples/hello) + +#add_subdirectory(tests EXCLUDE_FROM_ALL) + diff --git a/cmake-e/cmake/Modules/EFLCheck.cmake b/cmake-e/cmake/Modules/EFLCheck.cmake new file mode 100644 index 0000000..f729325 --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/EFLlcov.cmake b/cmake-e/cmake/Modules/EFLlcov.cmake new file mode 100644 index 0000000..e151df9 --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/FindCheck.cmake b/cmake-e/cmake/Modules/FindCheck.cmake new file mode 100644 index 0000000..795b615 --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/FindEcore.cmake b/cmake-e/cmake/Modules/FindEcore.cmake new file mode 100644 index 0000000..9778347 --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/FindEdje.cmake b/cmake-e/cmake/Modules/FindEdje.cmake new file mode 100644 index 0000000..927b31d --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/FindEet.cmake b/cmake-e/cmake/Modules/FindEet.cmake new file mode 100644 index 0000000..ae215d3 --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/FindEfreet.cmake b/cmake-e/cmake/Modules/FindEfreet.cmake new file mode 100644 index 0000000..d245206 --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/FindEina.cmake b/cmake-e/cmake/Modules/FindEina.cmake new file mode 100644 index 0000000..acbd799 --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/FindElementary.cmake b/cmake-e/cmake/Modules/FindElementary.cmake new file mode 100644 index 0000000..5b75bfc --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/FindEvas.cmake b/cmake-e/cmake/Modules/FindEvas.cmake new file mode 100644 index 0000000..fe980d3 --- /dev/null +++ b/cmake-e/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-e/cmake/Modules/MakeDistcheck.cmake b/cmake-e/cmake/Modules/MakeDistcheck.cmake new file mode 100644 index 0000000..1f383a5 --- /dev/null +++ b/cmake-e/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/cmake-e/cmakeconfig.h.in b/cmake-e/cmakeconfig.h.in new file mode 100644 index 0000000..02416c8 --- /dev/null +++ b/cmake-e/cmakeconfig.h.in @@ -0,0 +1,13 @@ +#define PACKAGE "@CMAKE_PROJECT_NAME@" +#define PACKAGE_NAME PACKAGE +#define VERSION "@ECMAKE_VERSION@" +#define VMAJ @ECMAKE_VERSION_MAJOR@ +#define VMIN @ECMAKE_VERSION_MINOR@ +#define VMIC @ECMAKE_VERSION_MICRO@ + +#cmakedefine HAVE___ATTRIBUTE__ +#ifdef HAVE___ATTRIBUTE__ +#define __UNUSED__ __attribute__((unused)) +#else +#define __UNUSED__ +#endif diff --git a/cmake-e/examples/hello/CMakeLists.txt b/cmake-e/examples/hello/CMakeLists.txt new file mode 100644 index 0000000..caae503 --- /dev/null +++ b/cmake-e/examples/hello/CMakeLists.txt @@ -0,0 +1,20 @@ +LIST(APPEND HELLO_WORLD_CC_SOURCES + main.c + ) + +include_directories( + ${ELEMENTARY_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/lib + ) + +add_executable(hello_world ${HELLO_WORLD_CC_SOURCES}) + +get_target_property(ecmake_LIB_FILE ecmake LOCATION) +target_link_libraries(hello_world + ${ELEMENTARY_LIBRARIES} + ${ecmake_LIB_FILE} + ) + +add_dependencies(hello_world ecmake) + +add_test(Example_hello_world hello_world) diff --git a/cmake-e/examples/hello/main.c b/cmake-e/examples/hello/main.c new file mode 100644 index 0000000..7f4a907 --- /dev/null +++ b/cmake-e/examples/hello/main.c @@ -0,0 +1,10 @@ +#include <Elementary.h> +#include "ecmake.h" + +EAPI_MAIN int +elm_main(int argc, char **argv) +{ + return hello_world(); +} + +ELM_MAIN() diff --git a/cmake-e/lib/CMakeLists.txt b/cmake-e/lib/CMakeLists.txt new file mode 100644 index 0000000..6539c55 --- /dev/null +++ b/cmake-e/lib/CMakeLists.txt @@ -0,0 +1,19 @@ +LIST(APPEND ECMAKE_CC_SOURCES + ecmake.c + ) + +include_directories( + ${ELEMENTARY_INCLUDE_DIRS} + ) + +add_library(ecmake SHARED ${ECMAKE_CC_SOURCES}) +target_link_libraries(ecmake + ${ELEMENTARY_LIBRARIES} + ${EFL_COVERAGE_LIBS} + ) + +set_target_properties(ecmake PROPERTIES + COMPILE_FLAGS "${EFL_COVERAGE_CFLAGS}") +set_target_properties(ecmake PROPERTIES + VERSION ${ECMAKE_VERSION} SOVERSION ${ECMAKE_VERSION_MAJOR}) +set_target_properties(ecmake PROPERTIES OUTPUT_NAME "ecmake") diff --git a/cmake-e/lib/ecmake.c b/cmake-e/lib/ecmake.c new file mode 100644 index 0000000..715bfac --- /dev/null +++ b/cmake-e/lib/ecmake.c @@ -0,0 +1,59 @@ + +#include "ecmake.h" +#include "config.h" + +#include <Elementary.h> + +static void +on_done(void *data, Evas_Object *obj, void *event_info) +{ + // quit the mainloop (elm_run function will return) + elm_exit(); +} + +int +hello_world() +{ + Evas_Object *win, *box, *lab, *btn; + + // new window - do the usual and give it a name (hello) and title (Hello) + win = elm_win_util_standard_add("hello", "Hello"); + // when the user clicks "close" on a window there is a request to delete + evas_object_smart_callback_add(win, "delete,request", on_done, NULL); + + // add a box object - default is vertical. a box holds children in a row, + // either horizontally or vertically. nothing more. + box = elm_box_add(win); + // make the box horizontal + elm_box_horizontal_set(box, EINA_TRUE); + // add object as a resize object for the window (controls window minimum + // size as well as gets resized if window is resized) + elm_win_resize_object_add(win, box); + evas_object_show(box); + + // add a label widget, set the text and put it in the pad frame + lab = elm_label_add(win); + // set default text of the label + elm_object_text_set(lab, "Hello out there world!"); + // pack the label at the end of the box + elm_box_pack_end(box, lab); + evas_object_show(lab); + + // add an ok button + btn = elm_button_add(win); + // set default text of button to "OK" + elm_object_text_set(btn, "OK"); + // pack the button at the end of the box + elm_box_pack_end(box, btn); + evas_object_show(btn); + // call on_done when button is clicked + evas_object_smart_callback_add(btn, "clicked", on_done, NULL); + + // now we are done, show the window + evas_object_show(win); + + // run the mainloop and process events and callbacks + elm_run(); + elm_shutdown(); + return 0; +} diff --git a/cmake-e/lib/ecmake.h b/cmake-e/lib/ecmake.h new file mode 100644 index 0000000..f7f456f --- /dev/null +++ b/cmake-e/lib/ecmake.h @@ -0,0 +1,7 @@ +#ifndef ECMAKE_H +#define ECMAKE_H + +int +hello_world(); + +#endif diff --git a/cmake-e/test b/cmake-e/test new file mode 100755 index 0000000..8a1f698 --- /dev/null +++ b/cmake-e/test @@ -0,0 +1,3 @@ +#! /bin/bash +[ -e build ] && rm -fr build +mkdir build && cd build && cmake .. && make && examples/hello/hello_world |