Skip to content

Commit

Permalink
cpu only build works
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Kosiorek authored and jeffdonahue committed Aug 17, 2014
1 parent edc493a commit f83407d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ endif()
### Configuration ###########################################################################

# Enable CTest from top build directory
enable_testing()
#disable ctest
#enable_testing()

# Compiler Flags
set(CMAKE_CXX_COMPILER_FLAGS ${CMAKE_CXX_COMPILER_FLAGS} -Wall)
Expand Down Expand Up @@ -60,6 +61,8 @@ add_subdirectory(tools)
if(BUILD_EXAMPLES)
message(STATUS "Examples enabled")
add_subdirectory(examples)
else()
set(Examples_SOURCE_DIR ${CMAKE_SOURCE_DIR}/examples)
endif()

if(BUILD_PYTHON)
Expand Down
1 change: 0 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ project( Examples )

file(GLOB_RECURSE Examples_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)

# message(${Examples_SOURCES})
foreach(source ${Examples_SOURCES})
# get file name
get_filename_component(name ${source} NAME_WE)
Expand Down
26 changes: 11 additions & 15 deletions src/caffe/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ foreach(in_file ${IN_FILES})

endforeach()


#configure_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/cmake_test_defines.hpp.in
# ${CMAKE_CURRENT_SOURCE_DIR}/cmake_test_defines.hpp.gen.cmake
#)
#
#configure_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/test_data/sample_data_list.txt.in
# ${CMAKE_CURRENT_SOURCE_DIR}/test_data/sample_data_list.txt.gen.cmake
#)

include_directories(
${Caffe_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
Expand All @@ -53,16 +42,23 @@ foreach(source ${TEST_SOURCES})
get_filename_component(name ${source} NAME_WE)
add_executable(${name}.test ${TEST_MAIN} ${source} ../blob.cpp)
target_link_libraries(${name}.test gtest caffe)
add_test(${name} ${name}.test)
#disable ctest
#add_test(${name} ${name}.test)

# output dir
set_target_properties(${name}.test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test)

endforeach()

add_executable(test_all.test ${TEST_SOURCES} ${TEST_MAIN})
target_link_libraries(test_all.test gtest caffe)
add_executable(test ${TEST_SOURCES} ${TEST_MAIN})
target_link_libraries(test gtest caffe)
# Test command
set(TEST_ARGS --gtest_shuffle)
if(CPU_ONLY)
set(TEST_ARGS ${TEST_ARGS} --gtest_filter="-*GPU*")
endif()
add_custom_command(TARGET test POSTBUILD COMMAND test ${TEST_ARGS})

# output dir
set_target_properties(test_all.test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test)
set_target_properties(test PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test)

0 comments on commit f83407d

Please sign in to comment.