Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of compilation flags with CMake #572

Merged
merged 13 commits into from
Dec 12, 2018

Commits on Dec 12, 2018

  1. [C++] Use PROJECT_SOURCE_DIR for sourced exceptions.

    While CMAKE_SOURCE_DIR can point to another project root if Aeron is
    included as a subdirectory, PROJECT_SOURCE_DIR always points to
    Aeron's project root which will result in the same paths being generated
    regardless of a standalone build or subproject build.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    538cf8d View commit details
    Browse the repository at this point in the history
  2. [C++] Increment minimum required version of CMake to 3.1.3.

    This version is the minimum required for the variable
    CMAKE_CXX_STANDARD.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    3babd8d View commit details
    Browse the repository at this point in the history
  3. [C++] Set C standard with CMake.

    This adds the flag -std=c11 to GCC and Clang. Visual Studio does not
    seem to have full conformance to C11 standard yet.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    c124032 View commit details
    Browse the repository at this point in the history
  4. [C++] Disable C and C++ extensions through CMake.

    This is equal to setting -std=c11 and -std=c++11 as opposed to
    -std=gnu11 and -std=gnu++11.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    7c1fa95 View commit details
    Browse the repository at this point in the history
  5. [C++] Remove explicit appending of version flags.

    CMake automatically appends these when it detects CMAKE_C_STANDARD and
    CMAKE_CXX_STANDARD has been set.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    35a9c7a View commit details
    Browse the repository at this point in the history
  6. [C++] Remove explicit appending of -g flag.

    This flag is automatically appended by CMake in debug builds which
    include RelWithDebInfo. Release mode should not have debug symbols.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    0b1daa9 View commit details
    Browse the repository at this point in the history
  7. [C++] Remove explicit setting of O0 for debug mode.

    This flag is added automatically by CMake in Debug mode.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    6f42d62 View commit details
    Browse the repository at this point in the history
  8. [C++] Use add_compile_options wherever possible.

    add_compile_options works on both C and C++ sources and has a cleaner
    usage less prone to wiping off old flags.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    5b12bfe View commit details
    Browse the repository at this point in the history
  9. [C++] Use add_compile_options for compiler flags.

    add_definitions is semantically used to pass macro definitions to source
    files.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    105e1e4 View commit details
    Browse the repository at this point in the history
  10. [C++] Add option to enable Ofast in release builds.

    CMake automatically adds -O3 for release builds. Ofast adds potentially
    breaking non-standard optimizations during compilation. This change
    keeps -Ofast enabled for stand alone builds but disables it when Aeron
    is added with add_subdirectory command.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    3a726fe View commit details
    Browse the repository at this point in the history
  11. [C++] Pass C and C++ compilers to subprojects.

    If a compiler set different from CC and CXX is used to build Aeron
    and tests and benchmarks are enabled by using CMAKE_C_COMPILER and
    CMAKE_CXX_COMPILER, Aeron source and the tests are built using
    different compilers.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    40eb7e4 View commit details
    Browse the repository at this point in the history
  12. [C++] Remove conditional addition of -m64 flag

    x86 or x86_64 compilation is already based on the architecture of the
    machine running the build. These flags are necessary if the target
    architecture is different from the one that compiles the code.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    dd6b8b5 View commit details
    Browse the repository at this point in the history
  13. [C++] Remove explicit addition of -fexceptions

    fexceptions is enabled for C++ by default.
    denizevrenci committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    61f60eb View commit details
    Browse the repository at this point in the history