Project

General

Profile

Download (4.7 KB) Statistics
| Branch: | Tag: | Revision:
1
#set( CTEST_BINARY_DIRECTORY "/usr/bin/")
2
#set(  CTEST_COMMAND "ctest")
3
if(NOT CTEST_EXT_INCLUDED)
4
    function(download_ctest_ext)
5
        message("Download latest version of CTest Extension module")
6

    
7
        find_package(Git QUIET)
8

    
9
        set(repo_url "https://github.com/jet47/ctest-ext.git")
10
        set(repo_dir "${CMAKE_CURRENT_LIST_DIR}/ctest-ext")
11
        set(tmp_dir "${CMAKE_CURRENT_LIST_DIR}/ctest-ext-tmp")
12

    
13
        if(NOT EXISTS "${repo_dir}")
14
            set(CTEST_CHECKOUT_COMMAND "${GIT_EXECUTABLE} clone ${repo_url} ${repo_dir}")
15
        endif()
16
        set(CTEST_UPDATE_COMMAND "${GIT_EXECUTABLE}")
17

    
18
        ctest_start("CTestExt" "${repo_dir}" "${tmp_dir}")
19
        ctest_update(SOURCE "${repo_dir}")
20

    
21
        file(REMOVE_RECURSE "${tmp_dir}")
22

    
23
        set(CTEST_EXT_MODULE_PATH "${repo_dir}" PARENT_SCOPE)
24
    endfunction()
25

    
26
    if(NOT DEFINED CTEST_EXT_MODULE_PATH)
27
        if(DEFINED ENV{CTEST_EXT_MODULE_PATH} AND EXISTS "$ENV{CTEST_EXT_MODULE_PATH}/ctest_ext.cmake")
28
            set(CTEST_EXT_MODULE_PATH "$ENV{CTEST_EXT_MODULE_PATH}")
29
        elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/ctest-ext/ctest_ext.cmake")
