Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
Smjert committed Dec 24, 2023
1 parent f53e4ea commit 721a358
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 34 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/codeql_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,6 @@ jobs:
run: |
git submodule sync --recursive
# NOTE: We will only use an already existing cache, and will not save it later,
# just to prevent trashing of cache. Also the cache is only partially updated,
# since we only build third party libraries with the cache on.
- name: Update the cache (sccache)
uses: actions/cache/restore@v3
with:
path: ${{ steps.build_paths.outputs.SCCACHE }}

key: |
sccache_${{ matrix.os }}_64_Release_${{ steps.determine_compiler_version.outputs.COMPILER_VERSION }}_${{ github.sha }}
restore-keys: |
sccache_${{ matrix.os }}_64_Release_${{ steps.determine_compiler_version.outputs.COMPILER_VERSION }}
- name: Initialize the Python 3 installation
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -283,8 +269,6 @@ jobs:
echo "${{ steps.build_paths.outputs.INSTALL }}\sccache" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
ls -l ${{ steps.build_paths.outputs.SCCACHE }}
- name: Prepare sccache wrapper
working-directory: ${{ steps.build_paths.outputs.SOURCE }}
shell: cmd
Expand Down Expand Up @@ -323,8 +307,8 @@ jobs:
-DCMAKE_CXX_COMPILER=cl.exe ^
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ^
-DOSQUERY_BUILD_TESTS=OFF ^
-DCMAKE_C_COMPILER_LAUNCHER="${{ steps.build_paths.outputs.INSTALL }}\sccache\sccache_wrapper.exe" ^
-DCMAKE_CXX_COMPILER_LAUNCHER="${{ steps.build_paths.outputs.INSTALL }}\sccache\sccache_wrapper.exe" ^
-DCMAKE_C_COMPILER_LAUNCHER="${{ steps.build_paths.outputs.INSTALL }}\sccache\sccache.exe" ^
-DCMAKE_CXX_COMPILER_LAUNCHER="${{ steps.build_paths.outputs.INSTALL }}\sccache\sccache.exe" ^
-DPython3_ROOT_DIR=${{ steps.python_root_directory.outputs.VALUE }} ^
${{ steps.build_paths.outputs.SOURCE }}
Expand Down Expand Up @@ -365,6 +349,20 @@ jobs:
echo "COMPILER_VERSION=$version" >> $env:GITHUB_OUTPUT
# NOTE: We will only use an already existing cache, and will not save it later,
# just to prevent trashing of cache. Also the cache is only partially updated,
# since we only build third party libraries with the cache on.
- name: Update the cache (sccache)
uses: actions/cache/restore@v3
with:
path: ${{ steps.build_paths.outputs.SCCACHE }}

key: |
sccache_${{ matrix.os }}_64_Release_${{ steps.determine_compiler_version.outputs.COMPILER_VERSION }}_${{ github.sha }}
restore-keys: |
sccache_${{ matrix.os }}_64_Release_${{ steps.determine_compiler_version.outputs.COMPILER_VERSION }}
- name: Build third party libraries
shell: cmd
working-directory: ${{ steps.build_paths.outputs.BINARY }}
Expand Down Expand Up @@ -397,10 +395,15 @@ jobs:
working-directory: ${{ steps.build_paths.outputs.BINARY }}
shell: cmd

env:
SCCACHE_DIR: ${{ steps.build_paths.outputs.SCCACHE }}
SCCACHE_CACHE_SIZE: "5G"

run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
@echo on
rmdir "${{ steps.build_paths.outputs.SCCACHE }}" /S /Q
type nul > "${{ steps.build_paths.outputs.INSTALL }}\sccache\disable_sccache"
cmake --build . -j 3 --target osqueryd
Expand Down
21 changes: 9 additions & 12 deletions cmake/flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
if(DEFINED PLATFORM_POSIX)
include(CheckPIESupported)
check_pie_supported()

if(NOT CMAKE_C_LINK_PIE_SUPPORTED OR NOT CMAKE_CXX_LINK_PIE_SUPPORTED)
message(FATAL_ERROR "The linker for the current compiler does not support -fPIE or -pie")
message(FATAL_ERROR "The linker for the current compiler does not support -fPIE or -pie")
endif()

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down Expand Up @@ -35,7 +36,6 @@ function(setupBuildFlags)
endif()

