DigitalInBlue / Celero

C++ Benchmark Authoring Library/Framework
Other
824 stars 95 forks source link

GCC on macOS #130

Closed ghlecl closed 5 years ago

ghlecl commented 5 years ago

Bug Report or Feature Request

Not sure how to categorize this, depending on how you look at it. I have used Celero to benchmark some of my code on my macOS laptop. I wanted to test two compilers, Clang and GCC. I use GCC from Homebrew and the stock Clang that comes with Xcode.

When I tried to compile with GCC, I have had two issues: 1) missing the header in the Memory.cpp file. It gets included when on *nix systems, but not on macOS. 2) I've had to comment the following lines in the CMakeLists.txt file:

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
       target_compile_options(${PROJECT_NAME} PRIVATE -stdlib=libc++)
       set(CMAKE_COMPILER_IS_GNUCXX 1)
endif()

In order to remove the stdlib command line option and make sure the GNUCXX is not defined to false.

The first thing I did I am fairly certain is not a problem. I am guessing on Apple Clang, this header is included by another header you use and that is why you do not explicitly need it.

The second thing I did I am definitely not sure about. It seems to work. I have compiled the library twice in different places, included it with different projects and it compiles, links, runs and gives slightly different results, which I think indicates it works, but then, when compiling one or the other versions, I need to comment and uncomment these things.

Anyhow, just wanted to report my experience.

OSX 10.13.6 XCode Version 10.1 (10B61) Apple LLVM version 10.0.0 (clang-1000.11.45.5) g++-8 (Homebrew GCC 8.2.0) 8.2.0

Thanks

DigitalInBlue commented 5 years ago

This has been fixed (for a while). I'm doing some housekeeping and closing the ticket.

https://travis-ci.org/DigitalInBlue/Celero/jobs/564719717