Skip to content

Commit

Permalink
CMake building of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Aug 31, 2013
1 parent 141ae41 commit 1baee09
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 47 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ CTestTestfile.cmake
Makefile
cmake_install.cmake
*.dylib
Testing

test/projcl_test
obj/
28 changes: 4 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ endif(APPLE)



set(WITH_PROJ FALSE CACHE BOOL "Choose if GDAL support should be built")
set(WITH_PROJ FALSE CACHE BOOL "Choose if Proj support should be built")
set(PROJCL_LIBRARY projcl)

find_package(Proj4 4.8.0)
set(PROJCL_HAVE_PROJ 1)
Expand All @@ -171,31 +172,10 @@ find_package(OpenCL)
find_package(Blas)


set(PROJCL_DEPENDENT_LIBRARIES ${OPENCL_LIBRARIES} ${PROJ4_LIBRARIES} ${BLAS_LIBRARIES})
add_subdirectory(src)

if(WITH_TESTS)
message(STATUS "Building with PDAL unit tests")
enable_testing()

if(ENABLE_CTEST)
message(STATUS
"Enable CTest to support submissions of results to CDash at http://cdash.org")
cmake_minimum_required(VERSION 2.8.0)
# Dashboard has been prepared for experiments
# http://my.cdash.org/index.php?project=PDAL
include(CTest)
message(STATUS
"Enable CTest to support submissions of results to CDash at http://cdash.org - done")
endif()

add_subdirectory(test)
else()
if(ENABLE_CTEST)
message(WARNING
"CTest support requested but WITH_TESTS option not specified to build of PDAL unit tests")
endif()
endif()

add_subdirectory(test)



Expand Down
25 changes: 14 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ rebuild_cache:
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast

# Special rule for the target test
test:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..."
/usr/local/Cellar/cmake/2.8.11.2/bin/ctest --force-new-ctest-process $(ARGS)
.PHONY : test

# Special rule for the target test
test/fast: test
.PHONY : test/fast

# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /Users/hobu/dev/git/ProjCL/CMakeFiles /Users/hobu/dev/git/ProjCL/CMakeFiles/progress.marks
Expand Down Expand Up @@ -124,6 +114,19 @@ projcl/fast:
$(MAKE) -f src/CMakeFiles/projcl.dir/build.make src/CMakeFiles/projcl.dir/build
.PHONY : projcl/fast

#=============================================================================
# Target rules for targets named projcl_test

# Build rule for target.
projcl_test: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 projcl_test
.PHONY : projcl_test

# fast build rule for target.
projcl_test/fast:
$(MAKE) -f test/CMakeFiles/projcl_test.dir/build.make test/CMakeFiles/projcl_test.dir/build
.PHONY : projcl_test/fast

# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
Expand All @@ -132,8 +135,8 @@ help:
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... test"
@echo "... projcl"
@echo "... projcl_test"
.PHONY : help


Expand Down
File renamed without changes.
14 changes: 6 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ set(PROJCL_HEADERS_DIR ${PROJECT_SOURCE_DIR}/include/projcl)

set(PROJCL_H
${PROJCL_HEADERS_DIR}/projcl.h

${PROJCL_HEADERS_DIR}/projcl_warp.h
${PROJCL_HEADERS_DIR}/projcl_types.h

)

set(PROJCL_C
Expand All @@ -14,7 +16,7 @@ set(PROJCL_C
projcl_util.c
projcl_util.h
projcl_warp.c
projcl_warp.h

projcl.c
)

Expand All @@ -25,10 +27,6 @@ set(PROJCL_SOURCES
${PROJCL_H}
${PROJCL_C})

set (APPS_CPP_DEPENDENCIES "" CACHE INTERNAL "libraries to link")

add_library(projcl SHARED ${PROJCL_SOURCES})
target_link_libraries(projcl ${OPENCL_LIBRARIES})
target_link_libraries(projcl ${PROJ4_LIBRARIES})
target_link_libraries(projcl ${BLAS_LIBRARIES})
add_library(${PROJCL_LIBRARY} SHARED ${PROJCL_SOURCES})
target_link_libraries(${PROJCL_LIBRARY} ${PROJCL_DEPENDENT_LIBRARIES})

2 changes: 1 addition & 1 deletion src/projcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


#import <projcl/projcl.h>
#include "projcl_warp.h"
#include <projcl/projcl_warp.h>

#include <dirent.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion src/projcl_warp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import <projcl/projcl.h>
#include "projcl_warp.h"
#include <projcl/projcl_warp.h>
#include "projcl_util.h"
#include "projcl_run.h"
#include <stdlib.h>
Expand Down
5 changes: 5 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include_directories(../include)
set(PROJCL_TEST projcl_test)
set(PROJCL_TEST_SOURCES projcl_test.c)
add_executable(projcl_test ${PROJCL_TEST_SOURCES})
target_link_libraries(${PROJCL_TEST} ${PROJCL_LIBRARY} ${PROJCL_DEPENDENT_LIBRARIES} )
4 changes: 2 additions & 2 deletions test/projcl_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

#include <OpenCL/OpenCL.h>
#include <sys/time.h>
#include "../src/projcl.h"
#include "../src/projcl_warp.h"
#include <projcl/projcl.h>
#include <projcl/projcl_warp.h>

#ifdef HAVE_PROJ4
#include <proj_api.h>
Expand Down

0 comments on commit 1baee09

Please sign in to comment.