if(DEFINED PLATFORM_POSIX)

set(posix_common_compile_options
-Qunused-arguments
-Wno-shadow-field
Expand Down Expand Up @@ -161,8 +161,8 @@ function(setupBuildFlags)
set(osquery_linux_common_defines
LINUX=1
OSQUERY_LINUX=1
OSQUERY_BUILD_DISTRO="centos7"
OSQUERY_BUILD_PLATFORM="linux"
OSQUERY_BUILD_DISTRO=centos7
OSQUERY_BUILD_PLATFORM=linux
)

set(osquery_linux_common_link_options
Expand Down Expand Up @@ -259,8 +259,8 @@ function(setupBuildFlags)
DARWIN=1
BSD=1
OSQUERY_DARWIN=1
OSQUERY_BUILD_PLATFORM="darwin"
OSQUERY_BUILD_DISTRO="10.14"
OSQUERY_BUILD_PLATFORM=darwin
OSQUERY_BUILD_DISTRO=10.14
)

target_compile_options(cxx_settings INTERFACE
Expand All @@ -280,12 +280,11 @@ function(setupBuildFlags)

if(OSQUERY_NO_DEBUG_SYMBOLS AND
("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"))
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo"))
target_compile_options(cxx_settings INTERFACE -g0)
target_compile_options(c_settings INTERFACE -g0)
endif()
elseif(DEFINED PLATFORM_WINDOWS)

set(windows_common_compile_options
"$<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:/Gs;/GS>"
"$<$<CONFIG:Debug>:/Od;/UNDEBUG>$<$<NOT:$<CONFIG:Debug>>:/Ot>"
Expand Down Expand Up @@ -344,8 +343,8 @@ function(setupBuildFlags)
WINDOWS=1
WIN32_LEAN_AND_MEAN
OSQUERY_WINDOWS=1
OSQUERY_BUILD_PLATFORM="windows"
OSQUERY_BUILD_DISTRO="10"
OSQUERY_BUILD_PLATFORM=windows
OSQUERY_BUILD_DISTRO=10
BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE=1
UNICODE
_UNICODE
Expand Down Expand Up @@ -444,7 +443,6 @@ function(setupBuildFlags)
${osquery_defines}
)


add_library(osquery_c_settings INTERFACE)
target_link_libraries(osquery_c_settings INTERFACE
c_settings
Expand All @@ -457,7 +455,6 @@ function(setupBuildFlags)
target_compile_definitions(osquery_c_settings INTERFACE
${osquery_defines}
)

endfunction()

setupBuildFlags()
4 changes: 2 additions & 2 deletions osquery/tables/utility/osquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ QueryData genOsqueryInfo(QueryContext& context) {
r["config_valid"] = Config::get().isValid() ? INTEGER(1) : INTEGER(0);
r["extensions"] =
(pingExtension(FLAGS_extensions_socket).ok()) ? "active" : "inactive";
r["build_platform"] = OSQUERY_BUILD_PLATFORM;
r["build_distro"] = OSQUERY_BUILD_DISTRO;
r["build_platform"] = STR(OSQUERY_BUILD_PLATFORM);
r["build_distro"] = STR(OSQUERY_BUILD_DISTRO);
r["start_time"] = INTEGER(getStartTime());
if (Initializer::isWorker()) {
r["watcher"] = INTEGER(PlatformProcess::getLauncherProcess()->pid());
Expand Down
5 changes: 3 additions & 2 deletions osquery/utils/info/platform_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ enum class PlatformType {
};

/// The build-defined set of platform types.
constexpr PlatformType kPlatformType = static_cast<PlatformType>(0u
constexpr PlatformType kPlatformType = static_cast<PlatformType>(
0u
#ifdef POSIX
| static_cast<unsigned>(PlatformType::TYPE_POSIX)
#endif
Expand Down Expand Up @@ -82,7 +83,7 @@ PlatformType operator|(PlatformType a, PlatformType b);
#error The build must define OSQUERY_BUILD_DISTRO.
#endif

#define OSQUERY_PLATFORM OSQUERY_BUILD_PLATFORM
#define OSQUERY_PLATFORM STR(OSQUERY_BUILD_PLATFORM)

/// Identifies the build platform of either the core extension.
extern const std::string kSDKPlatform;
Expand Down

0 comments on commit 721a358

Please sign in to comment.