skip examples which need GUI when DLIB_NO_GUI_SUPPORT is defined

This commit is contained in:
Xi Deng 2016-10-01 18:49:57 -07:00
parent 2ed907aa99
commit ea20f5e2ca

View File

@ -29,22 +29,31 @@ MACRO(add_example name)
TARGET_LINK_LIBRARIES(${name} dlib ) TARGET_LINK_LIBRARIES(${name} dlib )
ENDMACRO() ENDMACRO()
# if an example requires GUI, call this macro to check DLIB_NO_GUI_SUPPORT to include or exclude
MACRO(add_gui_example name)
if (DLIB_NO_GUI_SUPPORT)
message("No GUI support, so we won't build the ${name} example.")
else()
add_example(${name})
endif()
ENDMACRO()
# The deep learning toolkit requires a C++11 capable compiler. # The deep learning toolkit requires a C++11 capable compiler.
if (COMPILER_CAN_DO_CPP_11) if (COMPILER_CAN_DO_CPP_11)
add_example(dnn_introduction_ex) add_example(dnn_introduction_ex)
add_example(dnn_introduction2_ex) add_example(dnn_introduction2_ex)
add_example(dnn_inception_ex) add_example(dnn_inception_ex)
add_example(dnn_imagenet_ex) add_gui_example(dnn_imagenet_ex)
add_example(dnn_imagenet_train_ex) add_example(dnn_imagenet_train_ex)
add_example(dnn_mmod_ex) add_gui_example(dnn_mmod_ex)
add_example(random_cropper_ex) add_gui_example(random_cropper_ex)
endif() endif()
#here we apply our macros #here we apply our macros
add_example(3d_point_cloud_ex) add_gui_example(3d_point_cloud_ex)
add_example(bayes_net_ex) add_example(bayes_net_ex)
add_example(bayes_net_from_disk_ex) add_example(bayes_net_from_disk_ex)
add_example(bayes_net_gui_ex) add_gui_example(bayes_net_gui_ex)
add_example(bridge_ex) add_example(bridge_ex)
add_example(bsp_ex) add_example(bsp_ex)
add_example(compress_stream_ex) add_example(compress_stream_ex)
@ -52,15 +61,15 @@ add_example(config_reader_ex)
add_example(custom_trainer_ex) add_example(custom_trainer_ex)
add_example(dir_nav_ex) add_example(dir_nav_ex)
add_example(empirical_kernel_map_ex) add_example(empirical_kernel_map_ex)
add_example(face_detection_ex) add_gui_example(face_detection_ex)
add_example(face_landmark_detection_ex) add_gui_example(face_landmark_detection_ex)
add_example(fhog_ex) add_gui_example(fhog_ex)
add_example(fhog_object_detector_ex) add_gui_example(fhog_object_detector_ex)
add_example(file_to_code_ex) add_example(file_to_code_ex)
add_example(graph_labeling_ex) add_example(graph_labeling_ex)
add_example(gui_api_ex) add_gui_example(gui_api_ex)
add_example(hough_transform_ex) add_gui_example(hough_transform_ex)
add_example(image_ex) add_gui_example(image_ex)
add_example(integrate_function_adapt_simp_ex) add_example(integrate_function_adapt_simp_ex)
add_example(iosockstream_ex) add_example(iosockstream_ex)
add_example(kcentroid_ex) add_example(kcentroid_ex)
@ -81,12 +90,12 @@ add_example(max_cost_assignment_ex)
add_example(member_function_pointer_ex) add_example(member_function_pointer_ex)
add_example(mlp_ex) add_example(mlp_ex)
add_example(model_selection_ex) add_example(model_selection_ex)
add_example(mpc_ex) add_gui_example(mpc_ex)
add_example(multiclass_classification_ex) add_example(multiclass_classification_ex)
add_example(multithreaded_object_ex) add_example(multithreaded_object_ex)
add_example(object_detector_advanced_ex) add_gui_example(object_detector_advanced_ex)
add_example(object_detector_ex) add_gui_example(object_detector_ex)
add_example(one_class_classifiers_ex) add_gui_example(one_class_classifiers_ex)
add_example(optimization_ex) add_example(optimization_ex)
add_example(parallel_for_ex) add_example(parallel_for_ex)
add_example(pipe_ex) add_example(pipe_ex)
@ -104,7 +113,7 @@ add_example(server_iostream_ex)
add_example(sockets_ex) add_example(sockets_ex)
add_example(sockstreambuf_ex) add_example(sockstreambuf_ex)
add_example(std_allocator_ex) add_example(std_allocator_ex)
add_example(surf_ex) add_gui_example(surf_ex)
add_example(svm_c_ex) add_example(svm_c_ex)
add_example(svm_ex) add_example(svm_ex)
add_example(svm_pegasos_ex) add_example(svm_pegasos_ex)
@ -117,21 +126,25 @@ add_example(thread_pool_ex)
add_example(threaded_object_ex) add_example(threaded_object_ex)
add_example(threads_ex) add_example(threads_ex)
add_example(timer_ex) add_example(timer_ex)
add_example(train_object_detector) add_gui_example(train_object_detector)
add_example(train_shape_predictor_ex) add_example(train_shape_predictor_ex)
add_example(using_custom_kernels_ex) add_example(using_custom_kernels_ex)
add_example(video_tracking_ex) add_gui_example(video_tracking_ex)
add_example(xml_parser_ex) add_example(xml_parser_ex)
find_package(OpenCV QUIET) if (DLIB_NO_GUI_SUPPORT)
if (OpenCV_FOUND) message("No GUI support, so we won't build the webcam_face_pose_ex example.")
include_directories(${OpenCV_INCLUDE_DIRS})
ADD_EXECUTABLE(webcam_face_pose_ex webcam_face_pose_ex.cpp)
TARGET_LINK_LIBRARIES(webcam_face_pose_ex dlib ${OpenCV_LIBS} )
else() else()
message("OpenCV not found, so we won't build the webcam_face_pose_ex example.") find_package(OpenCV QUIET)
if (OpenCV_FOUND)
include_directories(${OpenCV_INCLUDE_DIRS})
ADD_EXECUTABLE(webcam_face_pose_ex webcam_face_pose_ex.cpp)
TARGET_LINK_LIBRARIES(webcam_face_pose_ex dlib ${OpenCV_LIBS} )
else()
message("OpenCV not found, so we won't build the webcam_face_pose_ex example.")
endif()
endif() endif()