Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cmake_minimum_required (VERSION 2.8)
- #### USER DEFINED ##############################################################
- #### BASIC SETTINGS ############################################################
- include_directories(.)
- set (CMAKE_CXX_FLAGS "-std=c++1z -msse4.2 -Wall -Wextra -O3 -g -fopenmp")
- set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
- set(THREADS_PREFER_PTHREAD_FLAG TRUE)
- find_package(Threads REQUIRED)
- #### TARGETS ###################################################################
- function( addEx name cpp )
- add_executable(${name} ${cpp})
- target_compile_options(${name}
- PRIVATE
- -Wall
- # -Wextra # reasonable and standard
- # -Wshadow # warn the user if a variable declaration shadows one from a
- # # parent context
- # -Wnon-virtual-dtor # warn the user if a class with virtual functions has a
- # # non-virtual destructor. This helps catch hard to
- # # track down memory errors
- # -Wold-style-cast # warn for c-style casts
- # -Wcast-align # warn for potential performance problem casts
- # -Wunused # warn on anything being unused
- # -Woverloaded-virtual # warn if you overload (not override) a virtual
- # # function
- # -Wpedantic # warn if non-standard C++ is used
- # -Wconversion # warn on type conversions that may lose data
- # -Wsign-conversion # warn on sign conversions
- # -Wmisleading-indentation # warn if identation implies blocks where blocks
- # # do not exist
- # -Wduplicated-cond # warn if if / else chain has duplicated conditions
- # -Wduplicated-branches # warn if if / else branches have duplicated code
- # -Wlogical-op # warn about logical operations being used where bitwise were
- # # probably wanted
- # -Wnull-dereference # warn if a null dereference is detected
- # -Wuseless-cast # warn if you perform a cast to the same type
- # -Wdouble-promotion # warn if float is implicit promoted to double
- # -Wformat=2 # warn on security issues around functions that format output
- # -Weffc++
- # # (ie printf)
- )
- endfunction( addEx )
- # add_executable(test_correctness tests/correctness.cpp)
- addEx(test_correctness tests/correctness.cpp)
- target_sources(test_correctness PRIVATE implementation/dynamic_connectivity.hpp)
- target_link_libraries(test_correctness Threads::Threads)
- # add_executable(graph_construction tools/graph_generator.cpp)
- addEx(graph_construction tools/graph_generator.cpp)
- target_sources(graph_construction PRIVATE tools/graph_generator.cpp)
- #target_link_libraries(graph_construction Threads::Threads)
- # 3.1
- find_package(OpenMP REQUIRED)
- set(OMP_LIBRARIES OpenMP::OpenMP_CXX)
- addEx(sum_omp implementation/sum.cpp)
- target_link_libraries(sum_omp ${OMP_LIBRARIES})
- target_compile_definitions(sum_omp PRIVATE -D OMP)
- addEx(sum_no implementation/sum.cpp)
- add_custom_target(run_sum_omp
- ./sum_omp
- DEPENDS sum_omp
- )
- add_custom_target(run_sum_no
- ./sum_no
- DEPENDS sum_no
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement