CMakeLists.txt 4.99 KB
Newer Older
Andy Cedilnik's avatar
Andy Cedilnik committed
1
## Copyright 2003 Sandia Coporation
2
3
4
5
## Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
## the U.S. Government retains certain rights in this software.
##
## This source code is released under the New BSD License.
Andy Cedilnik's avatar
Andy Cedilnik committed
6
7
#

8
IF (ICET_USE_OPENGL)
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
  SET(ICET_OPENGL_WINDOW_LIBRARY GLUT
    CACHE STRING
    "The name of the library the IceT tests will use to create windows for
OpenGL contexts. Supported values are GLUT and GLFW."
    )
  SET_PROPERTY(CACHE ICET_OPENGL_WINDOW_LIBRARY
    PROPERTY STRINGS GLUT GLFW
    )
  MARK_AS_ADVANCED(ICET_OPENGL_WINDOW_LIBRARY)
  IF (ICET_OPENGL_WINDOW_LIBRARY STREQUAL GLUT)
    FIND_PACKAGE(GLUT)
    IF (GLUT_FOUND)
      INCLUDE_DIRECTORIES(${GLUT_INCLUDE_DIR})
      SET(ICET_TESTS_USE_OPENGL 1)
      SET(ICET_TESTS_USE_GLUT 1)
    ELSE (GLUT_FOUND)
      MESSAGE(WARNING "Cannot find GLUT library. OpenGL tests disabled.")
    ENDIF (GLUT_FOUND)
  ELSEIF (ICET_OPENGL_WINDOW_LIBRARY STREQUAL GLFW)
    FIND_PACKAGE(GLFW)
    IF (GLFW_FOUND)
      INCLUDE_DIRECTORIES(${GLFW_INCLUDE_DIR})
      SET(ICET_TESTS_USE_OPENGL 1)
      SET(ICET_TESTS_USE_GLFW 1)
    ELSE (GLFW_FOUND)
      MESSAGE(WARNING "Cannot find GLFW library. OpenGL tests disabled.")
    ENDIF (GLFW_FOUND)
  ELSE ()
    MESSAGE(SEND_ERROR "Invalid value for ICET_OPENGL_WINDOW_LIBRARY: ${ICET_OPENGL_WINDOW_LIBRARY}")
  ENDIF ()
39
40
41
ENDIF (ICET_USE_OPENGL)

IF (NOT ICET_TESTS_USE_OPENGL)
42
  MESSAGE(STATUS "Most tests require ICET_USE_OPENGL and GLUT or GLFW. Those tests are disabled.")
43
44
ENDIF (NOT ICET_TESTS_USE_OPENGL)

45
SET(IceTTestSrcs
46
  BackgroundCorrect.c
47
  CompressionSize.c
48
  FloatingViewport.c
49
  Interlace.c
50
  MaxImageSplit.c
51
  OddImageSizes.c
Kenneth Moreland's avatar
Kenneth Moreland committed
52
  OddProcessCounts.c
53
  PreRender.c
54
  RadixkUnitTests.c
55
  RenderEmpty.c
56
  SimpleTiming.c
57
  SparseImageCopy.c
58
  )
Andy Cedilnik's avatar
Andy Cedilnik committed
59

60
61
62
63
64
65
66
SET(IceTOpenGLTestSrcs
  BlankTiles.c
  BoundsBehindViewer.c
  DisplayNoDraw.c
  RandomTransform.c
  SimpleExample.c
  )
67

68
69
70
71
SET(UTIL_SRCS
  test_common.c
  ppm.c
  )
Andy Cedilnik's avatar
Andy Cedilnik committed
72

73
74
SET(TEST_HEADERS
  test_codes.h
75
  test_util.h
76
77
  test_mpi.h
  test_mpi_opengl.h
78
79
80
81
82
  )
SET_SOURCE_FILES_PROPERTIES(${TEST_HEADERS}
  PROPERTIES HEADER_ONLY TRUE
  )

83
CONFIGURE_FILE(
84
85
  ${CMAKE_CURRENT_SOURCE_DIR}/test_config.h.in
  ${CMAKE_CURRENT_BINARY_DIR}/test_config.h
86
87
88
89
90
91
  )

INCLUDE_DIRECTORIES(
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  )
92

Andy Cedilnik's avatar
Andy Cedilnik committed
93
IF (ICET_MPIRUN_EXE)
94
  SET(PRE_TEST_FLAGS ${ICET_MPIRUN_EXE} ${ICET_MPI_NUMPROC_FLAG} ${ICET_MPI_MAX_NUMPROCS} ${ICET_MPI_PREFLAGS})
