From efd2d1ff5db78643abcbb947df5dbede412d1ad1 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 11 Dec 2022 16:21:56 +0100 Subject: [PATCH] Move the public header files into their own directory. This now also calls target_include_directories() to add the public header directory to the search path. --- {src => include}/meshlink++.h | 0 {src => include}/meshlink.h | 0 src/CMakeLists.txt | 10 +++++++--- test/CMakeLists.txt | 2 -- test/blackbox/common/common_types.h | 2 +- test/blackbox/common/test_step.c | 2 +- test/blackbox/common/test_step.h | 2 +- .../test_cases_random_port_bindings01.c | 2 +- .../test_cases_random_port_bindings02.c | 2 +- test/blackbox/util/gen_invite.c | 2 +- test/blacklist.c | 2 +- test/channels-buffer-storage.c | 2 +- test/channels-cornercases.c | 2 +- test/channels-failure.c | 2 +- test/channels-fork.c | 2 +- test/channels-udp-cornercases.c | 2 +- test/channels-udp.c | 2 +- test/channels.c | 2 +- test/discovery.c | 2 +- test/invite-join.c | 2 +- test/meta-connections.c | 2 +- test/metering-relayed.c | 2 +- test/metering-slowping.c | 2 +- test/metering-tcponly.c | 2 +- test/metering.c | 2 +- test/netns_utils.c | 2 +- test/port.c | 2 +- test/trio.c | 2 +- test/trio2.c | 2 +- test/utils.h | 2 +- 30 files changed, 33 insertions(+), 31 deletions(-) rename {src => include}/meshlink++.h (100%) rename {src => include}/meshlink.h (100%) diff --git a/src/meshlink++.h b/include/meshlink++.h similarity index 100% rename from src/meshlink++.h rename to include/meshlink++.h diff --git a/src/meshlink.h b/include/meshlink.h similarity index 100% rename from src/meshlink.h rename to include/meshlink.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1b47d5b4..e9bb93f2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,11 +58,15 @@ add_library(meshlink SHARED ) set(MESHLINK_PUBLIC_HEADERS - meshlink.h - meshlink++.h + ../include/meshlink.h + ../include/meshlink++.h ) target_compile_features(meshlink PUBLIC c_std_11) +target_include_directories(meshlink PUBLIC + $ + $ +) target_link_libraries(meshlink PRIVATE Threads::Threads) set_target_properties(meshlink PROPERTIES PUBLIC_HEADER "${MESHLINK_PUBLIC_HEADERS}") set_property(TARGET meshlink PROPERTY C_VISIBILITY_PRESET hidden) @@ -72,5 +76,5 @@ include(GNUInstallDirs) install(TARGETS meshlink LIBRARY LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/meshlink ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 28bb169e..2d392350 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories (../src) - function(add_test_executable name) add_executable(${name} ${ARGN}) target_link_libraries(${name} meshlink) diff --git a/test/blackbox/common/common_types.h b/test/blackbox/common/common_types.h index edea6501..8d87175c 100644 --- a/test/blackbox/common/common_types.h +++ b/test/blackbox/common/common_types.h @@ -21,7 +21,7 @@ #define COMMON_TYPES_H #include -#include "../../../src/meshlink.h" +#include "meshlink.h" #define NUT_NODE_NAME "nut" diff --git a/test/blackbox/common/test_step.c b/test/blackbox/common/test_step.c index b772b939..663dd670 100644 --- a/test/blackbox/common/test_step.c +++ b/test/blackbox/common/test_step.c @@ -25,7 +25,7 @@ #include #include #include -#include "../../../src/meshlink.h" +#include "meshlink.h" #include "test_step.h" #include "common_handlers.h" diff --git a/test/blackbox/common/test_step.h b/test/blackbox/common/test_step.h index 1704d346..3d53cd94 100644 --- a/test/blackbox/common/test_step.h +++ b/test/blackbox/common/test_step.h @@ -20,7 +20,7 @@ #ifndef TEST_STEP_H #define TEST_STEP_H -#include "../../../src/meshlink.h" +#include "meshlink.h" meshlink_handle_t *execute_open(char *node_name, char *dev_class); char *execute_invite(char *invitee, meshlink_submesh_t *submesh); diff --git a/test/blackbox/run_blackbox_tests/test_cases_random_port_bindings01.c b/test/blackbox/run_blackbox_tests/test_cases_random_port_bindings01.c index 23118c94..d393634d 100644 --- a/test/blackbox/run_blackbox_tests/test_cases_random_port_bindings01.c +++ b/test/blackbox/run_blackbox_tests/test_cases_random_port_bindings01.c @@ -26,7 +26,7 @@ #include "execute_tests.h" #include "test_cases_random_port_bindings01.h" -#include "../../../src/meshlink.h" +#include "meshlink.h" #include "../../../src/devtools.h" #include "../common/containers.h" #include "../common/test_step.h" diff --git a/test/blackbox/run_blackbox_tests/test_cases_random_port_bindings02.c b/test/blackbox/run_blackbox_tests/test_cases_random_port_bindings02.c index 168915ad..b3910d76 100644 --- a/test/blackbox/run_blackbox_tests/test_cases_random_port_bindings02.c +++ b/test/blackbox/run_blackbox_tests/test_cases_random_port_bindings02.c @@ -27,7 +27,7 @@ #include #include #include -#include "../../../src/meshlink.h" +#include "meshlink.h" #include "../common/containers.h" #include "../common/test_step.h" #include "../common/common_handlers.h" diff --git a/test/blackbox/util/gen_invite.c b/test/blackbox/util/gen_invite.c index 365e9fbf..2f9a8476 100644 --- a/test/blackbox/util/gen_invite.c +++ b/test/blackbox/util/gen_invite.c @@ -24,7 +24,7 @@ #include #include #include -#include "../../../src/meshlink.h" +#include "meshlink.h" #include "../common/test_step.h" #define CMD_LINE_ARG_NODENAME 1 diff --git a/test/blacklist.c b/test/blacklist.c index cd545853..f59c7c34 100644 --- a/test/blacklist.c +++ b/test/blacklist.c @@ -14,7 +14,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "utils.h" static struct sync_flag bar_connected; diff --git a/test/channels-buffer-storage.c b/test/channels-buffer-storage.c index af7b25b8..bd6b4493 100644 --- a/test/channels-buffer-storage.c +++ b/test/channels-buffer-storage.c @@ -10,7 +10,7 @@ #include #include "utils.h" -#include "../src/meshlink.h" +#include "meshlink.h" static struct sync_flag b_responded; static struct sync_flag aio_finished; diff --git a/test/channels-cornercases.c b/test/channels-cornercases.c index ca0d9b67..edcb28cd 100644 --- a/test/channels-cornercases.c +++ b/test/channels-cornercases.c @@ -12,7 +12,7 @@ #include #include -#include "../src/meshlink.h" +#include "meshlink.h" #include "utils.h" static volatile bool b_responded = false; diff --git a/test/channels-failure.c b/test/channels-failure.c index 1ac50d31..efcbf60a 100644 --- a/test/channels-failure.c +++ b/test/channels-failure.c @@ -9,7 +9,7 @@ #include #include -#include "../src/meshlink.h" +#include "meshlink.h" #include "utils.h" static bool listen_cb(meshlink_handle_t *mesh, meshlink_node_t *node, uint16_t port) { diff --git a/test/channels-fork.c b/test/channels-fork.c index 74aa84b7..47de0bbf 100644 --- a/test/channels-fork.c +++ b/test/channels-fork.c @@ -18,7 +18,7 @@ #endif #include "utils.h" -#include "../src/meshlink.h" +#include "meshlink.h" static struct sync_flag bar_responded; static struct sync_flag foo_connected; diff --git a/test/channels-udp-cornercases.c b/test/channels-udp-cornercases.c index 0ae37558..04432e42 100644 --- a/test/channels-udp-cornercases.c +++ b/test/channels-udp-cornercases.c @@ -12,7 +12,7 @@ #include #include -#include "../src/meshlink.h" +#include "meshlink.h" #include "utils.h" static struct sync_flag b_responded; diff --git a/test/channels-udp.c b/test/channels-udp.c index 6b71ebdd..4d0f52b8 100644 --- a/test/channels-udp.c +++ b/test/channels-udp.c @@ -10,7 +10,7 @@ #include #include -#include "../src/meshlink.h" +#include "meshlink.h" #include "utils.h" #define SMALL_SIZE 512 diff --git a/test/channels.c b/test/channels.c index f8946d46..aa901ea4 100644 --- a/test/channels.c +++ b/test/channels.c @@ -10,7 +10,7 @@ #include #include "utils.h" -#include "../src/meshlink.h" +#include "meshlink.h" static struct sync_flag b_responded; diff --git a/test/discovery.c b/test/discovery.c index a9ecb831..fc462be4 100644 --- a/test/discovery.c +++ b/test/discovery.c @@ -6,7 +6,7 @@ #include #include "utils.h" -#include "../src/meshlink.h" +#include "meshlink.h" int main(void) { meshlink_set_log_cb(NULL, MESHLINK_DEBUG, log_cb); diff --git a/test/invite-join.c b/test/invite-join.c index 5bd5d415..3e09e35a 100644 --- a/test/invite-join.c +++ b/test/invite-join.c @@ -11,7 +11,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "utils.h" static struct sync_flag baz_reachable; diff --git a/test/meta-connections.c b/test/meta-connections.c index 22d7c21d..0b5aeeae 100644 --- a/test/meta-connections.c +++ b/test/meta-connections.c @@ -7,7 +7,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "netns_utils.h" #include "utils.h" diff --git a/test/metering-relayed.c b/test/metering-relayed.c index 18a421bf..c1cd2a03 100644 --- a/test/metering-relayed.c +++ b/test/metering-relayed.c @@ -9,7 +9,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "netns_utils.h" #include "utils.h" diff --git a/test/metering-slowping.c b/test/metering-slowping.c index e421d6d0..0ba9920f 100644 --- a/test/metering-slowping.c +++ b/test/metering-slowping.c @@ -9,7 +9,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "netns_utils.h" #include "utils.h" diff --git a/test/metering-tcponly.c b/test/metering-tcponly.c index ba0b13f0..fb433dd2 100644 --- a/test/metering-tcponly.c +++ b/test/metering-tcponly.c @@ -9,7 +9,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "netns_utils.h" #include "utils.h" diff --git a/test/metering.c b/test/metering.c index 8ee7257c..d15e1b9d 100644 --- a/test/metering.c +++ b/test/metering.c @@ -9,7 +9,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "netns_utils.h" #include "utils.h" diff --git a/test/netns_utils.c b/test/netns_utils.c index ec7aee4a..eba74e7e 100644 --- a/test/netns_utils.c +++ b/test/netns_utils.c @@ -10,7 +10,7 @@ #include #include -#include "../src/meshlink.h" +#include "meshlink.h" #include "netns_utils.h" #include "utils.h" diff --git a/test/port.c b/test/port.c index cd24f345..9eb4c9e6 100644 --- a/test/port.c +++ b/test/port.c @@ -11,7 +11,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "utils.h" diff --git a/test/trio.c b/test/trio.c index bdb3904e..19560e72 100644 --- a/test/trio.c +++ b/test/trio.c @@ -13,7 +13,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "utils.h" static struct sync_flag received; diff --git a/test/trio2.c b/test/trio2.c index dc57679e..696edfd1 100644 --- a/test/trio2.c +++ b/test/trio2.c @@ -13,7 +13,7 @@ #include #include "meshlink.h" -#include "devtools.h" +#include "../src/devtools.h" #include "utils.h" static struct sync_flag received; diff --git a/test/utils.h b/test/utils.h index 11facfc3..bd1550bb 100644 --- a/test/utils.h +++ b/test/utils.h @@ -5,7 +5,7 @@ #include #include -#include "../src/meshlink.h" +#include "meshlink.h" // Simple synchronisation between threads struct sync_flag { -- 2.39.5