From faedfce4198c83acda2ccff77ec1aa8ec8dff9a5 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Tue, 10 Jun 2014 16:33:32 +0100 Subject: [PATCH] maa: add global maa.h and maa.hpp and stop using /usr/include/maa/ * pkg-config now only sees maa.h & maa.hpp * usage of maa/*.{h,hpp} is still allowed * examples updated to use maa.{h,hpp} Signed-off-by: Brendan Le Foll --- Doxyfile.in | 1 + api/maa.h | 6 ++++++ api/maa.hpp | 32 ++++++++++++++++++++++++++++++++ api/{ => maa}/aio.h | 0 api/{ => maa}/aio.hpp | 0 api/{ => maa}/gpio.h | 0 api/{ => maa}/gpio.hpp | 0 api/{ => maa}/i2c.h | 0 api/{ => maa}/i2c.hpp | 0 api/{ => maa}/pwm.h | 0 api/{ => maa}/pwm.hpp | 0 api/{ => maa}/spi.h | 0 api/{ => maa}/spi.hpp | 0 examples/analogin_a0.c | 2 +- examples/blink-io.c | 2 +- examples/c++/AioA0.cpp | 2 +- examples/c++/Blink-IO.cpp | 2 +- examples/c++/I2c-compass.cpp | 2 +- examples/c++/Pwm3-cycle.cpp | 2 +- examples/c++/Spi-pot.cpp | 2 +- examples/cycle-pwm3.c | 2 +- examples/gpio_read6.c | 2 +- examples/i2c_HMC5883L.c | 2 +- examples/isr_pin6.c | 2 +- examples/mmap-io2.c | 2 +- examples/spi_mcp4261.c | 2 +- src/CMakeLists.txt | 9 ++++++++- src/maa.pc.cmake | 2 +- 28 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 api/maa.hpp rename api/{ => maa}/aio.h (100%) rename api/{ => maa}/aio.hpp (100%) rename api/{ => maa}/gpio.h (100%) rename api/{ => maa}/gpio.hpp (100%) rename api/{ => maa}/i2c.h (100%) rename api/{ => maa}/i2c.hpp (100%) rename api/{ => maa}/pwm.h (100%) rename api/{ => maa}/pwm.hpp (100%) rename api/{ => maa}/spi.h (100%) rename api/{ => maa}/spi.hpp (100%) diff --git a/Doxyfile.in b/Doxyfile.in index 7d6a0e7..e608095 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -754,6 +754,7 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = @CMAKE_CURRENT_SOURCE_DIR@/api/ \ + @CMAKE_CURRENT_SOURCE_DIR@/api/maa/ \ @CMAKE_CURRENT_SOURCE_DIR@/README.md \ @CMAKE_CURRENT_SOURCE_DIR@/docs/ diff --git a/api/maa.h b/api/maa.h index 19ba2d3..cb4a9a0 100644 --- a/api/maa.h +++ b/api/maa.h @@ -231,6 +231,12 @@ void maa_result_print(maa_result_t result); */ maa_boolean_t maa_pin_mode_test(int pin, maa_pinmodes_t mode); +#include "maa/pwm.h" +#include "maa/aio.h" +#include "maa/gpio.h" +#include "maa/spi.h" +#include "maa/i2c.h" + #ifdef __cplusplus } #endif diff --git a/api/maa.hpp b/api/maa.hpp new file mode 100644 index 0000000..91f977c --- /dev/null +++ b/api/maa.hpp @@ -0,0 +1,32 @@ +/* + * Author: Brendan Le Foll + * Copyright (c) 2014 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once + +#include "maa.h" +#include "maa/pwm.hpp" +#include "maa/aio.hpp" +#include "maa/gpio.hpp" +#include "maa/i2c.hpp" +#include "maa/spi.hpp" diff --git a/api/aio.h b/api/maa/aio.h similarity index 100% rename from api/aio.h rename to api/maa/aio.h diff --git a/api/aio.hpp b/api/maa/aio.hpp similarity index 100% rename from api/aio.hpp rename to api/maa/aio.hpp diff --git a/api/gpio.h b/api/maa/gpio.h similarity index 100% rename from api/gpio.h rename to api/maa/gpio.h diff --git a/api/gpio.hpp b/api/maa/gpio.hpp similarity index 100% rename from api/gpio.hpp rename to api/maa/gpio.hpp diff --git a/api/i2c.h b/api/maa/i2c.h similarity index 100% rename from api/i2c.h rename to api/maa/i2c.h diff --git a/api/i2c.hpp b/api/maa/i2c.hpp similarity index 100% rename from api/i2c.hpp rename to api/maa/i2c.hpp diff --git a/api/pwm.h b/api/maa/pwm.h similarity index 100% rename from api/pwm.h rename to api/maa/pwm.h diff --git a/api/pwm.hpp b/api/maa/pwm.hpp similarity index 100% rename from api/pwm.hpp rename to api/maa/pwm.hpp diff --git a/api/spi.h b/api/maa/spi.h similarity index 100% rename from api/spi.h rename to api/maa/spi.h diff --git a/api/spi.hpp b/api/maa/spi.hpp similarity index 100% rename from api/spi.hpp rename to api/maa/spi.hpp diff --git a/examples/analogin_a0.c b/examples/analogin_a0.c index a543bd2..6e1a138 100644 --- a/examples/analogin_a0.c +++ b/examples/analogin_a0.c @@ -24,7 +24,7 @@ #include //! [Interesting] -#include "aio.h" +#include "maa/aio.h" int main () { diff --git a/examples/blink-io.c b/examples/blink-io.c index 9b2e6a0..ec74b7c 100644 --- a/examples/blink-io.c +++ b/examples/blink-io.c @@ -28,7 +28,7 @@ #include #include -#include "gpio.h" +#include "maa.h" #define DEFAULT_IOPIN 8 diff --git a/examples/c++/AioA0.cpp b/examples/c++/AioA0.cpp index cfa3af6..47c46ef 100644 --- a/examples/c++/AioA0.cpp +++ b/examples/c++/AioA0.cpp @@ -23,7 +23,7 @@ */ //! [Interesting] -#include "aio.hpp" +#include "maa.hpp" int main () { diff --git a/examples/c++/Blink-IO.cpp b/examples/c++/Blink-IO.cpp index c39af75..70b7023 100644 --- a/examples/c++/Blink-IO.cpp +++ b/examples/c++/Blink-IO.cpp @@ -29,7 +29,7 @@ #include #include -#include "gpio.hpp" +#include "maa.hpp" #define DEFAULT_IOPIN 8 static int iopin; diff --git a/examples/c++/I2c-compass.cpp b/examples/c++/I2c-compass.cpp index d30c518..f742981 100644 --- a/examples/c++/I2c-compass.cpp +++ b/examples/c++/I2c-compass.cpp @@ -26,7 +26,7 @@ #include #include -#include "i2c.hpp" +#include "maa.hpp" #include "math.h" #define MAX_BUFFER_LENGTH 6 diff --git a/examples/c++/Pwm3-cycle.cpp b/examples/c++/Pwm3-cycle.cpp index af8f497..1972634 100644 --- a/examples/c++/Pwm3-cycle.cpp +++ b/examples/c++/Pwm3-cycle.cpp @@ -25,7 +25,7 @@ #include #include -#include "pwm.hpp" +#include "maa.hpp" int running = 0; diff --git a/examples/c++/Spi-pot.cpp b/examples/c++/Spi-pot.cpp index 57a1264..878bdad 100644 --- a/examples/c++/Spi-pot.cpp +++ b/examples/c++/Spi-pot.cpp @@ -26,7 +26,7 @@ #include #include -#include "spi.hpp" +#include "maa.hpp" int running = 0; diff --git a/examples/cycle-pwm3.c b/examples/cycle-pwm3.c index b99d82b..e21a6a6 100644 --- a/examples/cycle-pwm3.c +++ b/examples/cycle-pwm3.c @@ -24,7 +24,7 @@ #include -#include "pwm.h" +#include "maa.h" int main () diff --git a/examples/gpio_read6.c b/examples/gpio_read6.c index baca2e3..c21aeab 100644 --- a/examples/gpio_read6.c +++ b/examples/gpio_read6.c @@ -25,7 +25,7 @@ #include "stdio.h" #include "unistd.h" -#include "gpio.h" +#include "maa.h" int main(int argc, char **argv) diff --git a/examples/i2c_HMC5883L.c b/examples/i2c_HMC5883L.c index d21b452..c2f6531 100644 --- a/examples/i2c_HMC5883L.c +++ b/examples/i2c_HMC5883L.c @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "i2c.h" +#include "maa.h" #include "math.h" #define MAX_BUFFER_LENGTH 6 diff --git a/examples/isr_pin6.c b/examples/isr_pin6.c index 4d5ec57..9f64ae9 100644 --- a/examples/isr_pin6.c +++ b/examples/isr_pin6.c @@ -24,7 +24,7 @@ #include -#include "gpio.h" +#include "maa.h" static volatile int counter = 0; static volatile int oldcounter = 0; diff --git a/examples/mmap-io2.c b/examples/mmap-io2.c index f1516ee..3bd22b1 100644 --- a/examples/mmap-io2.c +++ b/examples/mmap-io2.c @@ -25,7 +25,7 @@ #include "stdio.h" #include -#include "gpio.h" +#include "maa.h" int main(int argc, char **argv) diff --git a/examples/spi_mcp4261.c b/examples/spi_mcp4261.c index b66322d..165e679 100644 --- a/examples/spi_mcp4261.c +++ b/examples/spi_mcp4261.c @@ -22,7 +22,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "spi.h" +#include "maa.h" #include #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0a6bd77..8271ea4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,6 @@ include_directories( ${PROJECT_SOURCE_DIR}/api + ${PROJECT_SOURCE_DIR}/api/maa ${PROJECT_SOURCE_DIR}/include ) @@ -16,6 +17,11 @@ set (maa_LIB_SRCS ${CMAKE_CURRENT_BINARY_DIR}/version.c ) +set (maa_LIB_GLOB_HEADERS + ${PROJECT_SOURCE_DIR}/api/maa.h + ${PROJECT_SOURCE_DIR}/api/maa.hpp +) + add_library (maa SHARED ${maa_LIB_SRCS}) target_link_libraries (maa ${CMAKE_THREAD_LIBS_INIT}) @@ -25,7 +31,8 @@ set_target_properties( SOVERSION ${maa_VERSION_MAJOR} VERSION ${maa_VERSION_STRING} ) -install (DIRECTORY ${PROJECT_SOURCE_DIR}/api/ DESTINATION include/maa) +install (FILES ${maa_LIB_GLOB_HEADERS} DESTINATION include/) +install (DIRECTORY ${PROJECT_SOURCE_DIR}/api/maa DESTINATION include/maa) macro (maa_CREATE_INSTALL_PKGCONFIG generated_file install_location) configure_file (${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY) diff --git a/src/maa.pc.cmake b/src/maa.pc.cmake index d23be50..82e8fb6 100644 --- a/src/maa.pc.cmake +++ b/src/maa.pc.cmake @@ -8,4 +8,4 @@ Description: Low Level Skeleton Library for Communication Version: @maa_VERSION_STRING@ Libs: -L${libdir} -lmaa -Cflags: -I${includedir}/maa +Cflags: -I${includedir} -- 2.7.4