2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

cudaconfidencemaps.cmake 2.69 KB
Newer Older
1
2
# modules/cudaconfidencemaps/cudaconfidencemaps.cmake
# CMake file for the cuda confidence maps module
3

4
5
6
7
8
9
10
# Set module status (valid values are STABLE, TESTING and EXPERIMENTAL)
SET(ThisModStatus EXPERIMENTAL)
# Set whether this module has external dependencies that are not shipped with CAMPVis.
SET(ThisModExternalDependencies TRUE)

# The files and assignments need only to be parsed if the module is enabled
IF(ModuleEnabled)
11
12
    FIND_PACKAGE(CUDA REQUIRED)

13
    IF(CUDA_FOUND)
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
        # Source files:
        FILE(GLOB ThisModSources RELATIVE ${ModulesDir}
            modules/cudaconfidencemaps/core/*.cpp
            modules/cudaconfidencemaps/pipelines/*.cpp
            modules/cudaconfidencemaps/processors/*.cpp
        )

        # Header files (including GLSL files so that they'll appear in VS projects)
        FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
            modules/cudaconfidencemaps/glsl/*.frag
            modules/cudaconfidencemaps/glsl/*.geom
            modules/cudaconfidencemaps/glsl/*.vert
            modules/cudaconfidencemaps/pipelines/*.h
            modules/cudaconfidencemaps/processors/*.h
        )

30
31
32
33
34
35
36
37
38
        # Define the GLSL shader path, so that all needed shaders will be deployed to target directory
        SET(ThisModShaderDirectories "modules/cudaconfidencemaps/glsl")

        # Define dependency modules
        SET(ThisModDependencies preprocessing advancedusvis openigtlink fontrendering)

        IF(WIN32)
            SET(CUDA_PROPAGATE_HOST_FLAGS ON)
        ELSE()
39
40
            # Otherwise -std=c++11 is passed to the compiler on linux. However official
            # c++11 support for cuda is only available in CUDA 7
41
            SET(CUDA_PROPAGATE_HOST_FLAGS OFF)
42
43
        ENDIF()

44
        # Enable optimizations when building a release version
45
        IF(CMAKE_BUILD_TYPE MATCHES RELEASE)
46
            SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3)
47
48
        ENDIF()

49
50
51
52
53
54
        # CUSP Include directory
        CUDA_INCLUDE_DIRECTORIES(${ThisModDir}/ext/cusplibrary-0.4.0)

        # Build CUDA portion of the code (STATICALLY!?)
        FILE(GLOB cuda_SOURCES modules/cudaconfidencemaps/core/*.cu)
        CUDA_ADD_LIBRARY(cudaconfidencemaps-cuda STATIC
55
56
57
58
            ${cuda_SOURCES}
            )        

        # Make sure code can find the CUSP include files included with this module
59
60
        #SET(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};"-I ${ThisModDir}/ext/cusplibrary-0.4.0")
        set(CUDA_NVCC_FLAGS "ajkladjfl" CACHE STRING "adsf")
61

62
63
64
        # Link CUDA code to module
        LIST(APPEND ThisModExternalLibs cudaconfidencemaps-cuda)
    ELSE()
65
        MESSAGE(FATAL_ERROR "Could not find CUDA SDK.")
66
    ENDIF()
67

68
ENDIF(ModuleEnabled)