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
10 changes: 10 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,16 @@ jobs:
uses: ./.github/actions/install-iceoryx-deps-and-clang
- run: ./tools/ci/build-test-ubuntu.sh 32-bit-x86

build-test-windows-32-bit:
# prevent stuck jobs consuming runners for 6 hours
timeout-minutes: 60
runs-on: windows-latest
needs: pre-flight-check
steps:
- uses: actions/checkout@v4
- run: ./tools/ci/build-test-windows.ps1 -toolchain MSVC -architecture 32-bit
shell: powershell

build-test-ubuntu-32-64-bit-mix-mode:
# prevent stuck jobs consuming runners for 6 hours
timeout-minutes: 60
Expand Down
20 changes: 20 additions & 0 deletions cmake/googletest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ if(BUILD_TEST AND NOT GTest_DIR)
list(APPEND EXTRA_CMAKE_ARGS -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS})
endif()

if(DEFINED CMAKE_CXX_FLAGS_INIT)
list(APPEND EXTRA_CMAKE_ARGS -DCMAKE_CXX_FLAGS_INIT=${CMAKE_CXX_FLAGS_INIT})
endif()

if(DEFINED CMAKE_CXX_COMPILER)
list(APPEND EXTRA_CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
endif()

if(DEFINED CMAKE_CXX_COMPILER_TARGET)
list(APPEND EXTRA_CMAKE_ARGS -DCMAKE_CXX_COMPILER_TARGET=${CMAKE_CXX_COMPILER_TARGET})
endif()

if(DEFINED CMAKE_GENERATOR_PLATFORM)
list(APPEND EXTRA_CMAKE_ARGS -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM})
endif()

if(DEFINED CMAKE_LINKER)
list(APPEND EXTRA_CMAKE_ARGS -DCMAKE_LINKER=${CMAKE_LINKER})
endif()

