Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

make replaced by cmake, ouch. how to I get my -march=native -flto perf improvements in there easily? Would need at least 20 lines...


You configure with -DCMAKE_CXX_FLAGS='-march=native -ftlo' like any other cmake build. Or you `-G'Unix Makefiles' and export CFLAGS/CXXFLAGS before you build it if you really want to use make.


You should still be OK although I agree that CMake is really annoying to approach if you don't know the projects idioms particularly well e.g. there is a recurring bug in one of our builds where OMP initialization causes a deadlock, which can thus be disabled by not using openmp at cmake-time: finding how to do this when I went to disable it permanently took a good 20 minutes of guesswork because it's CMake magic versus make bullshit


Try this on for size as a concrete example. (The %{notation} is due to the RPM .spec file syntax -- adjust as required.)

    argv=( ${CMAKE:-cmake3} )
    argv+=( -S %{cmake_source_dir} )
    argv+=( -B %{cmake_build_dir} )
    argv+=( -G Ninja )
    argv+=( -D CMAKE_CXX_FLAGS='-march=native -flto' )
    argv+=( -D CMAKE_INSTALL_PREFIX=%{install_home} )
    argv+=( -D CMAKE_EXE_LINKER_FLAGS="-Wl,-rpath=%{openssl_root}/lib" )
    argv+=( -D OPENSSL_ROOT_DIR=%{openssl_root} )
    "${argv[@]}"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: