mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 18:08:53 +00:00
merging cmake changes for distro-specific tables
This commit is contained in:
commit
dd4a9d9d74
170
CMake/CMakeLibs.cmake
Normal file
170
CMake/CMakeLibs.cmake
Normal file
@ -0,0 +1,170 @@
|
||||
# -*- mode: cmake; -*-
|
||||
# - osquery macro definitions
|
||||
#
|
||||
# Remove boilerplate code for linking the osquery core dependent libs
|
||||
# compiling and handling static or dynamic (run time load) libs.
|
||||
|
||||
# osquery-specific helper macros
|
||||
macro(SET_OSQUERY_COMPILE TARGET)
|
||||
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS ${OS_COMPILE_FLAGS})
|
||||
set(OPTIONAL_FLAGS ${ARGN})
|
||||
list(LENGTH OPTIONAL_FLAGS NUM_OPTIONAL_FLAGS)
|
||||
if(${NUM_OPTIONAL_FLAGS} GREATER 0)
|
||||
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS ${OPTIONAL_FLAGS})
|
||||
endif()
|
||||
endmacro(SET_OSQUERY_COMPILE)
|
||||
|
||||
macro(ADD_OSQUERY_TEST TEST_NAME SOURCE)
|
||||
if(NOT DEFINED ENV{SKIP_TESTS})
|
||||
add_executable(${TEST_NAME} ${SOURCE})
|
||||
TARGET_OSQUERY_LINK_WHOLE(${TEST_NAME} libosquery_basic)
|
||||
target_link_libraries(${TEST_NAME} libosquery_additional)
|
||||
target_link_libraries(${TEST_NAME} gtest)
|
||||
target_link_libraries(${TEST_NAME} glog)
|
||||
set(OPTIONAL_FLAGS ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TEST_NAME} "${OPTIONAL_FLAGS}")
|
||||
add_test(${TEST_NAME} ${TEST_NAME})
|
||||
endif()
|
||||
endmacro(ADD_OSQUERY_TEST)
|
||||
|
||||
# Core/non core link helping macros (tell the build to link ALL).
|
||||
macro(ADD_OSQUERY_LINK LINK)
|
||||
list(APPEND OSQUERY_ADDITIONAL_LINKS ${LINK})
|
||||
set(OSQUERY_ADDITIONAL_LINKS ${OSQUERY_ADDITIONAL_LINKS} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_LINK)
|
||||
|
||||
macro(ADD_OSQUERY_CORE_LINK LINK)
|
||||
list(APPEND OSQUERY_LINKS ${LINK})
|
||||
set(OSQUERY_LINKS ${OSQUERY_LINKS} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_CORE_LINK)
|
||||
|
||||
# Core/non core lists of target source files.
|
||||
macro(ADD_OSQUERY_LIBRARY TARGET)
|
||||
add_library(${TARGET} OBJECT ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TARGET})
|
||||
list(APPEND OSQUERY_ADDITIONAL_SOURCES $<TARGET_OBJECTS:${TARGET}>)
|
||||
set(OSQUERY_ADDITIONAL_SOURCES ${OSQUERY_ADDITIONAL_SOURCES} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_LIBRARY TARGET)
|
||||
|
||||
macro(ADD_OSQUERY_CORE_LIBRARY TARGET)
|
||||
add_library(${TARGET} OBJECT ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TARGET})
|
||||
list(APPEND OSQUERY_SOURCES $<TARGET_OBJECTS:${TARGET}>)
|
||||
set(OSQUERY_SOURCES ${OSQUERY_SOURCES} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_CORE_LIBRARY TARGET)
|
||||
|
||||
# Core/non core lists of target source files compiled as ObjC++.
|
||||
macro(ADD_OSQUERY_OBJCXX_LIBRARY TARGET)
|
||||
add_library(${TARGET} OBJECT ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TARGET} "${OBJCXX_COMPILE_FLAGS}")
|
||||
list(APPEND OSQUERY_ADDITIONAL_SOURCES $<TARGET_OBJECTS:${TARGET}>)
|
||||
set(OSQUERY_ADDITIONAL_SOURCES ${OSQUERY_SOURCES} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_OBJCXX_LIBRARY TARGET)
|
||||
|
||||
macro(ADD_OSQUERY_CORE_OBJCXX_LIBRARY TARGET)
|
||||
add_library(${TARGET} OBJECT ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TARGET} "${OBJCXX_COMPILE_FLAGS}")
|
||||
list(APPEND OSQUERY_SOURCES $<TARGET_OBJECTS:${TARGET}>)
|
||||
set(OSQUERY_SOURCES ${OSQUERY_SOURCES} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_CORE_OBJCXX_LIBRARY TARGET)
|
||||
|
||||
# Helper to abstract OS/Compiler whole linking.
|
||||
macro(TARGET_OSQUERY_LINK_WHOLE TARGET OSQUERY_LIB)
|
||||
target_link_libraries(${TARGET} "${OS_WHOLELINK_PRE}")
|
||||
target_link_libraries(${TARGET} ${OSQUERY_LIB})
|
||||
target_link_libraries(${TARGET} "${OS_WHOLELINK_POST}")
|
||||
endmacro(TARGET_OSQUERY_LINK_WHOLE)
|
||||
|
||||
set(GLOBAL PROPERTY AMALGAMATE_TARGETS "")
|
||||
macro(GET_GENERATION_DEPS BASE_PATH)
|
||||
# Depend on the generation code.
|
||||
set(GENERATION_DEPENDENCIES "")
|
||||
file(GLOB TABLE_FILES_TEMPLATES "${BASE_PATH}/osquery/tables/templates/*.in")
|
||||
set(GENERATION_DEPENDENCIES
|
||||
"${BASE_PATH}/tools/codegen/*.py"
|
||||
"${BASE_PATH}/osquery/tables/specs/blacklist"
|
||||
)
|
||||
list(APPEND GENERATION_DEPENDENCIES ${TABLE_FILES_TEMPLATES})
|
||||
endmacro()
|
||||
|
||||
# Find and generate table plugins from .table syntax
|
||||
macro(GENERATE_TABLES TABLES_PATH BASE_PATH)
|
||||
# Get all matching files for all platforms.
|
||||
file(GLOB TABLE_FILES "${TABLES_PATH}/specs/x/*.table")
|
||||
set(TABLE_FILES_PLATFORM "")
|
||||
if(APPLE)
|
||||
file(GLOB TABLE_FILES_PLATFORM "${TABLES_PATH}/specs/darwin/*.table")
|
||||
elseif(FREEBSD)
|
||||
file(GLOB TABLE_FILES_PLATFORM "${TABLES_PATH}/specs/freebsd/*.table")
|
||||
else(LINUX)
|
||||
file(GLOB TABLE_FILES_PLATFORM "${TABLES_PATH}/specs/linux/*.table")
|
||||
if(CENTOS)
|
||||
file(GLOB TABLE_FILES_PLATFORM "${TABLES_PATH}/specs/centos/*.table")
|
||||
elseif(UBUNTU)
|
||||
file(GLOB TABLE_FILES_PLATFORM "${TABLES_PATH}/specs/ubuntu/*.table")
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND TABLE_FILES ${TABLE_FILES_PLATFORM})
|
||||
|
||||
get_property(TARGETS GLOBAL PROPERTY AMALGAMATE_TARGETS)
|
||||
set(NEW_TARGETS "")
|
||||
foreach(TABLE_FILE ${TABLE_FILES})
|
||||
list(FIND TARGETS "${TABLE_FILE}" INDEX)
|
||||
if (${INDEX} EQUAL -1)
|
||||
# Do not set duplicate targets.
|
||||
list(APPEND NEW_TARGETS "${TABLE_FILE}")
|
||||
endif()
|
||||
endforeach()
|
||||
set_property(GLOBAL PROPERTY AMALGAMATE_TARGETS "${NEW_TARGETS}")
|
||||
endmacro()
|
||||
|
||||
macro(GENERATE_UTILITY TABLE_NAME)
|
||||
set(TABLE_SPEC "${CMAKE_SOURCE_DIR}/osquery/tables/specs/x/${TABLE_NAME}.table")
|
||||
set_property(GLOBAL APPEND PROPERTY AMALGAMATE_TARGETS "${TABLE_SPEC}")
|
||||
endmacro()
|
||||
|
||||
macro(GENERATE_TABLE TABLE_FILE NAME BASE_PATH OUTPUT)
|
||||
set(TABLE_FILE_GEN ${TABLE_FILE})
|
||||
string(REGEX REPLACE
|
||||
".*/specs/.*/(.*)\\.table"
|
||||
"${CMAKE_BINARY_DIR}/generated/tables_${NAME}/\\1.cpp"
|
||||
TABLE_FILE_GEN
|
||||
${TABLE_FILE_GEN}
|
||||
)
|
||||
|
||||
GET_GENERATION_DEPS(${BASE_PATH})
|
||||
add_custom_command(
|
||||
OUTPUT "${TABLE_FILE_GEN}"
|
||||
COMMAND python "${BASE_PATH}/tools/codegen/gentable.py"
|
||||
"${TABLE_FILE}" "${TABLE_FILE_GEN}" "$ENV{DISABLE_BLACKLIST}"
|
||||
DEPENDS ${TABLE_FILE} ${GENERATION_DEPENDENCIES}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
list(APPEND ${OUTPUT} "${TABLE_FILE_GEN}")
|
||||
endmacro()
|
||||
|
||||
macro(AMALGAMATE BASE_PATH NAME OUTPUT)
|
||||
GET_GENERATION_DEPS(${BASE_PATH})
|
||||
get_property(TARGETS GLOBAL PROPERTY AMALGAMATE_TARGETS)
|
||||
|
||||
set(GENERATED_TARGETS "")
|
||||
foreach(TARGET ${TARGETS})
|
||||
GENERATE_TABLE(${TARGET} ${NAME} ${BASE_PATH} GENERATED_TARGETS)
|
||||
endforeach()
|
||||
|
||||
# Include the generated folder in make clean.
|
||||
set_directory_properties(PROPERTY
|
||||
ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/generated")
|
||||
|
||||
# Append all of the code to a single amalgamation.
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_BINARY_DIR}/generated/${NAME}_amalgamation.cpp"
|
||||
COMMAND python "${BASE_PATH}/tools/codegen/amalgamate.py"
|
||||
"${BASE_PATH}/osquery/tables/" "${CMAKE_BINARY_DIR}/generated" "${NAME}"
|
||||
DEPENDS ${GENERATED_TARGETS} ${GENERATION_DEPENDENCIES}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
set(${OUTPUT} "${CMAKE_BINARY_DIR}/generated/${NAME}_amalgamation.cpp")
|
||||
endmacro()
|
@ -1,76 +0,0 @@
|
||||
# -*- mode: cmake; -*-
|
||||
# - osquery macro definitions
|
||||
#
|
||||
# Remove boilerplate code for linking the osquery core dependent libs
|
||||
# compiling and handling static or dynamic (run time load) libs.
|
||||
|
||||
# osquery-specific helper macros
|
||||
macro(SET_OSQUERY_COMPILE TARGET)
|
||||
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS ${OS_COMPILE_FLAGS})
|
||||
set(OPTIONAL_FLAGS ${ARGN})
|
||||
list(LENGTH OPTIONAL_FLAGS NUM_OPTIONAL_FLAGS)
|
||||
if(${NUM_OPTIONAL_FLAGS} GREATER 0)
|
||||
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS ${OPTIONAL_FLAGS})
|
||||
endif()
|
||||
endmacro(SET_OSQUERY_COMPILE)
|
||||
|
||||
macro(ADD_OSQUERY_TEST TEST_NAME SOURCE)
|
||||
if(NOT DEFINED ENV{SKIP_TESTS})
|
||||
add_executable(${TEST_NAME} ${SOURCE})
|
||||
TARGET_OSQUERY_LINK_WHOLE(${TEST_NAME} libosquery_basic)
|
||||
target_link_libraries(${TEST_NAME} libosquery_additional)
|
||||
target_link_libraries(${TEST_NAME} gtest)
|
||||
target_link_libraries(${TEST_NAME} glog)
|
||||
set(OPTIONAL_FLAGS ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TEST_NAME} "${OPTIONAL_FLAGS}")
|
||||
add_test(${TEST_NAME} ${TEST_NAME})
|
||||
endif()
|
||||
endmacro(ADD_OSQUERY_TEST)
|
||||
|
||||
# Core/non core link helping macros (tell the build to link ALL).
|
||||
macro(ADD_OSQUERY_LINK LINK)
|
||||
list(APPEND OSQUERY_ADDITIONAL_LINKS ${LINK})
|
||||
set(OSQUERY_ADDITIONAL_LINKS ${OSQUERY_ADDITIONAL_LINKS} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_LINK)
|
||||
|
||||
macro(ADD_OSQUERY_CORE_LINK LINK)
|
||||
list(APPEND OSQUERY_LINKS ${LINK})
|
||||
set(OSQUERY_LINKS ${OSQUERY_LINKS} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_CORE_LINK)
|
||||
|
||||
# Core/non core lists of target source files.
|
||||
macro(ADD_OSQUERY_LIBRARY TARGET)
|
||||
add_library(${TARGET} OBJECT ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TARGET})
|
||||
list(APPEND OSQUERY_ADDITIONAL_SOURCES $<TARGET_OBJECTS:${TARGET}>)
|
||||
set(OSQUERY_ADDITIONAL_SOURCES ${OSQUERY_ADDITIONAL_SOURCES} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_LIBRARY TARGET)
|
||||
|
||||
macro(ADD_OSQUERY_CORE_LIBRARY TARGET)
|
||||
add_library(${TARGET} OBJECT ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TARGET})
|
||||
list(APPEND OSQUERY_SOURCES $<TARGET_OBJECTS:${TARGET}>)
|
||||
set(OSQUERY_SOURCES ${OSQUERY_SOURCES} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_CORE_LIBRARY TARGET)
|
||||
|
||||
# Core/non core lists of target source files compiled as ObjC++.
|
||||
macro(ADD_OSQUERY_OBJCXX_LIBRARY TARGET)
|
||||
add_library(${TARGET} OBJECT ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TARGET} "${OBJCXX_COMPILE_FLAGS}")
|
||||
list(APPEND OSQUERY_ADDITIONAL_SOURCES $<TARGET_OBJECTS:${TARGET}>)
|
||||
set(OSQUERY_ADDITIONAL_SOURCES ${OSQUERY_SOURCES} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_OBJCXX_LIBRARY TARGET)
|
||||
|
||||
macro(ADD_OSQUERY_CORE_OBJCXX_LIBRARY TARGET)
|
||||
add_library(${TARGET} OBJECT ${ARGN})
|
||||
SET_OSQUERY_COMPILE(${TARGET} "${OBJCXX_COMPILE_FLAGS}")
|
||||
list(APPEND OSQUERY_SOURCES $<TARGET_OBJECTS:${TARGET}>)
|
||||
set(OSQUERY_SOURCES ${OSQUERY_SOURCES} PARENT_SCOPE)
|
||||
endmacro(ADD_OSQUERY_CORE_OBJCXX_LIBRARY TARGET)
|
||||
|
||||
# Helper to abstract OS/Compiler whole linking.
|
||||
macro(TARGET_OSQUERY_LINK_WHOLE TARGET OSQUERY_LIB)
|
||||
target_link_libraries(${TARGET} "${OS_WHOLELINK_PRE}")
|
||||
target_link_libraries(${TARGET} ${OSQUERY_LIB})
|
||||
target_link_libraries(${TARGET} "${OS_WHOLELINK_POST}")
|
||||
endmacro(TARGET_OSQUERY_LINK_WHOLE)
|
@ -6,7 +6,7 @@ if(APPLE)
|
||||
set(OS_COMPILE_FLAGS "-std=c++11 -stdlib=libc++ -mmacosx-version-min=${APPLE_MIN_ABI}")
|
||||
# Special compile flags for Objective-C++
|
||||
set(OBJCXX_COMPILE_FLAGS "-x objective-c++ -fobjc-arc -Wno-c++11-extensions")
|
||||
set(OS_WHOLELINK_PRE "-Wl,-all_load")
|
||||
set(OS_WHOLELINK_PRE "-Wl,-force_load")
|
||||
set(OS_WHOLELINK_POST "")
|
||||
else()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
@ -56,9 +56,11 @@ endif()
|
||||
if(APPLE)
|
||||
message("-- Building for OS X")
|
||||
elseif(OSQUERY_BUILD_OS STREQUAL "UBUNTU")
|
||||
set(LINUX TRUE)
|
||||
set(UBUNTU TRUE)
|
||||
message("-- Building for Ubuntu")
|
||||
elseif(OSQUERY_BUILD_OS STREQUAL "CENTOS")
|
||||
set(LINUX TRUE)
|
||||
set(CENTOS TRUE)
|
||||
message("-- Building for CentOS")
|
||||
elseif(FREEBSD)
|
||||
@ -93,7 +95,7 @@ link_directories("/usr/local/lib")
|
||||
|
||||
enable_testing()
|
||||
|
||||
include(CMakeLibs.txt)
|
||||
include(CMakeLibs)
|
||||
add_subdirectory(osquery)
|
||||
add_subdirectory(tools/tests)
|
||||
|
||||
|
@ -147,9 +147,6 @@ add_subdirectory(examples)
|
||||
add_subdirectory(filesystem)
|
||||
add_subdirectory(logger)
|
||||
add_subdirectory(scheduler)
|
||||
|
||||
# Include the tables and build the utilities tables.
|
||||
include(tables/CMakeLibs.txt)
|
||||
add_subdirectory(tables)
|
||||
|
||||
# Utility tables are table specs that are ALWAYS built into osquery core.
|
||||
|
@ -1,99 +0,0 @@
|
||||
# -*- mode: cmake; -*-
|
||||
# - osquery table plugin generation
|
||||
#
|
||||
# Generate table plugin code from .table syntax.
|
||||
# Compile and link the core set of osquery tables/streams.
|
||||
|
||||
set(GLOBAL PROPERTY AMALGAMATE_TARGETS "")
|
||||
macro(GET_GENERATION_DEPS BASE_PATH)
|
||||
# Depend on the generation code.
|
||||
set(GENERATION_DEPENDENCIES "")
|
||||
file(GLOB TABLE_FILES_TEMPLATES "${BASE_PATH}/osquery/tables/templates/*.in")
|
||||
set(GENERATION_DEPENDENCIES
|
||||
"${BASE_PATH}/tools/codegen/*.py"
|
||||
"${BASE_PATH}/osquery/tables/specs/blacklist"
|
||||
)
|
||||
list(APPEND GENERATION_DEPENDENCIES ${TABLE_FILES_TEMPLATES})
|
||||
endmacro()
|
||||
|
||||
# Find and generate table plugins from .table syntax
|
||||
macro(GENERATE_TABLES TABLES_PATH BASE_PATH)
|
||||
# Get all matching files for all platforms.
|
||||
file(GLOB TABLE_FILES "${TABLES_PATH}/specs/x/*.table")
|
||||
set(TABLE_FILES_PLATFORM "")
|
||||
if(APPLE)
|
||||
file(GLOB TABLE_FILES_PLATFORM "${TABLES_PATH}/specs/darwin/*.table")
|
||||
elseif(FREEBSD)
|
||||
file(GLOB TABLE_FILES_PLATFORM "${TABLES_PATH}/specs/freebsd/*.table")
|
||||
else()
|
||||
file(GLOB TABLE_FILES_PLATFORM "${TABLES_PATH}/specs/linux/*.table")
|
||||
endif()
|
||||
list(APPEND TABLE_FILES ${TABLE_FILES_PLATFORM})
|
||||
|
||||
get_property(TARGETS GLOBAL PROPERTY AMALGAMATE_TARGETS)
|
||||
set(NEW_TARGETS "")
|
||||
foreach(TABLE_FILE ${TABLE_FILES})
|
||||
list(FIND TARGETS "${TABLE_FILE}" INDEX)
|
||||
if (${INDEX} EQUAL -1)
|
||||
# Do not set duplicate targets.
|
||||
list(APPEND NEW_TARGETS "${TABLE_FILE}")
|
||||
endif()
|
||||
endforeach()
|
||||
set_property(GLOBAL PROPERTY AMALGAMATE_TARGETS "${NEW_TARGETS}")
|
||||
endmacro()
|
||||
|
||||
macro(GENERATE_UTILITY TABLE_NAME)
|
||||
set(TABLE_SPEC "${CMAKE_SOURCE_DIR}/osquery/tables/specs/x/${TABLE_NAME}.table")
|
||||
set_property(GLOBAL APPEND PROPERTY AMALGAMATE_TARGETS "${TABLE_SPEC}")
|
||||
endmacro()
|
||||
|
||||
macro(GENERATE_TABLE TABLE_FILE NAME BASE_PATH OUTPUT)
|
||||
set(TABLE_FILE_GEN ${TABLE_FILE})
|
||||
string(REPLACE ".table" ".cpp" TABLE_FILE_GEN ${TABLE_FILE_GEN})
|
||||
string(REPLACE "linux/" "" TABLE_FILE_GEN ${TABLE_FILE_GEN})
|
||||
string(REPLACE "darwin/" "" TABLE_FILE_GEN ${TABLE_FILE_GEN})
|
||||
string(REPLACE "freebsd/" "" TABLE_FILE_GEN ${TABLE_FILE_GEN})
|
||||
string(REPLACE "x/" "" TABLE_FILE_GEN ${TABLE_FILE_GEN})
|
||||
string(REGEX REPLACE
|
||||
".*/specs"
|
||||
"${CMAKE_BINARY_DIR}/generated/tables_${NAME}"
|
||||
TABLE_FILE_GEN
|
||||
${TABLE_FILE_GEN}
|
||||
)
|
||||
|
||||
GET_GENERATION_DEPS(${BASE_PATH})
|
||||
add_custom_command(
|
||||
OUTPUT "${TABLE_FILE_GEN}"
|
||||
COMMAND python "${BASE_PATH}/tools/codegen/gentable.py"
|
||||
"${TABLE_FILE}" "${TABLE_FILE_GEN}" "$ENV{DISABLE_BLACKLIST}"
|
||||
DEPENDS ${TABLE_FILE} ${GENERATION_DEPENDENCIES}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
list(APPEND ${OUTPUT} "${TABLE_FILE_GEN}")
|
||||
endmacro()
|
||||
|
||||
macro(AMALGAMATE BASE_PATH NAME OUTPUT)
|
||||
GET_GENERATION_DEPS(${BASE_PATH})
|
||||
get_property(TARGETS GLOBAL PROPERTY AMALGAMATE_TARGETS)
|
||||
|
||||
set(GENERATED_TARGETS "")
|
||||
foreach(TARGET ${TARGETS})
|
||||
GENERATE_TABLE(${TARGET} ${NAME} ${BASE_PATH} GENERATED_TARGETS)
|
||||
endforeach()
|
||||
|
||||
# Include the generated folder in make clean.
|
||||
set_directory_properties(PROPERTY
|
||||
ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/generated")
|
||||
|
||||
# Append all of the code to a single amalgamation.
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_BINARY_DIR}/generated/${NAME}_amalgamation.cpp"
|
||||
COMMAND python "${BASE_PATH}/tools/codegen/amalgamate.py"
|
||||
"${BASE_PATH}/osquery/tables/" "${CMAKE_BINARY_DIR}/generated" "${NAME}"
|
||||
DEPENDS ${GENERATED_TARGETS} ${GENERATION_DEPENDENCIES}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
set(${OUTPUT} "${CMAKE_BINARY_DIR}/generated/${NAME}_amalgamation.cpp")
|
||||
endmacro()
|
@ -65,31 +65,33 @@ else()
|
||||
system/linux/block_devices.cpp
|
||||
)
|
||||
|
||||
# CentOS specific tables
|
||||
ADD_OSQUERY_LIBRARY(osquery_tables_redhat
|
||||
system/linux/rpm_packages.cpp
|
||||
)
|
||||
if(CENTOS)
|
||||
# CentOS specific tables
|
||||
ADD_OSQUERY_LIBRARY(osquery_tables_redhat
|
||||
system/linux/rpm_packages.cpp
|
||||
)
|
||||
|
||||
# Ubuntu specific tables
|
||||
ADD_OSQUERY_LIBRARY(osquery_tables_ubuntu
|
||||
system/linux/deb_packages.cpp
|
||||
)
|
||||
|
||||
# Add version of libproc
|
||||
if(UBUNTU AND PROCPS)
|
||||
ADD_OSQUERY_LINK("libprocps.a")
|
||||
elseif(UBUNTU)
|
||||
ADD_OSQUERY_LINK("libproc.a")
|
||||
elseif(CENTOS)
|
||||
ADD_OSQUERY_LINK("proc")
|
||||
ADD_OSQUERY_LINK("rpm")
|
||||
ADD_OSQUERY_LINK("rpmio")
|
||||
elseif(UBUNTU)
|
||||
# Ubuntu specific tables
|
||||
ADD_OSQUERY_LIBRARY(osquery_tables_ubuntu
|
||||
system/linux/deb_packages.cpp
|
||||
)
|
||||
|
||||
ADD_OSQUERY_LINK("dpkg")
|
||||
|
||||
# Add version of libproc
|
||||
if(PROCPS)
|
||||
ADD_OSQUERY_LINK("libprocps.a")
|
||||
else()
|
||||
ADD_OSQUERY_LINK("libproc.a")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ADD_OSQUERY_LINK("blkid")
|
||||
ADD_OSQUERY_LINK("udev")
|
||||
ADD_OSQUERY_LINK("rpm")
|
||||
ADD_OSQUERY_LINK("rpmio")
|
||||
ADD_OSQUERY_LINK("dpkg")
|
||||
|
||||
endif()
|
||||
|
||||
ADD_OSQUERY_LIBRARY(osquery_tables
|
||||
|
@ -378,7 +378,7 @@ if __name__ == "__main__":
|
||||
|
||||
group = parser.add_argument_group("Memory Options:")
|
||||
group.add_argument(
|
||||
"--suppressions", metavar="SUPP", default=None,
|
||||
"--suppressions", metavar="SUPP", default="./tools/tests/osquery.supp",
|
||||
help="Add a suppressions files to memory leak checking (linux only)."
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
Loading…
Reference in New Issue
Block a user