aras-p / ClangBuildAnalyzer

Clang build analysis tool using -ftime-trace
The Unlicense
1.02k stars 65 forks source link

MinGW support #49

Open Trass3r opened 4 years ago

Trass3r commented 4 years ago

I changed this to build with MinGW:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 71f708f..56223a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,4 +22,4 @@ set(SRC
 )
 add_executable(ClangBuildAnalyzer "${SRC}")
 target_compile_features(ClangBuildAnalyzer PRIVATE cxx_std_17)
-target_link_libraries(ClangBuildAnalyzer -lrt -lpthread)
+target_link_libraries(ClangBuildAnalyzer -lpthread)
diff --git a/src/main.cpp b/src/main.cpp
index 3ef1fc1..68e46d6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -96,7 +96,7 @@ static int RunStart(int argc, const char* argv[])
     return 0;
 }

-#ifdef _MSC_VER
+#ifdef _WIN32
 static time_t FiletimeToTime(const FILETIME& ft)
 {
     ULARGE_INTEGER ull;
@@ -128,7 +128,7 @@ struct JsonFileFinder
         if (!cf_get_file_time(f->path, &mtime))
             return;
         time_t fileModTime;
-#ifdef _MSC_VER
+#ifdef _WIN32
         fileModTime = FiletimeToTime(mtime.time);
 #else
         fileModTime = mtime.time;
aras-p commented 4 years ago

-lrt was added to the makefile to make it work on some Linux distribution, so I'd rather not remove that...

Trass3r commented 4 years ago

I guess you could use https://cmake.org/cmake/help/latest/module/CheckLinkerFlag.html.

aras-p commented 4 years ago

I guess you could use https://cmake.org/cmake/help/latest/module/CheckLinkerFlag.html.

Maybe, but I know nothing about either of: CMake, Linux or MinGW :)