Skip to content

Commit 1baee09

Browse files
committed
CMake building of tests
1 parent 141ae41 commit 1baee09

9 files changed

+35
-47
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ CTestTestfile.cmake
55
Makefile
66
cmake_install.cmake
77
*.dylib
8+
Testing
89

10+
test/projcl_test
911
obj/

CMakeLists.txt

+4-24
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ endif(APPLE)
159159

160160

161161

162-
set(WITH_PROJ FALSE CACHE BOOL "Choose if GDAL support should be built")
162+
set(WITH_PROJ FALSE CACHE BOOL "Choose if Proj support should be built")
163+
set(PROJCL_LIBRARY projcl)
163164

164165
find_package(Proj4 4.8.0)
165166
set(PROJCL_HAVE_PROJ 1)
@@ -171,31 +172,10 @@ find_package(OpenCL)
171172
find_package(Blas)
172173

173174

175+
set(PROJCL_DEPENDENT_LIBRARIES ${OPENCL_LIBRARIES} ${PROJ4_LIBRARIES} ${BLAS_LIBRARIES})
174176
add_subdirectory(src)
175177

176-
if(WITH_TESTS)
177-
message(STATUS "Building with PDAL unit tests")
178-
enable_testing()
179-
180-
if(ENABLE_CTEST)
181-
message(STATUS
182-
"Enable CTest to support submissions of results to CDash at http://cdash.org")
183-
cmake_minimum_required(VERSION 2.8.0)
184-
# Dashboard has been prepared for experiments
185-
# http://my.cdash.org/index.php?project=PDAL
186-
include(CTest)
187-
message(STATUS
188-
"Enable CTest to support submissions of results to CDash at http://cdash.org - done")
189-
endif()
190-
191-
add_subdirectory(test)
192-
else()
193-
if(ENABLE_CTEST)
194-
message(WARNING
195-
"CTest support requested but WITH_TESTS option not specified to build of PDAL unit tests")
196-
endif()
197-
endif()
198-
178+
add_subdirectory(test)
199179

200180

201181

Makefile

+14-11
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,6 @@ rebuild_cache:
7070
rebuild_cache/fast: rebuild_cache
7171
.PHONY : rebuild_cache/fast
7272

73-
# Special rule for the target test
74-
test:
75-
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..."
76-
/usr/local/Cellar/cmake/2.8.11.2/bin/ctest --force-new-ctest-process $(ARGS)
77-
.PHONY : test
78-
79-
# Special rule for the target test
80-
test/fast: test
81-
.PHONY : test/fast
82-
8373
# The main all target
8474
all: cmake_check_build_system
8575
$(CMAKE_COMMAND) -E cmake_progress_start /Users/hobu/dev/git/ProjCL/CMakeFiles /Users/hobu/dev/git/ProjCL/CMakeFiles/progress.marks
@@ -124,6 +114,19 @@ projcl/fast:
124114
$(MAKE) -f src/CMakeFiles/projcl.dir/build.make src/CMakeFiles/projcl.dir/build
125115
.PHONY : projcl/fast
126116

117+
#=============================================================================
118+
# Target rules for targets named projcl_test
119+
120+
# Build rule for target.
121+
projcl_test: cmake_check_build_system
122+
$(MAKE) -f CMakeFiles/Makefile2 projcl_test
123+
.PHONY : projcl_test
124+
125+
# fast build rule for target.
126+
projcl_test/fast:
127+
$(MAKE) -f test/CMakeFiles/projcl_test.dir/build.make test/CMakeFiles/projcl_test.dir/build
128+
.PHONY : projcl_test/fast
129+
127130
# Help Target
128131
help:
129132
@echo "The following are some of the valid targets for this Makefile:"
@@ -132,8 +135,8 @@ help:
132135
@echo "... depend"
133136
@echo "... edit_cache"
134137
@echo "... rebuild_cache"
135-
@echo "... test"
136138
@echo "... projcl"
139+
@echo "... projcl_test"
137140
.PHONY : help
138141

139142

File renamed without changes.

src/CMakeLists.txt

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ set(PROJCL_HEADERS_DIR ${PROJECT_SOURCE_DIR}/include/projcl)
22

33
set(PROJCL_H
44
${PROJCL_HEADERS_DIR}/projcl.h
5-
5+
${PROJCL_HEADERS_DIR}/projcl_warp.h
6+
${PROJCL_HEADERS_DIR}/projcl_types.h
7+
68
)
79

810
set(PROJCL_C
@@ -14,7 +16,7 @@ set(PROJCL_C
1416
projcl_util.c
1517
projcl_util.h
1618
projcl_warp.c
17-
projcl_warp.h
19+
1820
projcl.c
1921
)
2022

@@ -25,10 +27,6 @@ set(PROJCL_SOURCES
2527
${PROJCL_H}
2628
${PROJCL_C})
2729

28-
set (APPS_CPP_DEPENDENCIES "" CACHE INTERNAL "libraries to link")
29-
30-
add_library(projcl SHARED ${PROJCL_SOURCES})
31-
target_link_libraries(projcl ${OPENCL_LIBRARIES})
32-
target_link_libraries(projcl ${PROJ4_LIBRARIES})
33-
target_link_libraries(projcl ${BLAS_LIBRARIES})
30+
add_library(${PROJCL_LIBRARY} SHARED ${PROJCL_SOURCES})
31+
target_link_libraries(${PROJCL_LIBRARY} ${PROJCL_DEPENDENT_LIBRARIES})
3432

src/projcl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
#import <projcl/projcl.h>
12-
#include "projcl_warp.h"
12+
#include <projcl/projcl_warp.h>
1313

1414
#include <dirent.h>
1515
#include <stdlib.h>

src/projcl_warp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import <projcl/projcl.h>
10-
#include "projcl_warp.h"
10+
#include <projcl/projcl_warp.h>
1111
#include "projcl_util.h"
1212
#include "projcl_run.h"
1313
#include <stdlib.h>

test/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include_directories(../include)
2+
set(PROJCL_TEST projcl_test)
3+
set(PROJCL_TEST_SOURCES projcl_test.c)
4+
add_executable(projcl_test ${PROJCL_TEST_SOURCES})
5+
target_link_libraries(${PROJCL_TEST} ${PROJCL_LIBRARY} ${PROJCL_DEPENDENT_LIBRARIES} )

test/projcl_test.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
#include <OpenCL/OpenCL.h>
77
#include <sys/time.h>
8-
#include "../src/projcl.h"
9-
#include "../src/projcl_warp.h"
8+
#include <projcl/projcl.h>
9+
#include <projcl/projcl_warp.h>
1010

1111
#ifdef HAVE_PROJ4
1212
#include <proj_api.h>

0 commit comments

Comments
 (0)