diff --git a/AK/Time.cpp b/AK/Time.cpp index 923f6404da6a2..d10340e5978ae 100644 --- a/AK/Time.cpp +++ b/AK/Time.cpp @@ -8,9 +8,7 @@ #include #ifdef AK_OS_WINDOWS -# define timeval dummy_timeval -# include -# undef timeval +# include #endif namespace AK { diff --git a/AK/Windows.h b/AK/Windows.h new file mode 100644 index 0000000000000..e9179ed31f6f0 --- /dev/null +++ b/AK/Windows.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2024, stasoid + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +// This header should be included only in cpp files. +// It should be included after all other files and should be separated from them by a blank or comment line to prevent clang-format from changing header order. + +#pragma once + +#include + +#ifdef AK_OS_WINDOWS // needed for Swift +# define timeval dummy_timeval +# include +# undef timeval +# pragma comment(lib, "ws2_32.lib") +# include +#endif diff --git a/Libraries/LibCore/CMakeLists.txt b/Libraries/LibCore/CMakeLists.txt index 6b9427d3d0f63..76fb51cd80f42 100644 --- a/Libraries/LibCore/CMakeLists.txt +++ b/Libraries/LibCore/CMakeLists.txt @@ -121,6 +121,4 @@ if (WIN32) find_package(pthread REQUIRED) target_include_directories(LibCore PRIVATE ${PTHREAD_INCLUDE_DIR}) target_link_libraries(LibCore PRIVATE ${PTHREAD_LIBRARY}) - - target_link_libraries(LibCore PRIVATE ws2_32.lib) endif() diff --git a/Libraries/LibCore/EventLoopImplementationWindows.cpp b/Libraries/LibCore/EventLoopImplementationWindows.cpp index 5794be324079e..6ab3be4690a02 100644 --- a/Libraries/LibCore/EventLoopImplementationWindows.cpp +++ b/Libraries/LibCore/EventLoopImplementationWindows.cpp @@ -8,8 +8,8 @@ #include #include #include -#include -#include + +#include struct Handle { HANDLE handle = NULL;