Skip to content

Commit

Permalink
Refactoring headers to separate public API headers from implementatio…
Browse files Browse the repository at this point in the history
…n headers
  • Loading branch information
jholloc committed Dec 1, 2023
1 parent 09e479e commit 4d98c97
Show file tree
Hide file tree
Showing 223 changed files with 1,733 additions and 5,127 deletions.
10 changes: 10 additions & 0 deletions cmake/Modules/FindLibMemcached.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,13 @@ include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( LibMemcached DEFAULT_MSG LIBMEMCACHED_LIBRARIES LIBMEMCACHED_INCLUDES )

mark_as_advanced( LIBMEMCACHED_LIBRARIES LIBMEMCACHED_INCLUDES )

# Create imported target LibMemcached::memcached
if( NOT TARGET LibMemcached::memcached )
add_library( LibMemcached::memcached INTERFACE IMPORTED )

set_target_properties( LibMemcached::memcached PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBMEMCACHED_INCLUDES}"
INTERFACE_LINK_LIBRARIES "${LIBMEMCACHED_LIBRARIES}"
)
endif()
11 changes: 11 additions & 0 deletions cmake/Modules/FindTIRPC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,14 @@ include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( TIRPC DEFAULT_MSG TIRPC_LIBRARIES TIRPC_INCLUDE_DIR )

mark_as_advanced( TIRPC_LIBRARIES TIRPC_INCLUDE_DIR )

# Create imported target TIRPC::TIRPC
if( NOT TARGET TIRPC::TIRPC )
add_library( TIRPC::TIRPC INTERFACE IMPORTED )

set_target_properties( TIRPC::TIRPC PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "__TIRPC__"
INTERFACE_INCLUDE_DIRECTORIES "${TIRPC_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${TIRPC_LIBRARIES}"
)
endif()
10 changes: 10 additions & 0 deletions cmake/Modules/FindXDR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,13 @@ include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( XDR DEFAULT_MSG XDR_LIBRARIES XDR_INCLUDE_DIR )

mark_as_advanced( XDR_LIBRARIES XDR_INCLUDE_DIR )

# Create imported target XDR::XDR
if( NOT TARGET XDR::XDR )
add_library( XDR::XDR SHARED IMPORTED )

set_target_properties( XDR::XDR PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${XDR_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${XDR_LIBRARIES}"
)
endif()
1 change: 1 addition & 0 deletions cmake/plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ macro( uda_plugin )

include_directories(
${CMAKE_SOURCE_DIR}/source
${CMAKE_SOURCE_DIR}/source/include
)

if( NOT APPLE AND NOT WIN32 AND NOT MINGW AND CMAKE_COMPILER_IS_GNUCC )
Expand Down
24 changes: 23 additions & 1 deletion source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ endif()

set( LOGGING_BACKEND "FILE" CACHE STRING "Choose logging backend [FILE;SYSLOG]" )

include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include )

add_subdirectory( bin )
add_subdirectory( cache )
add_subdirectory( logging )
add_subdirectory( authentication )
add_subdirectory( structures )
add_subdirectory( clientserver )
add_subdirectory( c_api )
add_subdirectory( client )
add_subdirectory( client2 )
if( ENABLE_CAPNP )
Expand Down Expand Up @@ -68,7 +69,28 @@ configure_file(
@ONLY
)

set( HEADERS
include/accAPI.h
include/accessors.h
include/client.h
include/clientAPI.h
include/clientMDS.h
include/export.h
include/genStructs.h
include/initStructs.h
include/legacy.h
include/pluginStructs.h
include/struct.h
include/udaDefines.h
include/udaErrors.h
include/udaGetAPI.h
include/udaPlugin.h
include/udaPutAPI.h
include/udaStructs.h
include/udaTypes.h
)
install( FILES uda.h ${CMAKE_BINARY_DIR}/source/version.h DESTINATION include/uda )
install( FILES ${HEADERS} DESTINATION include/uda )

set( ENV_PATH )
if( WIN32 AND NOT MINGW )
Expand Down
30 changes: 14 additions & 16 deletions source/authentication/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
find_package( OpenSSL REQUIRED )
find_package( LibXml2 REQUIRED )

