Skip to content

Commit

Permalink
Make libscap a cmake submodule
Browse files Browse the repository at this point in the history
Signed-off-by: Grzegorz Nosek <[email protected]>
  • Loading branch information
gnosek committed Mar 29, 2021
1 parent ea8a77b commit f67183a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ option(WITH_CHISEL "Include chisel implementation" OFF)

option(CREATE_TEST_TARGETS "Enable make-targets for unit testing" ON)

add_subdirectory(userspace/libscap)
include(libscap)
add_subdirectory(userspace/libsinsp)

if(CREATE_TEST_TARGETS AND NOT WIN32)
Expand Down
20 changes: 20 additions & 0 deletions cmake/modules/libscap.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
if(NOT HAVE_LIBSCAP)
set(HAVE_LIBSCAP On)

if(NOT LIBSCAP_DIR)
get_filename_component(LIBSCAP_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE)
endif()

option(USE_BUNDLED_DEPS "Enable bundled dependencies instead of using the system ones" ON)

include(ExternalProject)

add_definitions(-DPLATFORM_NAME="${CMAKE_SYSTEM_NAME}")

get_filename_component(DRIVER_CONFIG_DIR ${CMAKE_BINARY_DIR}/driver/src ABSOLUTE)
get_filename_component(LIBSCAP_INCLUDE_DIR ${LIBSCAP_DIR}/userspace/libscap ABSOLUTE)
set(LIBSCAP_INCLUDE_DIRS ${LIBSCAP_INCLUDE_DIR} ${DRIVER_CONFIG_DIR})

add_subdirectory(${LIBSCAP_DIR}/userspace/libscap ${PROJECT_BINARY_DIR}/libscap)

endif()
2 changes: 1 addition & 1 deletion userspace/libsinsp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
include_directories(./)
include_directories(../../common)
include_directories(../libscap)
include_directories(${LIBSCAP_INCLUDE_DIR})
include_directories(../async)
include_directories(./include)

Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/dumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ limitations under the License.

#include "sinsp.h"
#include "sinsp_int.h"
#include "../libscap/scap.h"
#include "scap.h"
#include "dumper.h"

sinsp_dumper::sinsp_dumper(sinsp* inspector)
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ limitations under the License.
#include "sinsp.h"
#include "sinsp_int.h"

#include "../libscap/scap.h"
#include "scap.h"

extern sinsp_evttables g_infotables;

Expand Down
4 changes: 2 additions & 2 deletions userspace/libsinsp/sinsp_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ limitations under the License.

using namespace std;

#include "../libscap/scap.h"
#include "scap.h"
#include "settings.h"
#include "utils.h"
#include "../libscap/scap.h"
#include "scap.h"
#include "parsers.h"
#include "ifinfo.h"
#include "internal_metrics.h"
Expand Down
2 changes: 1 addition & 1 deletion userspace/libsinsp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if(NOT MINIMAL_BUILD)
endif() # MINIMAL_BUILD

include_directories("..")
include_directories("../../libscap")
include_directories(${LIBSCAP_INCLUDE_DIR})

add_executable(unit-test-libsinsp
cgroup_list_counter.ut.cpp
Expand Down

0 comments on commit f67183a

Please sign in to comment.