list(APPEND CUDA_NVCC_FLAGS -arch compute_30 -use_fast_math)

add_definitions(-D__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__=1)

set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --default-stream per-thread")
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE "ON")

set(DEBUG_FLAGS "${DEBUG_FLAGS} -g -pg -Wall -Wextra -O0 -fprofile-arcs -ftest-coverage --coverage -fPIC -msse3 -mbmi2")

if (CMAKE_COMPILER_IS_GNUCXX)
# set(DEBUG_FLAGS "${DEBUG_FLAGS} -g -Wall -Wextra --coverage -fPIC")
    # set(DEBUG_FLAGS "${DEBUG_FLAGS} -g -Wall -Wextra  -fPIC")
    # set(RELEASE_FLAGS "-O3 -Wall -Wextra --coverage -fPIC")
    set(RELEASE_FLAGS "-O3 -Wall -Wextra  -fPIC ")
endif (CMAKE_COMPILER_IS_GNUCXX)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
    set(DEBUG_FLAGS "${DEBUG_FLAGS} -std=c++11 -g -Wall -Wextra --coverage -fPIC")
    set(RELEASE_FLAGS "-std=c++11 -O3 -Wall -Wextra --coverage -fPIC")
endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (MINGW)
    set(RELEASE_FLAGS "-std=c++11 -O3 -Wall -Wextra --coverage")
endif (MINGW)
if (MSVC)
    add_definitions(-DNOMINMAX)
    set(DEBUG_FLAGS "/FS /Zi /EHsc /MDd /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING")
    set(RELEASE_FLAGS "/FS /EHsc")
    list(APPEND CUDA_NVCC_FLAGS --compiler-options /D_USE_MATH_DEFINES)
endif (MSVC)

set(CMAKE_CXX_FLAGS ${RELEASE_FLAGS})
set(CMAKE_CXX_FLAGS_DEBUG ${DEBUG_FLAGS})
set(CMAKE_CONFIGURATION_TYPES Debug Release)