Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
os:
- ubuntu-latest
- windows-latest
- macos-latest
crypto:
- mbedtls
- openssl
Expand Down Expand Up @@ -59,6 +60,16 @@ jobs:
toolchain: VS2019
- os: ubuntu-latest
arch: ia32
- os: macos-latest
arch: ia32
- os: macos-latest
toolchain: GCC
- os: macos-latest
toolchain: VS2019
- os: macos-latest
toolchain: ARM_GNU
- os: macos-latest
toolchain: LIBFUZZER
- os: windows-latest
toolchain: GCC
arch: ia32
Expand Down Expand Up @@ -113,7 +124,7 @@ jobs:
with:
arch: x86
- name: Toolchain Setup - Clang
if: matrix.toolchain == 'CLANG' || matrix.toolchain == 'LIBFUZZER' && matrix.os == 'ubuntu-latest'
if: (matrix.toolchain == 'CLANG' || matrix.toolchain == 'LIBFUZZER') && matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install llvm
Expand Down Expand Up @@ -151,6 +162,16 @@ jobs:
make copy_sample_key
make copy_seed
make -j`nproc`
- name: Build - Darwin
if: matrix.os == 'macos-latest'
run: |
mkdir -p build
cd build
cmake --version
cmake -E env CFLAGS="${{ matrix.configurations }} -DLIBSPDM_DEBUG_LIBSPDM_ASSERT_CONFIG=3" cmake -DARCH=${{ matrix.arch }} -DTOOLCHAIN=${{ matrix.toolchain }} -DTARGET=${{ matrix.target }} -DCRYPTO=${{ matrix.crypto }} ..
make copy_sample_key
make copy_seed
make # process killed with multicore
- name: Build - Windows
if: matrix.os == 'windows-latest' && matrix.toolchain != 'GCC'
run: |
Expand Down Expand Up @@ -179,6 +200,16 @@ jobs:
cmake -DARCH=x64 -DTOOLCHAIN=GCC -DTARGET=Debug -DCRYPTO=${{matrix.crypto}} -DGCOV=ON ..
make copy_sample_key
make -j`nproc`
- name: Build - Darwin - GCONV=ON
if: matrix.os == 'macos-latest'
run: |
mkdir -p build
cd build
cmake --version
cmake -DARCH=x64 -DTOOLCHAIN=CLANG -DTARGET=Debug -DCRYPTO=${{matrix.crypto}} -DGCOV=ON ..
make copy_sample_key
make copy_seed
make # process killed with multicore
- name: Test Requester
if: matrix.toolchain != 'LIBFUZZER' && matrix.toolchain != 'ARM_GNU' && matrix.configurations != '-DDISABLE_TESTS=1'
run: |
Expand Down
22 changes: 20 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(STACK_USAGE STREQUAL "ON")
message("STACK_USAGE = ON")
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
if (TOOLCHAIN STREQUAL "CLANG")
message("TOOLCHAIN = CLANG")
else()
message(FATAL_ERROR "Unknown TOOLCHAIN")
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
if(TOOLCHAIN STREQUAL "GCC")
message("TOOLCHAIN = GCC")
Expand Down Expand Up @@ -680,7 +686,19 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_compile_options(-m32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32" )
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
if (TOOLCHAIN STREQUAL "CLANG")
set(CMAKE_C_COMPILER clang)
add_compile_options(-g -Og -fshort-wchar -fno-strict-aliasing -Wall -Wno-array-bounds -ffunction-sections -fdata-sections -fno-common -Wno-address -fpie -fno-asynchronous-unwind-tables)

set(MBEDTLS_FLAGS "")
set(OPENSSL_FLAGS -include base.h -Wno-error=maybe-uninitialized -Wno-error=format -Wno-format -Wno-error=unused-but-set-variable)
set(CMOCKA_FLAGS -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong)

set(CMAKE_LINKER clang)
set(CMAKE_EXE_LINKER_FLAGS "-Wno-error")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
if(TOOLCHAIN STREQUAL "GCC")
set(CMAKE_C_COMPILER gcc)
Expand Down Expand Up @@ -879,7 +897,7 @@ set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
add_custom_target(copy_sample_key)

execute_process(COMMAND uname OUTPUT_VARIABLE uname)
if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR uname MATCHES "^MINGW")
if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR uname MATCHES "^MINGW" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_custom_command(TARGET copy_sample_key
PRE_BUILD
COMMAND cp -r -f ${LIBSPDM_DIR}/unit_test/sample_key/* ${EXECUTABLE_OUTPUT_PATH})
Expand All @@ -901,7 +919,7 @@ endif()

add_custom_target(copy_seed)

if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR uname MATCHES "^MINGW")
if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR uname MATCHES "^MINGW" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_custom_command(TARGET copy_seed
PRE_BUILD
COMMAND cp -r -f ${LIBSPDM_DIR}/unit_test/fuzzing/seeds ${EXECUTABLE_OUTPUT_PATH}
Expand Down
10 changes: 8 additions & 2 deletions os_stub/platform_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ target_include_directories(platform_lib
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND (NOT TOOLCHAIN STREQUAL "ARM_DS2022") AND (NOT TOOLCHAIN STREQUAL "RISCV_XPACK") AND (NOT TOOLCHAIN STREQUAL "ARM_GNU_BARE_METAL"))
target_sources(platform_lib
PRIVATE
time_linux.c
time_unix.c
watchdog.c
)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
Expand All @@ -20,10 +20,16 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
time_win.c
watchdog.c
)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
target_sources(platform_lib
PRIVATE
time_unix.c
watchdog.c
)
else()
target_sources(platform_lib
PRIVATE
time_sample.c
watchdog.c
)
endif()
endif()
File renamed without changes.
9 changes: 7 additions & 2 deletions os_stub/platform_lib_null/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ target_include_directories(platform_lib_null
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
target_sources(platform_lib_null
PRIVATE
time_linux.c
time_unix.c
watchdog.c
)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
Expand All @@ -20,6 +20,11 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
time_win.c
watchdog.c
)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
target_sources(platform_lib_null
PRIVATE
time_unix.c
watchdog.c
)

endif()