diff --git a/AK/Time.cpp b/AK/Time.cpp index 923f6404da6..d10340e5978 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 00000000000..bc5076b2a61 --- /dev/null +++ b/AK/Windows.h @@ -0,0 +1,21 @@ +/* + * 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 non-#include 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 +# undef IN +# pragma comment(lib, "ws2_32.lib") +# include +#endif diff --git a/Libraries/LibCore/CMakeLists.txt b/Libraries/LibCore/CMakeLists.txt index c54c02166c3..c4b90d12b67 100644 --- a/Libraries/LibCore/CMakeLists.txt +++ b/Libraries/LibCore/CMakeLists.txt @@ -110,7 +110,3 @@ endif() if (ANDROID) target_link_libraries(LibCore PRIVATE log) endif() - -if (WIN32) - target_link_libraries(LibCore PRIVATE ws2_32.lib) -endif() diff --git a/Libraries/LibCore/EventLoopImplementationWindows.cpp b/Libraries/LibCore/EventLoopImplementationWindows.cpp index d233347533a..15d162a2163 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;