Add an option to enable or disable tests. This will allow the user to
build c-periphery without threads and will avoid the following build
failure:
[ 68%] Building C object CMakeFiles/test_serial.dir/tests/test_serial.c.o
/data/buildroot/buildroot-test/instance-0/output/build/c-periphery-2.2.1/tests/test_gpio_sysfs.c:13:10: fatal error: pthread.h: No such file or directory
#include <pthread.h>
Fixes:
- http://autobuild.buildroot.org/results/6bbc4de3f857dcb7ff5e6f9fa1441ba4e0af1338
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
When using a Buildroot (a build system for generating Embedded Linux
images) to cross compile the c-periphery package, the git commit ID
from Buildroot will be used if Buildroot itself is a Git repo. For
example, Buildroot will perform a build of c-periphery at:
buildroot/output/build/c-periphery
The buildroot directory is a Git repo but the c-periphery source
folder is not. The following command:
git describe
will use the top-level '.git' directory in buildroot for getting the
COMMIT_ID. It will then populate the buildroot COMMIT_ID for
c-periphery itself instead of putting in 'unknown'.
Utilize '--git-dir=' option to force it to only use the '.git'
directory from within the top-level c-periphery folder.
Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>
Modifications to original commit:
* Add "/.git" suffix to path passed to --git-dir option
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
The config file is not always located in the top level directory of
source tree. So, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR
are a better alternative than CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR.
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
Create libperiphery.pc file for pkg-config. Allows to use
PKG_CHECK_MODULE in cmake, meson or autotools projet.
Example with cmake:
In CMakeLists:
pkg_check_modules(CPERIPHERY libperiphery REQUIRED)
-- Checking for module 'libperiphery'
-- Found libperiphery, version 2.1.0
Signed-off-by: Joris Offouga <offougajoris@gmail.com>
Rebase to use fixed variable names and updated cmake project name.
Also, rearrange some definitions in CMakeLists.txt.
Resolves#21.
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>
CMake is used to control the software compilation process using simple
platform and compiler independent configuration files, and generate
native makefiles and workspaces that can be used in the compiler
environment of your choice. See: https://cmake.org/
Also with cmake support, build shared or static library, install to
$libdir, and install headers files to $includir/c-periphery.
With cmake support, it's possible to check if kernel headers is required
for build c-periphery.
Keep Makefile, because lua-periphery's build process currently expects
it.
Signed-off-by: Joris Offouga <offougajoris@gmail.com>
Signed-off-by: Vanya A. Sergeev <v@sergeev.io>