Skip to content

add MXE cross-compilation support with pthread and gettimeofda…#389

Closed
hank5000 wants to merge 1 commit into
AprilRobotics:masterfrom
hank5000:feature/support-mxe
Closed

add MXE cross-compilation support with pthread and gettimeofda…#389
hank5000 wants to merge 1 commit into
AprilRobotics:masterfrom
hank5000:feature/support-mxe

Conversation

@hank5000

Copy link
Copy Markdown
  • Added CheckIncludeFile to detect presence of pthread.h and sys/time.h
  • Ensures the project can be cross-compiled using MXE

@christian-rauch christian-rauch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you provide more context what MXE is and why these changes are required? Is it possible to add this to the CI pipeline in order to check that this "MXE support" does not break in future?

Comment thread CMakeLists.txt
Comment on lines +13 to +17
check_include_file(pthread.h HAVE_PTHREAD)
if(HAVE_PTHREAD)
add_definitions(-DHAVE_PTHREAD)
message(STATUS "pthread.h found, using POSIX thread support")
endif()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you not use FindThreads and evaluate Threads_FOUND here?

Comment thread common/time_util.h
typedef long long suseconds_t;
#endif


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not required.

Comment thread common/time_util.h
Comment on lines 34 to 42

#ifdef _WIN32
#if defined(_WIN32)
#if !defined(HAVE_SYS_TIME_H)
#include <Winsock2.h>
#endif

#include <windows.h>
#define sleep(x) Sleep((x)*1000)
typedef long long suseconds_t;
#endif

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this related to pthread? Maybe place this in a separate commit if it is an unrelated change.

@christian-rauch

Copy link
Copy Markdown
Collaborator

@hank5000 Is this PR still relevant? Can you have a look at this and address the comments, or close the PR if you don't need this any more?

@hank5000 hank5000 closed this Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants