Skip to content

Commit 5c8401d

Browse files
author
Charity Kathure
committed
boost json parser
Signed-off-by: Charity Kathure <[email protected]>
1 parent fb712c3 commit 5c8401d

22 files changed

+754
-2604
lines changed

.github/workflows/sdl-compliance-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ jobs:
8484
with:
8585
# The path of the directory in which to save the SARIF results (../results/cpp.sarif)
8686
output: ${{ env.CodeQLResultsDir }}
87-
upload: "always" # Options: 'always', 'failure-only', 'never'
87+
upload: "always" # Options: 'always', 'failure-only', 'never'

LogMonitor/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
# Define the project
4+
project(LogMonitor)
5+
6+
# Set C++ standard
7+
set(CMAKE_CXX_STANDARD 17)
8+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
9+
10+
# Use vcpkg if available
11+
if (DEFINED ENV{VCPKG_ROOT})
12+
set(VCPKG_ROOT $ENV{VCPKG_ROOT})
13+
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Toolchain file for vcpkg" FORCE)
14+
endif()
15+
16+
# Enable testing framework
17+
enable_testing()
18+
19+
# Enable Unicode globally
20+
add_definitions(-DUNICODE -D_UNICODE)
21+
22+
# Include subdirectories for main and test executables
23+
add_subdirectory(src) # Add main executable's CMake
24+
add_subdirectory(LogMonitorTests) # Add test executable's CMake
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
3+
project(LogMonitorTests)
4+
5+
find_package(Boost REQUIRED)
6+
7+
set(TEST_SOURCES
8+
JsonProcessorTests.cpp
9+
EtwMonitorTests.cpp
10+
EventMonitorTests.cpp
11+
LogFileMonitorTests.cpp
12+
LogMonitorTests.cpp
13+
UtilityTests.cpp
14+
Utility.cpp
15+
pch.cpp
16+
ConfigFileParserTests.cpp
17+
)
18+
19+
# Ensure all source files exist before proceeding
20+
foreach(FILE ${TEST_SOURCES})
21+
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
22+
message(WARNING "File not found: ${FILE}")
23+
list(REMOVE_ITEM TEST_SOURCES ${FILE})
24+
endif()
25+
endforeach()
26+
27+
if(NOT TEST_SOURCES)
28+
message(FATAL_ERROR "No valid source files found for LogMonitorTests.")
29+
endif()
30+
31+
# Define test shared library (DLL)
32+
add_library(LogMonitorTests SHARED ${TEST_SOURCES})
33+
34+
# Add a definition for symbol exporting
35+
target_compile_definitions(LogMonitorTests PRIVATE LOGMONITORTESTS_EXPORTS)
36+
37+
# Include directories (for headers)
38+
target_include_directories(LogMonitorTests PRIVATE
39+
${CMAKE_CURRENT_SOURCE_DIR} # Includes Utility.h and pch.h
40+
${CMAKE_CURRENT_SOURCE_DIR}/../src
41+
${Boost_INCLUDE_DIRS}
42+
)
43+
44+
# Set Windows-specific linker flags
45+
set_target_properties(LogMonitorTests PROPERTIES
46+
COMPILE_PDB_NAME "LogMonitorTests"
47+
COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
48+
LINK_FLAGS "/DEBUG:FULL /OPT:REF /OPT:ICF"
49+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
50+
)
51+
52+
# Link with LogMonitor and Boost
53+
target_link_libraries(LogMonitorTests PRIVATE LogMonitor ${Boost_LIBRARIES})
54+
55+
# Enable testing
56+
enable_testing()
57+
58+
add_test(NAME LogMonitorTests COMMAND LogMonitorTests)

0 commit comments

Comments
 (0)