Andy Cedilnik's avatar
Andy Cedilnik committed
95
96
97
  SET(POST_TEST_FLAGS ${ICET_MPI_POSTFLAGS})
ENDIF (ICET_MPIRUN_EXE)

98
SET(ICET_TEST_FLAGS "" CACHE STRING "Arguments given to the test program.  These are given between the test executable and the name of the test.  Run the test executable with the -h flag to see what is available.")
Andy Cedilnik's avatar
Andy Cedilnik committed
99
100
101
MARK_AS_ADVANCED(ICET_TEST_FLAGS)
SEPARATE_ARGUMENTS(ICET_TEST_FLAGS)

102
103
104
105
106
107
108
109
110
111
112
CREATE_TEST_SOURCELIST(Tests icetTests_mpi.c ${IceTTestSrcs}
  EXTRA_INCLUDE test_mpi.h
  FUNCTION init_mpi)

ADD_EXECUTABLE(icetTests_mpi ${Tests} ${UTIL_SRCS} ${TEST_HEADERS})
TARGET_LINK_LIBRARIES(icetTests_mpi
  IceTCore
  IceTMPI
  )

FOREACH (test ${IceTTestSrcs})
Andy Cedilnik's avatar
Andy Cedilnik committed
113
  GET_FILENAME_COMPONENT(TName ${test} NAME_WE)
114
115
  ADD_TEST(NAME IceT${TName}
    COMMAND
116
    ${PRE_TEST_FLAGS}
117
    $<TARGET_FILE:icetTests_mpi> ${ICET_TEST_FLAGS} ${TName}
118
    ${POST_TEST_FLAGS})
119
120
121
122
123
124
125
126
127
  IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.1)
    SET_TESTS_PROPERTIES(IceT${TName}
      PROPERTIES FAIL_REGULAR_EXPRESSION
      ":ERROR:;TEST NOT RUN;TEST NOT PASSED;TEST FAILED"
      )
    SET_TESTS_PROPERTIES(IceT${TName}
      PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed"
      )
  ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.1)
Andy Cedilnik's avatar
Andy Cedilnik committed
128
129
ENDFOREACH(test)

130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
IF (ICET_TESTS_USE_OPENGL)
  CREATE_TEST_SOURCELIST(OpenGLTests icetTests_mpi_opengl.c ${IceTOpenGLTestSrcs}
    EXTRA_INCLUDE test_mpi_opengl.h
    FUNCTION init_mpi_opengl)

  ADD_EXECUTABLE(icetTests_mpi_opengl ${OpenGLTests} ${UTIL_SRCS} ${TEST_HEADERS})
  TARGET_LINK_LIBRARIES(icetTests_mpi_opengl
    IceTCore
    IceTMPI
    IceTGL
    )
  IF (ICET_TESTS_USE_GLUT)
    TARGET_LINK_LIBRARIES(icetTests_mpi_opengl ${GLUT_LIBRARIES})
  ENDIF (ICET_TESTS_USE_GLUT)
  IF (ICET_TESTS_USE_GLFW)
    TARGET_LINK_LIBRARIES(icetTests_mpi_opengl ${GLFW_LIBRARY})
  ENDIF (ICET_TESTS_USE_GLFW)

  FOREACH (test ${IceTOpenGLTestSrcs})
    GET_FILENAME_COMPONENT(TName ${test} NAME_WE)
    ADD_TEST(NAME IceT${TName}
      COMMAND
      ${PRE_TEST_FLAGS}
      $<TARGET_FILE:icetTests_mpi_opengl> ${ICET_TEST_FLAGS} ${TName}
      ${POST_TEST_FLAGS})
    IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.1)
      SET_TESTS_PROPERTIES(IceT${TName}
        PROPERTIES FAIL_REGULAR_EXPRESSION
        ":ERROR:;TEST NOT RUN;TEST NOT PASSED;TEST FAILED"
        )
      SET_TESTS_PROPERTIES(IceT${TName}
        PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed"
        )
    ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.1)
  ENDFOREACH(test)
ENDIF (ICET_TESTS_USE_OPENGL)

Andy Cedilnik's avatar
Andy Cedilnik committed
167
IF (WIN32)
Kenneth Moreland's avatar
Kenneth Moreland committed
168
  ADD_CUSTOM_TARGET(logclean erase log.???? *.ppm)
Andy Cedilnik's avatar
Andy Cedilnik committed
169
ELSE (WIN32)
170
  ADD_CUSTOM_TARGET(logclean rm -f log.???? *.ppm core.*)
Andy Cedilnik's avatar
Andy Cedilnik committed
171
ENDIF (WIN32)