30
            set(CTEST_EXT_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/ctest-ext")
31
        else()
32
            download_ctest_ext()
33
        endif()
34
    endif()
35

    
36
    include("${CTEST_EXT_MODULE_PATH}/ctest_ext.cmake")
37
endif()
38

    
39
set_ifndef(CTEST_PROJECT_NAME "lustrec-tests")
40

    
41
#set_ifndef(CTEST_PROJECT_GIT_URL    "https://cavale.enseeiht.fr/git/lustrec-tests")
42
#set_ifndef(CTEST_WITH_UPDATE        TRUE)
43
set(CTEST_SOURCE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}")
44

    
45
ctest_ext_init()
46

    
47

    
48

    
49
# Check supported targets and models
50
check_if_matches(CTEST_TARGET_SYSTEM    "^Linux" "^Windows")
51
check_if_matches(CTEST_MODEL            "^Experimental$" "^Nightly$" "^Continuous$" "^Release$" "^Documentation$")
52

    
53
# Checks for Continuous model
54
set(IS_CONTINUOUS FALSE)
55
if(CTEST_MODEL MATCHES "Continuous")
56
    set(IS_CONTINUOUS TRUE)
57
endif()
58

    
59
set(IS_BINARY_EMPTY FALSE)
60
if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
61
    set(IS_BINARY_EMPTY TRUE)
62
endif()
63

    
64
if(IS_CONTINUOUS AND NOT IS_BINARY_EMPTY AND NOT HAVE_UPDATES)
65
    ctest_ext_info("Continuous model : no updates")
66
    return()
67
endif()
68

    
69
# Configure the testing model
70
set_ifndef(CTEST_WITH_SUBMIT            TRUE)
71

    
72
if(CTEST_MODEL MATCHES "Documentation")
73
    set_ifndef(CTEST_WITH_TESTS FALSE)
74
else()
75
    set_ifndef(CTEST_WITH_TESTS TRUE)
76
endif()
77

    
78
if(CTEST_MODEL MATCHES "Nightly")
79
    set_ifndef(CTEST_WITH_COVERAGE          TRUE)
80
    set_ifndef(CTEST_COVERAGE_TOOL          "CDASH")
81
    set_ifndef(CTEST_WITH_DYNAMIC_ANALYSIS  TRUE)
82
    set_ifndef(CTEST_DYNAMIC_ANALYSIS_TOOL  "CDASH")
83
else()
84
    set_ifndef(CTEST_WITH_COVERAGE          FALSE)
85
    set_ifndef(CTEST_WITH_DYNAMIC_ANALYSIS  FALSE)
86
endif()
87

    
88
if(CTEST_MODEL MATCHES "Continuous")
89
    set_ifndef(CTEST_EMPTY_BINARY_DIRECTORY FALSE)
90
else()
91
    set_ifndef(CTEST_EMPTY_BINARY_DIRECTORY TRUE)
92
endif()
93

    
94
# Set CMake options
95
if(CTEST_TARGET_SYSTEM MATCHES "Windows")
96
    if(CTEST_TARGET_SYSTEM MATCHES "64")
97
        set_ifndef(CTEST_CMAKE_GENERATOR "Visual Studio 13 Win64")
98
    else()
99
        set_ifndef(CTEST_CMAKE_GENERATOR "Visual Studio 13")
100
    endif()
101
else()
102
    set_ifndef(CTEST_CMAKE_GENERATOR "Unix Makefiles")
103
endif()
104

    
105
if(CTEST_MODEL MATCHES "(Release|Continuous)")
106
    set_ifndef(CTEST_CONFIGURATION_TYPE "Release")
107
else()
108
    set_ifndef(CTEST_CONFIGURATION_TYPE "Debug")
109
endif()
110

    
111
add_cmake_cache_entry("ENABLE_CTEST" TYPE "BOOL" "ON")
112

    
113
if(CTEST_WITH_COVERAGE)
114
    add_cmake_cache_entry("ENABLE_COVERAGE" TYPE "BOOL" "ON")
115
else()
116
    add_cmake_cache_entry("ENABLE_COVERAGE" TYPE "BOOL" "OFF")
117
endif()
118

    
119
if(CTEST_MODEL MATCHES "Documentation")
120
    add_cmake_cache_entry("BUILD_DOCS" TYPE "BOOL" "ON")
121
endif()
122

    
123
if(CTEST_MODEL MATCHES "Release")
124
    if(CTEST_TARGET_SYSTEM MATCHES "Windows")
125
        add_cmake_cache_entry("CPACK_GENERATOR" TYPE "STRING" "ZIP")
126
    else()
127
        add_cmake_cache_entry("CPACK_GENERATOR" TYPE "STRING" "TGZ")
128
    endif()
129
endif()
130

    
131

    
132
ctest_ext_start()
133

    
134
ctest_ext_configure()
135

    
136
if(CTEST_MODEL MATCHES "Release")
137
    ctest_ext_build(TARGETS "ALL" "package")
138
elseif(CTEST_MODEL MATCHES "Documentation")
139
    ctest_ext_build(TARGET "docs")
140
else()
141
    ctest_ext_build()
142
endif()
143

    
144

    
145
if(CTEST_MODEL MATCHES "Nightly")
146
    ctest_ext_test(INCLUDE_LABEL "Full")
147
else()
148
    ctest_ext_test(EXCLUDE_LABEL "Light")
149
endif()
150

    
151
ctest_ext_coverage(
152
    CDASH
153
        LABELS "Module"
154
)
155

    
156
ctest_ext_dynamic_analysis(
157
    CDASH
158
        INCLUDE_LABEL "Light"
159
)
160

    
161

    
162
if(CTEST_MODEL MATCHES "Release")
163
    if(CTEST_TARGET_SYSTEM MATCHES "Windows")
164
        file(GLOB packages "${CTEST_BINARY_DIRECTORY}/*.zip")
165
    else()
166
        file(GLOB packages "${CTEST_BINARY_DIRECTORY}/*.tar.gz")
167
    endif()
168

    
169
    list(APPEND CTEST_UPLOAD_FILES ${packages})
170
endif()
171

    
172
ctest_ext_submit()	
(5-5/6)