set( LIBS OpenSSL::SSL LibXml2::LibXml2 )

if( WIN32 OR MINGW )
find_package( XDR REQUIRED )
list( APPEND LIBS XDR::XDR )
else()
find_package( TIRPC QUIET)
if( TIRPC_FOUND )
add_definitions( -D__TIRPC__ )
endif()
list( APPEND LIBS TIRPC::TIRPC )
endif()

# Sources

include_directories(
add_library( authentication-client-objects OBJECT udaClientSSL.cpp udaClientSSL.h udaServerSSL.h )
target_link_libraries( authentication-client-objects ${LIBS} )

target_include_directories( authentication-client-objects PRIVATE
${CMAKE_SOURCE_DIR}/source
${OPENSSL_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/source/include
)

if( MINGW OR WIN32 )
include_directories( ${XDR_INCLUDE_DIR} )
elseif( TIRPC_FOUND )
include_directories( ${TIRPC_INCLUDE_DIR} )
endif()

add_library( authentication-client-objects OBJECT udaClientSSL.cpp udaClientSSL.h udaServerSSL.h )
target_link_libraries( authentication-client-objects OpenSSL::SSL LibXml2::LibXml2 )

if( NOT CLIENT_ONLY )
add_library( authentication-server-objects OBJECT udaServerSSL.cpp udaClientSSL.h )
target_compile_definitions( authentication-server-objects PRIVATE -DSERVERBUILD )
target_link_libraries( authentication-server-objects OpenSSL::SSL LibXml2::LibXml2 )
target_link_libraries( authentication-server-objects ${LIBS} )
target_include_directories( authentication-server-objects PRIVATE
${CMAKE_SOURCE_DIR}/source
${CMAKE_SOURCE_DIR}/source/include
)
endif()
6 changes: 5 additions & 1 deletion source/bin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ endif()

find_package( Boost COMPONENTS program_options REQUIRED )

target_include_directories( uda_cli PRIVATE ${CMAKE_SOURCE_DIR}/source ${CMAKE_SOURCE_DIR}/extlib/GSL-4.0.0/include )
target_include_directories( uda_cli PRIVATE
${CMAKE_SOURCE_DIR}/source
${CMAKE_SOURCE_DIR}/source/include
${CMAKE_SOURCE_DIR}/extlib/GSL-4.0.0/include
)

target_link_libraries( uda_cli PRIVATE client-static uda_cpp-static )
target_link_libraries( uda_cli PRIVATE Boost::program_options )
Expand Down
2 changes: 1 addition & 1 deletion source/bin/uda_cli.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <wrappers/c++/UDA.hpp>
#include <clientserver/udaTypes.h>
#include "udaTypes.h"
#include <serialisation/capnp_serialisation.h>

#include <string>
Expand Down
36 changes: 36 additions & 0 deletions source/c_api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
########################################################################################################################
# Dependencies

#find_package( OpenSSL REQUIRED )
find_package( fmt REQUIRED )
#find_package( LibXml2 REQUIRED )

########################################################################################################################
# Sources

set( SRC_FILES
udaGetAPI.cpp
clientAPI.cpp
clientMDS.cpp
accAPI.cpp
udaPutAPI.cpp
)

add_library( c_api-objects OBJECT ${SRC_FILES} )
add_library( fatc_api-objects OBJECT ${SRC_FILES} )

target_link_libraries( c_api-objects PUBLIC fmt::fmt )
target_link_libraries( fatc_api-objects PUBLIC fmt::fmt )

target_compile_definitions( fatc_api-objects PUBLIC -DFATCLIENT )

target_include_directories(
c_api-objects PRIVATE
${CMAKE_SOURCE_DIR}/source
${CMAKE_SOURCE_DIR}/source/include
)
target_include_directories(
fatc_api-objects PRIVATE
${CMAKE_SOURCE_DIR}/source
${CMAKE_SOURCE_DIR}/source/include
)
34 changes: 16 additions & 18 deletions source/client/accAPI.cpp → source/c_api/accAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#ifdef __GNUC__
# include <pthread.h>
# include <strings.h>
# include <cmath>
#else
# include <Windows.h>
# include <string.h>
Expand All @@ -15,21 +14,20 @@
# define strlwr _strlwr
#endif

#include <logging/logging.h>
#include <clientserver/initStructs.h>
#include <clientserver/stringUtils.h>
#include <clientserver/allocData.h>
#include <clientserver/protocol.h>
#include <clientserver/memstream.h>
#include <clientserver/xdrlib.h>
#include <structures/struct.h>
#include <structures/accessors.h>
#include <cache/memcache.hpp>
#include <version.h>

#include "generateErrors.h"
#include "getEnvironment.h"
#include "udaClient.h"
#include "logging/logging.h"
#include "initStructs.h"
#include "clientserver/stringUtils.h"
#include "clientserver/allocData.h"
#include "clientserver/protocol.h"
#include "clientserver/memstream.h"
#include "clientserver/xdrlib.h"
#include "struct.h"
#include "accessors.h"
#include "version.h"

#include "client/generateErrors.h"
#include "client/getEnvironment.h"
#include "client/udaClient.h"

#ifdef __APPLE__
# include <cstdlib>
Expand Down Expand Up @@ -762,12 +760,12 @@ int getIdamServerPort()
return environment->server_port; // Active UDA server service port number
}

const char* getUdaBuildVersion()
const char* udaGetBuildVersion()
{
return UDA_BUILD_VERSION;
}

const char* getUdaBuildDate()
const char* udaGetBuildDate()
{
return UDA_BUILD_DATE;
}
Expand Down
12 changes: 6 additions & 6 deletions source/client/clientAPI.cpp → source/c_api/clientAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
# define strcasecmp _stricmp
#endif

#include <logging/logging.h>
#include <clientserver/initStructs.h>
#include <clientserver/errorLog.h>
#include "logging/logging.h"
#include "initStructs.h"
#include "clientserver/errorLog.h"

#include "makeClientRequestBlock.h"
#include "startup.h"
#include "udaClient.h"
#include "client/makeClientRequestBlock.h"
#include "client/startup.h"
#include "client.h"

int idamClientAPI(const char* file, const char* signal, int pass, int exp_number)
{
Expand Down
10 changes: 5 additions & 5 deletions source/client/clientMDS.cpp → source/c_api/clientMDS.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "clientMDS.h"

#include <logging/logging.h>
#include <clientserver/initStructs.h>
#include <clientserver/protocol.h>
#include "logging/logging.h"
#include "initStructs.h"
#include "clientserver/protocol.h"

#include "startup.h"
#include "udaClient.h"
#include "client/startup.h"
#include "client.h"

/**
* Reads the Requested Data
Expand Down
18 changes: 9 additions & 9 deletions source/client/udaGetAPI.cpp → source/c_api/udaGetAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
# include <strings.h>
#endif

#include <logging/logging.h>
#include <clientserver/initStructs.h>
#include <clientserver/errorLog.h>
#include <clientserver/printStructs.h>

#include "makeClientRequestBlock.h"
#include "startup.h"
#include "udaClient.h"
#include "logging/logging.h"
#include "initStructs.h"
#include "clientserver/errorLog.h"
#include "clientserver/printStructs.h"

#include "client/makeClientRequestBlock.h"
#include "client/startup.h"
#include "client.h"
#include "accAPI.h"
#include "getEnvironment.h"
#include "client/getEnvironment.h"

#ifdef MEMDEBUG
#include <mcheck.h>
Expand Down
16 changes: 8 additions & 8 deletions source/client/udaPutAPI.cpp → source/c_api/udaPutAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

#include "udaPutAPI.h"

#include <logging/logging.h>
#include <clientserver/initStructs.h>
#include <clientserver/errorLog.h>
#include <clientserver/printStructs.h>
#include <clientserver/allocData.h>

#include "makeClientRequestBlock.h"
#include "udaClient.h"
#include "logging/logging.h"
#include "initStructs.h"
#include "clientserver/errorLog.h"
#include "clientserver/printStructs.h"
#include "clientserver/allocData.h"

#include "client/makeClientRequestBlock.h"
#include "client/udaClient.h"

// Create a list of data blocks to be sent to the server
// Each block has a private name
Expand Down
Loading

0 comments on commit 4d98c97

Please sign in to comment.