Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Taken from osql-experimental.

Initial support for Linux and macOS.
  • Loading branch information
alessandrogario authored and Smjert committed Jun 27, 2019
1 parent a2b8d40 commit 33fbbec
Show file tree
Hide file tree
Showing 109 changed files with 6,947 additions and 0 deletions.
41 changes: 41 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2018-present, Trail of Bits, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.13.1)
project(osquery)

include(cmake/globals.cmake)
include(cmake/utilities.cmake)
include(cmake/options.cmake)

function(main)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Shared libraries: ${BUILD_SHARED_LIBS}")

if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR
NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
message(STATUS "Warning: the selected C or C++ compiler is not clang/clang++. Compilation may fail")
endif()

generateGlobalSettingsTargets()

add_subdirectory("third-party")
add_subdirectory("osquery")
add_subdirectory("tools")
add_subdirectory("specs")

processLinkWholeArchiveSettings()
endfunction()

main()
50 changes: 50 additions & 0 deletions cmake/globals.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Copyright (c) 2018-present, Trail of Bits, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.13.1)

# Set the build type
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()

# Always generate the compile_commands.json file
set(CMAKE_EXPORT_COMPILE_COMMANDS true)

# Show verbose compilation messages when building Debug binaries
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CMAKE_VERBOSE_MAKEFILE true)
endif()

# This is the destination for the remotely imported Python modules, used when
# setting up the PYTHONPATH folder
set(PYTHON_PATH "${CMAKE_BINARY_DIR}/python_path")

# TODO(alessandro): Add missing defines: PLATFORM_WINDOWS, PLATFORM_FREEBSD
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(PLATFORM_POSIX 1)
set(PLATFORM_LINUX 1)

elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(PLATFORM_POSIX 1)
set(PLATFORM_MACOS 1)

else()
message(FATAL_ERROR "Unrecognized platform")
endif()

# osquery versions
set(OSQUERY_VERSION 3.3.0)
set(OSQUERY_BUILD_VERSION 3.3.0)
set(OSQUERY_BUILD_SDK_VERSION 3.3.0)
32 changes: 32 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2018-present, Trail of Bits, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.13.1)

# Always generate the compile_commands.json file
set(CMAKE_EXPORT_COMPILE_COMMANDS true)

# Show verbose compilation messages when building Debug binaries
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CMAKE_VERBOSE_MAKEFILE true)
endif()

# This may be useful to speed up development builds
option(BUILD_SHARED_LIBS "Whether to build shared libraries (like *.dll or *.so) or static ones (like *.a)" ${BUILD_SHARED_LIBS_DEFAULT_VALUE})

# This is the default S3 storage used by Facebook to store 3rd party dependencies; it
# is provided here as a configuration option
if("${THIRD_PARTY_REPOSITORY_URL}" STREQUAL "")
set(THIRD_PARTY_REPOSITORY_URL "https://s3.amazonaws.com/osquery-packages")
endif()
Loading

0 comments on commit 33fbbec

Please sign in to comment.