Skip to content

Commit

Permalink
Assorted build-related changes. (netdata#16906)
Browse files Browse the repository at this point in the history
* Rename endian.h to byte_order.h

The underlying issue is that non-relative
header search paths would pick up our own
endian.h. This should be fixed in a follow-up
PR.

* Do not include top-level source dir

* Move h2o dep from libnetdata to netdata binary.

* Update #endif comment.
  • Loading branch information
vkalintiris authored Feb 26, 2024
1 parent ca01640 commit 0e7cde4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ set(LIBNETDATA_FILES
src/libnetdata/os.c
src/libnetdata/os.h
src/libnetdata/simple_hashtable.h
src/libnetdata/endian.h
src/libnetdata/byteorder.h
src/libnetdata/onewayalloc/onewayalloc.c
src/libnetdata/onewayalloc/onewayalloc.h
src/libnetdata/popen/popen.c
Expand Down Expand Up @@ -1464,7 +1464,7 @@ detect_systemd()

add_library(libnetdata STATIC ${LIBNETDATA_FILES})

target_include_directories(libnetdata BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src)
target_include_directories(libnetdata BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src)

# pthread (FIXME: use find_package for this)

Expand Down Expand Up @@ -1592,9 +1592,6 @@ target_include_directories(libnetdata BEFORE PUBLIC ${OPENSSL_INCLUDE_DIRS})
target_compile_options(libnetdata PUBLIC ${OPENSSL_CFLAGS_OTHER})
target_link_libraries(libnetdata PUBLIC ${OPENSSL_LDFLAGS})

# h2o
target_link_libraries(libnetdata PUBLIC "$<$<BOOL:${ENABLE_H2O}>:h2o>")

# mnl
pkg_check_modules(MNL libmnl)
if(MNL_FOUND)
Expand Down Expand Up @@ -2056,6 +2053,7 @@ target_link_libraries(netdata PRIVATE
"$<$<BOOL:${MACOS}>:${IOKIT};${FOUNDATION}>"
"$<$<BOOL:${ENABLE_SENTRY}>:sentry>"
"$<$<BOOL:${ENABLE_WEBRTC}>:LibDataChannel::LibDataChannelStatic>"
"$<$<BOOL:${ENABLE_H2O}>:h2o>"
)

#
Expand Down
6 changes: 3 additions & 3 deletions src/libnetdata/endian.h → src/libnetdata/byteorder.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef LIBNETDATA_ENDIAN_H
#define LIBNETDATA_ENDIAN_H
#ifndef LIBNETDATA_BYTE_ORDER_H
#define LIBNETDATA_BYTE_ORDER_H

/** compatibility header for endian.h
* This is a simple compatibility shim to convert
Expand Down Expand Up @@ -29,4 +29,4 @@
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)

#endif /* LIBNETDATA_ENDIAN_H */
#endif /* LIBNETDATA_BYTE_ORDER_H */
2 changes: 1 addition & 1 deletion src/libnetdata/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int getsysctl(const char *name, int *mib, size_t miblen, void *ptr, size_t *len)
#if __APPLE__

#include <sys/sysctl.h>
#include "endian.h"
#include "byteorder.h"

#define GETSYSCTL_BY_NAME(name, var) getsysctl_by_name(name, &(var), sizeof(var))
int getsysctl_by_name(const char *name, void *ptr, size_t len);
Expand Down

0 comments on commit 0e7cde4

Please sign in to comment.