Skip to content

Commit

Permalink
make it working on windowz and modernise cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
kysucix committed Nov 13, 2019
1 parent 4646d91 commit 56d28f8
Show file tree
Hide file tree
Showing 5 changed files with 1,195 additions and 22 deletions.
35 changes: 26 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
cmake_minimum_required (VERSION 2.8)
project (fusibile)
cmake_minimum_required (VERSION 3.9)
project (fusibile LANGUAGES CUDA CXX)

# Enable C++11 globally
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Support IDEs: https://cliutils.gitlab.io/modern-cmake/chapters/features/ides.html
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "cmake-default-targets")

find_package(OpenCV REQUIRED )
find_package(CUDA 6.0 REQUIRED ) # For Cuda Managed Memory and c++11

if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()

include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(.)

set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3 --use_fast_math --ptxas-options=-v -std=c++11 --compiler-options -Wall -gencode arch=compute_30,code=sm_30 -gencode arch=compute_52,code=sm_52)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3 --use_fast_math --ptxas-options=-v --compiler-options -Wall -gencode arch=compute_30,code=sm_30 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_61,code=sm_61)
#set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3 --use_fast_math --ptxas-options=-v -std=c++11 --compiler-options -Wall -gencode arch=compute_52,code=sm_52)

if(CMAKE_COMPILER_IS_GNUCXX)
Expand All @@ -20,10 +34,6 @@ if(CMAKE_COMPILER_IS_GNUCXX)
#add_definitions(-march=native)
endif()

find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

# for YouCompleteMe
set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
Expand All @@ -45,9 +55,16 @@ cuda_add_executable(
fusibile.cu
main.cpp
)
# https://cliutils.gitlab.io/modern-cmake/chapters/packages/OpenMP.html
find_package(OpenMP)

# For linking ...
# Specify target & libraries to link it with
target_link_libraries(fusibile
${OpenCV_LIBS}
)
${OpenCV_LIBS}
OpenMP::OpenMP_CXX
)


include(FeatureSummary)
feature_summary(WHAT ALL)
Loading

0 comments on commit 56d28f8

Please sign in to comment.