set(GTEST_BUILD_ARGS "-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}" "${EXTRA_CMAKE_ARGS}")
set(GTEST_DOWNLOAD_ARGS "${DOWNLOAD_CONFIG_DIR}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ The `-m32` flag tells GCC to build iceoryx as 32-bit library on a 64-bit system.
The `-malign-double` flag is required to have 64-bit atomics on an 8 byte boundary.
Furthermore, it is required for the 32-64 bit mix-mode to enforce the same data layout when 32-bit application communicate with 64-bit applications.

> [!NOTE]
> On Windows with MSVC, the `-DCMAKE_GENERATOR_PLATFORM=Win32` cmake flag must be set instead of the `-DCMAKE_C_FLAGS` and `-DCMAKE_CXX_FLAGS`.

## Limitations

An internal data structure, the `UsedChunkList`, might be left in a corrupt state when an application terminates abnormally when writing to this data structure.
Expand Down Expand Up @@ -81,6 +84,9 @@ cmake -S iceoryx_meta -B build-64 -DCMAKE_BUILD_TYPE=Release -DEXAMPLES=ON -DIOX
cmake --build build-64
```

> [!NOTE]
> On Windows with MSVC, there is now counterpart for `-malign-double` and therefore the 32-64 bit mix-mode does not yet work on Windows.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no counterpart

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not as flag but it seems we are lucky and MSVC puts at least atomics on 8 byte boundaries


## Running the examples

You can now mix and match 32-bit and 64-bit applications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ void cyclicRun(iox_user_trigger_t trigger)
fflush(stdout);
}

#if defined(_WIN32)
DWORD WINAPI cyclicTriggerCallback(LPVOID dontCare)
#else
void* cyclicTriggerCallback(void* dontCare)
#endif
{
// Ignore unused variable warning
(void)dontCare;
Expand All @@ -78,13 +82,13 @@ void* cyclicTriggerCallback(void* dontCare)
return NULL;
}

bool createThread(pthread_t* threadHandle, void* (*callback)(void*))
bool createThread(pthread_t* threadHandle)
{
#if defined(_WIN32)
threadHandle = CreateThread(NULL, 8192, callback, NULL, 0, NULL);
threadHandle = CreateThread(NULL, 8192, cyclicTriggerCallback, NULL, 0, NULL);
return threadHandle != NULL;
#else
return pthread_create(threadHandle, NULL, callback, NULL) == 0;
return pthread_create(threadHandle, NULL, cyclicTriggerCallback, NULL) == 0;
#endif
}

Expand Down Expand Up @@ -121,7 +125,7 @@ int main(void)
// start a thread which triggers cyclicTrigger every second
//! [cyclic trigger thread]
pthread_t cyclicTriggerThread;
if (!createThread(&cyclicTriggerThread, cyclicTriggerCallback))
if (!createThread(&cyclicTriggerThread))
{
printf("failed to create thread\n");
return -1;
Expand Down
1 change: 1 addition & 0 deletions iceoryx_meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ message(" c compiler................: " ${CMAKE_C_COMPILER})
message(" c++ compiler..............: " ${CMAKE_CXX_COMPILER})
message(" c flags...................: " ${CMAKE_C_FLAGS})
message(" c++ flags.................: " ${CMAKE_CXX_FLAGS})
message(" generator platform........: " ${CMAKE_GENERATOR_PLATFORM})
message(" cmake.....................: " ${CMAKE_VERSION})
message(" Additional flags from iceoryx platform")
message(" c++ standard..............: " ${ICEORYX_CXX_STANDARD})
Expand Down
3 changes: 0 additions & 3 deletions iceoryx_platform/win/source/pthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include <sstream>
#include <vector>

HRESULT GetThreadDescription(HANDLE hThread, PWSTR* ppszThreadDescription);
HRESULT SetThreadDescription(HANDLE hThread, PCWSTR lpThreadDescription);

int iox_pthread_setname_np(iox_pthread_t thread [[maybe_unused]], const char* name [[maybe_unused]])
{
#if defined(__GNUC__) || defined(__GNUG__)
Expand Down
1 change: 1 addition & 0 deletions iceoryx_posh/cmake/cpptoml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ set(CMAKE_ADDITIONAL_OPTIONS
"-DCMAKE_C_COMPILER_TARGET=${CMAKE_C_COMPILER_TARGET}"
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
"-DCMAKE_CXX_COMPILER_TARGET=${CMAKE_CXX_COMPILER_TARGET}"
"-DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}"
"-DCMAKE_LINKER=${CMAKE_LINKER}")

if(DEFINED CMAKE_TOOLCHAIN_FILE)
Expand Down
28 changes: 25 additions & 3 deletions tools/ci/build-test-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,44 @@

param(
[Parameter()]
[String]$toolchain = "MSVC"
[String]$toolchain = "MSVC",

[Parameter()]
[String]$architecture = "64-bit"
)

$ErrorActionPreference = "Stop"
$NumCPUs = (Get-WmiObject Win32_processor).NumberOfLogicalProcessors

$ARCHITECTURE_FLAG_MSVC = ""
$C_FLGAS_MINGW = ""
$CXX_FLAGS_MINGW = ""

switch ($architecture) {
"64-bit" {
# nothing to do
}
"32-bit" {
$ARCHITECTURE_FLAG_MSVC = "-DCMAKE_GENERATOR_PLATFORM=Win32"
$C_FLAGS_MINGW = '-DCMAKE_C_FLAGS="-m32"'
$CXX_FLAGS_MINGW = '-DCMAKE_CXX_FLAGS="-m32"'
}
default {
if ($?) { Write-Host "## The '$architecture' architecture is not supported. Currently only '64-bit' and '32-bit' is supported to build iceoryx." }
exit 1
}
}

switch ($toolchain) {
"MSVC" {
if ($?) { Write-Host "## Building sources with MSVC toolchain" }
# We require the Windows SDK Version 10.0.18362.0 since a previous version had a bug which caused a fatal compilation error within iceoryx and was
# fixed with this version, see: https://github.com/microsoft/vcpkg/issues/15035#issuecomment-742427969.
if ($?) { cmake -Bbuild -Hiceoryx_meta -DBUILD_TEST=ON -DINTROSPECTION=OFF -DBINDING_C=ON -DEXAMPLES=ON -DCMAKE_CXX_FLAGS="/MP" -DCMAKE_SYSTEM_VERSION="10.0.18362.0" }
if ($?) { cmake -Bbuild -Hiceoryx_meta -DBUILD_TEST=ON -DINTROSPECTION=OFF -DBINDING_C=ON -DEXAMPLES=ON -DCMAKE_CXX_FLAGS="/MP" -DCMAKE_SYSTEM_VERSION="10.0.18362.0" $ARCHITECTURE_FLAG_MSVC }
}
"MinGW" {
if ($?) { Write-Host "## Building sources with MinGW toolchain" }
if ($?) { cmake -Bbuild -Hiceoryx_meta -DBUILD_TEST=ON -DINTROSPECTION=OFF -DBINDING_C=ON -DEXAMPLES=ON -DCMAKE_SYSTEM_VERSION="10.0.18362.0" -G "MinGW Makefiles" }
if ($?) { cmake -Bbuild -Hiceoryx_meta -DBUILD_TEST=ON -DINTROSPECTION=OFF -DBINDING_C=ON -DEXAMPLES=ON -DCMAKE_SYSTEM_VERSION="10.0.18362.0" -G "MinGW Makefiles" $C_FLAGS_MINGW $CXX_FLAGS_MINGW }
}
default {
if ($?) { Write-Host "## The '$toolchain' toolchain is not supported. Currently only 'MSVC' and 'MingGW' is supported to build iceoryx." }
Expand Down
Loading