Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
[Issue#20] Include pathing
Browse files Browse the repository at this point in the history
As stated within #20,
headers were being installed to include/evhtp/* but were not reflected
in the source.

This means that even though evhtp specific include files were in
/usr/include/evhtp/blah.h, a user still had to use -I/usr/include/evhtp
which is just dumb.

This is a holdover until we do a proper code refactor that splits up
various things logically.

So for now, ./include/evhtp == public
            ./include/. == private

Aside from the include/evhtp.h which is a placeholder that points
to include/evhtp/evhtp.h
  • Loading branch information
NathanFrench committed Jul 25, 2017
1 parent aec4b3c commit 80a69cc
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 39 deletions.
69 changes: 49 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ endif()
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/compat
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include
${ONIG_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${LIBEVENT_INCLUDE_DIR}
Expand All @@ -259,7 +260,10 @@ if (NOT ${LIBEVENT_OPENSSL_FOUND})
set (EVHTP_DISABLE_SSL ON)
endif(NOT ${LIBEVENT_OPENSSL_FOUND})

set(LIBEVHTP_SOURCES evhtp.c evhtp_numtoa.c htparse.c)
set (LIBEVHTP_SOURCES
evhtp.c
numtoa.c
parser.c)

if (EVHTP_USE_JEMALLOC)
set(LIBEVHTP_EXTERNAL_LIBS ${LIBEVHTP_EXTERNAL_LIBS} jemalloc)
Expand All @@ -272,24 +276,24 @@ endif()

if (NOT EVHTP_DISABLE_EVTHR)
set (LIBEVHTP_EXTERNAL_LIBS ${LIBEVHTP_EXTERNAL_LIBS} pthread)
set (LIBEVHTP_SOURCES ${LIBEVHTP_SOURCES} evthr.c)
endif(NOT EVHTP_DISABLE_EVTHR)
set (LIBEVHTP_SOURCES ${LIBEVHTP_SOURCES} thread.c)
endif()

IF (WIN32)
add_definitions(-DWIN32 -march=i486)
find_library (LIB_WS32 ws2_32)
set (SYS_LIBS ${SYS_LIBS} ${LIB_WS32})
ELSE ()
if (WIN32)
add_definitions (-DWIN32 -march=i486)
find_library (LIB_WS32 ws2_32)
set (SYS_LIBS ${SYS_LIBS} ${LIB_WS32})
else ()
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
find_library (LIB_DL dl)
set (SYS_LIBS ${LIB_DL})
set (SYS_LIBS ${LIB_DL})
endif()

if (NOT APPLE)
find_library (LIB_RT rt)
set (SYS_LIBS ${SYS_LIBS} ${LIB_RT})
set (SYS_LIBS ${SYS_LIBS} ${LIB_RT})
endif()
ENDIF (WIN32)
endif ()

if (EVHTP_BUILD_SHARED)
set (EVHTP_LIBTYPE SHARED)
Expand All @@ -298,11 +302,15 @@ else()
endif()

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/evhtp-config.h.in
${CMAKE_CURRENT_BINARY_DIR}/evhtp-config.h)
${CMAKE_CURRENT_SOURCE_DIR}/include/evhtp/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/evhtp/config.h)

add_library(evhtp ${EVHTP_LIBTYPE} ${LIBEVHTP_SOURCES} ${ONIG_SOURCES})
target_link_libraries(evhtp ${LIBEVHTP_EXTERNAL_LIBS})
add_library(evhtp ${EVHTP_LIBTYPE}
${LIBEVHTP_SOURCES}
${ONIG_SOURCES})

target_link_libraries(evhtp
${LIBEVHTP_EXTERNAL_LIBS})

if (EVHTP_BUILD_SHARED)
set_target_properties(evhtp PROPERTIES SOVERSION "${PROJECT_VERSION}")
Expand All @@ -319,12 +327,33 @@ if(NOT INCLUDE_INSTALL_DIR)
endif()

install (TARGETS evhtp DESTINATION ${LIB_INSTALL_DIR})
install (FILES evhtp.h DESTINATION ${INCLUDE_INSTALL_DIR}/evhtp)
install (FILES htparse.h DESTINATION ${INCLUDE_INSTALL_DIR}/evhtp)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/evhtp-config.h DESTINATION ${INCLUDE_INSTALL_DIR}/evhtp)

install (
FILES
${PROJECT_SOURCE_DIR}/include/evhtp/evhtp.h
${PROJECT_SOURCE_DIR}/include/evhtp/parser.h
${PROJECT_SOURCE_DIR}/include/evhtp/thread.h
DESTINATION
${INCLUDE_INSTALL_DIR}/evhtp)

install (
FILES
${PROJECT_SOURCE_DIR}/include/evhtp.h
DESTINATION
${INCLUDE_INSTALL_DIR})

install (
FILES
${CMAKE_CURRENT_BINARY_DIR}/include/evhtp/config.h
DESTINATION
${INCLUDE_INSTALL_DIR}/evhtp)

if (NOT EVHTP_DISABLE_EVTHR)
install (FILES evthr.h DESTINATION ${INCLUDE_INSTALL_DIR}/evhtp)
install (
FILES
${PROJECT_SOURCE_DIR}/include/evhtp/thread.h
DESTINATION
${INCLUDE_INSTALL_DIR}/evhtp)
endif()

if (NOT EVHTP_DISABLE_REGEX)
Expand Down
6 changes: 3 additions & 3 deletions evhtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <limits.h>
#include <event2/dns.h>

#include "evhtp-internal.h"
#include "evhtp_numtoa.h"
#include "evhtp.h"
#include "internal.h"
#include "numtoa.h"
#include "evhtp/evhtp.h"

/**
* @brief structure containing a single callback and configuration
Expand Down
4 changes: 2 additions & 2 deletions examples/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <inttypes.h>
#include <event2/event.h>

#include "../evhtp-internal.h"
#include "../evhtp.h"
#include "internal.h"
#include "evhtp/evhtp.h"


#ifndef EVHTP_DISABLE_EVTHR
Expand Down
4 changes: 2 additions & 2 deletions examples/test_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include <signal.h>
#include <inttypes.h>

#include "../evhtp-internal.h"
#include "../evhtp.h"
#include "internal.h"
#include "evhtp/evhtp.h"

static int num_threads = 0;
static char * baddr = "127.0.0.1";
Expand Down
7 changes: 7 additions & 0 deletions include/evhtp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef __EVHTP_BASE_H__
#define __EVHTP_BASE_H__

#include <evhtp/evhtp.h>

#endif

File renamed without changes.
6 changes: 3 additions & 3 deletions evhtp.h → include/evhtp/evhtp.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <evhtp-config.h>
#include <evhtp/config.h>

#ifndef __EVHTP__H__
#define __EVHTP__H__

/** @file */
#ifndef EVHTP_DISABLE_EVTHR
#include <evthr.h>
#include <evhtp/thread.h>
#endif

#include <htparse.h>
#include <evhtp/parser.h>

#ifndef EVHTP_DISABLE_REGEX
#include <onigposix.h>
Expand Down
2 changes: 1 addition & 1 deletion htparse.h → include/evhtp/parser.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __HTPARSE_H__
#define __HTPARSE_H__

#include "evhtp-config.h"
#include <evhtp/config.h>

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion evthr.h → include/evhtp/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <pthread.h>
#include <event2/event.h>
#include <evhtp-config.h>
#include <evhtp/config.h>

#ifdef __cplusplus
extern "C" {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion evhtp_numtoa.h → include/numtoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
extern "C" {
#endif

#include "evhtp-config.h"
#include "evhtp/config.h"

/**
* @brief based on the system architecture, convert a size_t
Expand Down
4 changes: 2 additions & 2 deletions evhtp_numtoa.c → numtoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <string.h>
#include <stdint.h>

#include "evhtp-internal.h"
#include "evhtp_numtoa.h"
#include "internal.h"
#include "numtoa.h"

static inline void
strreverse(char * begin, char * end) {
Expand Down
4 changes: 2 additions & 2 deletions htparse.c → parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <ctype.h>
#include <unistd.h>

#include "htparse.h"
#include "evhtp-internal.h"
#include "evhtp/parser.h"
#include "internal.h"

#ifdef PARSER_DEBUG
#define __QUOTE(x) # x
Expand Down
4 changes: 2 additions & 2 deletions evthr.c → thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <event2/event.h>
#include <event2/thread.h>

#include "evhtp-internal.h"
#include "evthr.h"
#include "internal.h"
#include "evhtp/thread.h"

typedef struct evthr_cmd evthr_cmd_t;
typedef struct evthr_pool_slist evthr_pool_slist_t;
Expand Down

0 comments on commit 80a69cc

Please sign in to comment.