Index: lib/Fuzzer/Support/CMakeLists.txt =================================================================== --- lib/Fuzzer/Support/CMakeLists.txt +++ lib/Fuzzer/Support/CMakeLists.txt @@ -1,10 +1,27 @@ -add_library(LLVMFuzzerSupport STATIC +set(FUZZER_SUPPORT_SOURCES Util.cpp - UtilDarwin.cpp - UtilLinux.cpp - UtilPosix.cpp - UtilWindows.cpp UtilIO.cpp - UtilIOPosix.cpp - UtilIOWindows.cpp ) + +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") + list(APPEND FUZZER_SUPPORT_SOURCES + UtilWindows.cpp + UtilIOWindows.cpp + ) +else() + list(APPEND FUZZER_SUPPORT_SOURCES + UtilPosix.cpp + UtilIOPosix.cpp + ) + if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + list(APPEND FUZZER_SUPPORT_SOURCES + UtilLinux.cpp + ) + elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + list(APPEND FUZZER_SUPPORT_SOURCES + UtilDarwin.cpp + ) + endif() +endif() + +add_library(LLVMFuzzerSupport STATIC ${FUZZER_SUPPORT_SOURCES}) Index: lib/Fuzzer/Support/UtilDarwin.cpp =================================================================== --- lib/Fuzzer/Support/UtilDarwin.cpp +++ lib/Fuzzer/Support/UtilDarwin.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // Misc utils for Darwin. //===----------------------------------------------------------------------===// -#include "Platform.h" -#if LIBFUZZER_APPLE #include "UtilIO.h" #include @@ -148,5 +146,3 @@ } } // namespace fuzzer - -#endif // LIBFUZZER_APPLE Index: lib/Fuzzer/Support/UtilIOPosix.cpp =================================================================== --- lib/Fuzzer/Support/UtilIOPosix.cpp +++ lib/Fuzzer/Support/UtilIOPosix.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // IO functions implementation using Posix API. //===----------------------------------------------------------------------===// -#include "Platform.h" -#if LIBFUZZER_POSIX #include "UtilIO.h" #include @@ -83,5 +81,3 @@ } } // namespace fuzzer - -#endif // LIBFUZZER_POSIX Index: lib/Fuzzer/Support/UtilIOWindows.cpp =================================================================== --- lib/Fuzzer/Support/UtilIOWindows.cpp +++ lib/Fuzzer/Support/UtilIOWindows.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // IO functions implementation for Windows. //===----------------------------------------------------------------------===// -#include "Platform.h" -#if LIBFUZZER_WINDOWS #include "UtilIO.h" #include @@ -278,5 +276,3 @@ } } // namespace fuzzer - -#endif // LIBFUZZER_WINDOWS Index: lib/Fuzzer/Support/UtilLinux.cpp =================================================================== --- lib/Fuzzer/Support/UtilLinux.cpp +++ lib/Fuzzer/Support/UtilLinux.cpp @@ -8,8 +8,6 @@ //===----------------------------------------------------------------------===// // Misc utils for Linux. //===----------------------------------------------------------------------===// -#include "Platform.h" -#if LIBFUZZER_LINUX #include @@ -20,5 +18,3 @@ } } // namespace fuzzer - -#endif // LIBFUZZER_LINUX Index: lib/Fuzzer/Support/UtilPosix.cpp =================================================================== --- lib/Fuzzer/Support/UtilPosix.cpp +++ lib/Fuzzer/Support/UtilPosix.cpp @@ -8,8 +8,7 @@ //===----------------------------------------------------------------------===// // Misc utils implementation using Posix API. //===----------------------------------------------------------------------===// -#include "Platform.h" -#if LIBFUZZER_POSIX + #include "UtilIO.h" #include #include @@ -104,5 +103,3 @@ } } // namespace fuzzer - -#endif // LIBFUZZER_POSIX Index: lib/Fuzzer/Support/UtilWindows.cpp =================================================================== --- lib/Fuzzer/Support/UtilWindows.cpp +++ lib/Fuzzer/Support/UtilWindows.cpp @@ -8,8 +8,7 @@ //===----------------------------------------------------------------------===// // Misc utils implementation for Windows. //===----------------------------------------------------------------------===// -#include "Platform.h" -#if LIBFUZZER_WINDOWS + #include "Util.h" #include "UtilIO.h" #include @@ -185,5 +184,3 @@ } } // namespace fuzzer - -#endif // LIBFUZZER_WINDOWS