blob: cb0d541b743644661c09b68a525cb21946616345 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
include(RunCMake)
function(check_files dir)
set(expected ${ARGN})
list(FILTER expected EXCLUDE REGEX "^$")
list(REMOVE_DUPLICATES expected)
list(SORT expected)
file(GLOB_RECURSE glob "${dir}/*")
set(actual)
foreach(i IN LISTS glob)
if(NOT i MATCHES "(\\.manifest$)|(\\.exp$)|(\\.tds$)")
list(APPEND actual ${i})
endif()
endforeach()
list(REMOVE_DUPLICATES actual)
list(SORT actual)
if(NOT "${expected}" STREQUAL "${actual}")
string(REPLACE ";" "\n " expected_formatted "${expected}")
string(REPLACE ";" "\n " actual_formatted "${actual}")
string(APPEND RunCMake_TEST_FAILED "Actual files did not match expected\nExpected:\n ${expected_formatted}\nActual:\n ${actual_formatted}\n")
endif()
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
endfunction()
function(run_cmake_build name)
set(RunCMake_TEST_NO_CLEAN TRUE)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build)
file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR})
if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release)
endif()
run_cmake(${name})
set(RunCMake_TEST_OPTIONS)
run_cmake_command(${name}-build ${CMAKE_COMMAND}
--build ${RunCMake_TEST_BINARY_DIR}
--config Release
--target ${ARGN})
endfunction()
function(run_optimize_test name)
set(RunCMake_TEST_OPTIONS)
run_cmake_build(${name}-none ${ARGN})
set(RunCMake_TEST_OPTIONS -DOPTIMIZE_TOP=TRUE)
run_cmake_build(${name}-top ${ARGN})
set(RunCMake_TEST_OPTIONS -DOPTIMIZE_MIDDLE=TRUE)
run_cmake_build(${name}-middle ${ARGN})
set(RunCMake_TEST_OPTIONS -DOPTIMIZE_TOP=TRUE -DOPTIMIZE_MIDDLE=TRUE)
run_cmake_build(${name}-both ${ARGN})
endfunction()
run_cmake(Property)
run_optimize_test(OptimizeShared SharedTop)
run_optimize_test(OptimizeStatic StaticTop)
if(CMAKE_Fortran_COMPILER)
run_optimize_test(OptimizeFortran FortranTop)
endif()
|