Skip to content

Commit

Permalink
refactor: move public headers to include/
Browse files Browse the repository at this point in the history
  • Loading branch information
ntamas committed Nov 17, 2024
1 parent 3a7b366 commit c98d8be
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ set(CMAKE_C_VISIBILITY_PRESET hidden)

# Add version information
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/plfit_version.h.in
${CMAKE_CURRENT_BINARY_DIR}/src/plfit_version.h
${CMAKE_CURRENT_SOURCE_DIR}/include/plfit_version.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/plfit_version.h
)

add_subdirectory(src)
Expand Down
2 changes: 2 additions & 0 deletions src/plfit.h → include/plfit.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@

#include <stdlib.h>
#include "plfit_decls.h"
#include "plfit_error.h"
#include "plfit_mt.h"
#include "plfit_sampling.h"
#include "plfit_version.h"

__BEGIN_DECLS
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 19 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ endif()
set(PLFIT_CORE_SRCS error.c gss.c kolmogorov.c lbfgs.c mt.c plfit.c options.c rbinom.c sampling.c stats.c hzeta.c)

add_library(plfit ${PLFIT_CORE_SRCS})
target_include_directories(plfit PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(
plfit PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
)
set_target_properties(plfit PROPERTIES SOVERSION 0)
target_link_libraries(plfit ${MATH_LIBRARY})

Expand All @@ -28,7 +34,7 @@ endif()
include(GenerateExportHeader)
generate_export_header(plfit
STATIC_DEFINE PLFIT_STATIC
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/src/plfit_export.h
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/include/plfit_export.h
)

join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}")
Expand All @@ -38,13 +44,13 @@ configure_file(${PROJECT_SOURCE_DIR}/libplfit.pc.in ${PROJECT_BINARY_DIR}/libplf
install(TARGETS plfit LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(
FILES
${PROJECT_SOURCE_DIR}/src/plfit.h
${PROJECT_SOURCE_DIR}/src/plfit_decls.h
${PROJECT_SOURCE_DIR}/src/plfit_error.h
${PROJECT_BINARY_DIR}/src/plfit_export.h
${PROJECT_SOURCE_DIR}/src/plfit_mt.h
${PROJECT_SOURCE_DIR}/src/plfit_sampling.h
${PROJECT_BINARY_DIR}/src/plfit_version.h
${PROJECT_SOURCE_DIR}/include/plfit.h
${PROJECT_SOURCE_DIR}/include/plfit_decls.h
${PROJECT_SOURCE_DIR}/include/plfit_error.h
${PROJECT_BINARY_DIR}/include/plfit_export.h
${PROJECT_SOURCE_DIR}/include/plfit_mt.h
${PROJECT_SOURCE_DIR}/include/plfit_sampling.h
${PROJECT_BINARY_DIR}/include/plfit_version.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/plfit
)
install(
Expand Down Expand Up @@ -81,7 +87,10 @@ if(PLFIT_COMPILE_PYTHON_MODULE)

target_include_directories(
plfit_python PUBLIC
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/include
${Python3_INCLUDE_DIRS}
)

Expand Down
2 changes: 0 additions & 2 deletions src/plfit.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "plfit_error.h"
#include "gss.h"
#include "lbfgs.h"
#include "plfit.h"
#include "kolmogorov.h"
#include "plfit_sampling.h"
#include "hzeta.h"

/* #define PLFIT_DEBUG */
Expand Down
1 change: 0 additions & 1 deletion src/plgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <time.h>
#include "getopt.h"
#include "plfit.h"
#include "plfit_sampling.h"

typedef struct _cmd_options_t {
long int num_samples;
Expand Down
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/src
)
add_definitions(-DDATADIR=\"${CMAKE_CURRENT_SOURCE_DIR}/../data\")

set(TEST_CASES discrete continuous real sampling underflow_handling xmin_too_low)
Expand Down

0 comments on commit c98d8be

Please sign in to comment.