2008-05-02 22:19:38 +08:00
|
|
|
#
|
2017-03-24 21:15:43 +08:00
|
|
|
# _______ _ _ _____ _____ _____ _____
|
|
|
|
# |__ __| | | |_ _|/ ____| |_ _|/ ____| /\
|
|
|
|
# | | | |__| | | | | (___ | | | (___ / \
|
|
|
|
# | | | __ | | | \___ \ | | \___ \ / /\ \
|
|
|
|
# | | | | | |_| |_ ____) | _| |_ ____) | / ____ \
|
|
|
|
# |_|__|_|_ |_|_____|_____/__ |_____|_____/ /_/ _ \_\
|
|
|
|
# |__ __| | | |__ __/ __ \| __ \|_ _| /\ | |
|
|
|
|
# | | | | | | | | | | | | |__) | | | / \ | |
|
|
|
|
# | | | | | | | | | | | | _ / | | / /\ \ | |
|
|
|
|
# | | | |__| | | | | |__| | | \ \ _| |_ / ____ \| |____
|
|
|
|
# |_| \____/ |_| \____/|_| \_\_____/_/ \_\______|
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# _____ ______ _____ _______ _ _ ______
|
|
|
|
# | __ \| ____| /\ | __ \ |__ __| | | | ____|
|
|
|
|
# | |__) | |__ / \ | | | | | | | |__| | |__
|
|
|
|
# | _ /| __| / /\ \ | | | | | | | __ | __|
|
|
|
|
# | | \ \| |____ / ____ \| |__| | | | | | | | |____
|
|
|
|
# |_|__\_\______/_/_ __\_\_____/__ _ |_|__|_|_ |_|______|_ _ _
|
|
|
|
# / ____/ __ \| \/ | \/ | ____| \ | |__ __/ ____| | | | | |
|
|
|
|
# | | | | | | \ / | \ / | |__ | \| | | | | (___ | | | | |
|
|
|
|
# | | | | | | |\/| | |\/| | __| | . ` | | | \___ \ | | | | |
|
|
|
|
# | |___| |__| | | | | | | | |____| |\ | | | ____) | |_|_|_|_|
|
|
|
|
# \_____\____/|_| |_|_| |_|______|_| \_| |_| |_____/ (_|_|_|_)
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This is a CMake makefile. CMake is a tool that helps you build C++ programs.
|
|
|
|
# You can download CMake from http://www.cmake.org. This CMakeLists.txt file
|
|
|
|
# you are reading builds dlib's example programs.
|
2008-05-02 22:19:38 +08:00
|
|
|
#
|
|
|
|
|
|
|
|
|
2022-08-01 05:45:18 +08:00
|
|
|
cmake_minimum_required(VERSION 3.8.0)
|
2017-03-24 21:15:43 +08:00
|
|
|
# Every project needs a name. We call this the "examples" project.
|
|
|
|
project(examples)
|
2010-07-26 00:04:37 +08:00
|
|
|
|
2008-05-02 22:19:38 +08:00
|
|
|
|
2017-03-24 21:15:43 +08:00
|
|
|
# Tell cmake we will need dlib. This command will pull in dlib and compile it
|
|
|
|
# into your project. Note that you don't need to compile or install dlib. All
|
2017-10-18 07:18:57 +08:00
|
|
|
# cmake needs is the dlib source code folder and it will take care of everything.
|
2017-10-17 08:55:28 +08:00
|
|
|
add_subdirectory(../dlib dlib_build)
|
2008-05-02 22:19:38 +08:00
|
|
|
|
2019-10-25 08:15:34 +08:00
|
|
|
# If you have cmake 3.14 or newer you can even use FetchContent instead of
|
2019-10-24 19:47:03 +08:00
|
|
|
# add_subdirectory() to pull in dlib as a dependency. So instead of using the
|
|
|
|
# above add_subdirectory() command, you could use the following three commands
|
|
|
|
# to make dlib available:
|
|
|
|
# include(FetchContent)
|
|
|
|
# FetchContent_Declare(dlib
|
|
|
|
# GIT_REPOSITORY https://github.com/davisking/dlib.git
|
2022-12-16 11:15:18 +08:00
|
|
|
# GIT_TAG v19.24
|
2019-10-24 19:47:03 +08:00
|
|
|
# )
|
|
|
|
# FetchContent_MakeAvailable(dlib)
|
|
|
|
|
2017-03-24 21:15:43 +08:00
|
|
|
|
|
|
|
# The next thing we need to do is tell CMake about the code you want to
|
|
|
|
# compile. We do this with the add_executable() statement which takes the name
|
|
|
|
# of the output executable and then a list of .cpp files to compile. Here we
|
|
|
|
# are going to compile one of the dlib example programs which has only one .cpp
|
|
|
|
# file, assignment_learning_ex.cpp. If your program consisted of multiple .cpp
|
|
|
|
# files you would simply list them here in the add_executable() statement.
|
|
|
|
add_executable(assignment_learning_ex assignment_learning_ex.cpp)
|
|
|
|
# Finally, you need to tell CMake that this program, assignment_learning_ex,
|
|
|
|
# depends on dlib. You do that with this statement:
|
|
|
|
target_link_libraries(assignment_learning_ex dlib::dlib)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# To compile this program all you need to do is ask cmake. You would type
|
|
|
|
# these commands from within the directory containing this CMakeLists.txt
|
|
|
|
# file:
|
|
|
|
# mkdir build
|
2017-05-01 08:48:51 +08:00
|
|
|
# cd build
|
2017-03-24 21:15:43 +08:00
|
|
|
# cmake ..
|
|
|
|
# cmake --build . --config Release
|
|
|
|
#
|
|
|
|
# The cmake .. command looks in the parent folder for a file named
|
2017-12-25 21:50:34 +08:00
|
|
|
# CMakeLists.txt, reads it, and sets up everything needed to build program.
|
|
|
|
# Also, note that CMake can generate Visual Studio or XCode project files. So
|
|
|
|
# if instead you had written:
|
|
|
|
# cd build
|
2017-12-17 12:17:37 +08:00
|
|
|
# cmake .. -G Xcode
|
2017-03-24 21:15:43 +08:00
|
|
|
#
|
2017-12-17 12:17:37 +08:00
|
|
|
# You would be able to open the resulting Xcode project and compile and edit
|
|
|
|
# the example programs within the Xcode IDE. CMake can generate a lot of
|
|
|
|
# different types of IDE projects. Run the cmake -h command to see a list of
|
|
|
|
# arguments to -G to see what kinds of projects cmake can generate for you. It
|
|
|
|
# probably includes your favorite IDE in the list.
|
2017-03-24 21:15:43 +08:00
|
|
|
|
|
|
|
|
2015-01-31 22:43:57 +08:00
|
|
|
|
|
|
|
|
2017-03-24 21:15:43 +08:00
|
|
|
#################################################################################
|
|
|
|
#################################################################################
|
|
|
|
# A CMakeLists.txt file can compile more than just one program. So below we
|
|
|
|
# tell it to compile the other dlib example programs using pretty much the
|
|
|
|
# same CMake commands we used above.
|
|
|
|
#################################################################################
|
|
|
|
#################################################################################
|
2015-01-31 22:43:57 +08:00
|
|
|
|
|
|
|
|
2017-12-11 19:40:00 +08:00
|
|
|
# Since there are a lot of examples I'm going to use a macro to simplify this
|
2015-01-31 22:43:57 +08:00
|
|
|
# CMakeLists.txt file. However, usually you will create only one executable in
|
|
|
|
# your cmake projects and use the syntax shown above.
|
2017-03-24 21:15:43 +08:00
|
|
|
macro(add_example name)
|
|
|
|
add_executable(${name} ${name}.cpp)
|
|
|
|
target_link_libraries(${name} dlib::dlib )
|
2023-03-24 08:07:48 +08:00
|
|
|
|
2023-03-26 03:56:54 +08:00
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
|
2023-03-24 08:07:48 +08:00
|
|
|
# And strip symbols to make your binary smaller if you like. Certainly not
|
|
|
|
# required though.
|
|
|
|
target_link_options(${name} PRIVATE $<$<CONFIG:RELEASE>:-s>)
|
|
|
|
endif()
|
2017-03-24 21:15:43 +08:00
|
|
|
endmacro()
|
2008-05-02 22:19:38 +08:00
|
|
|
|
2016-10-02 09:49:57 +08:00
|
|
|
# if an example requires GUI, call this macro to check DLIB_NO_GUI_SUPPORT to include or exclude
|
2017-03-24 21:15:43 +08:00
|
|
|
macro(add_gui_example name)
|
2016-10-02 09:49:57 +08:00
|
|
|
if (DLIB_NO_GUI_SUPPORT)
|
|
|
|
message("No GUI support, so we won't build the ${name} example.")
|
|
|
|
else()
|
|
|
|
add_example(${name})
|
|
|
|
endif()
|
2017-03-24 21:15:43 +08:00
|
|
|
endmacro()
|
2016-10-02 09:49:57 +08:00
|
|
|
|
2022-08-01 05:45:18 +08:00
|
|
|
add_example(dnn_metric_learning_ex)
|
|
|
|
add_gui_example(dnn_face_recognition_ex)
|
|
|
|
add_example(dnn_introduction_ex)
|
|
|
|
add_example(dnn_introduction2_ex)
|
|
|
|
add_example(dnn_introduction3_ex)
|
|
|
|
add_example(dnn_inception_ex)
|
|
|
|
add_gui_example(dnn_mmod_ex)
|
|
|
|
add_gui_example(dnn_mmod_face_detection_ex)
|
|
|
|
add_gui_example(random_cropper_ex)
|
|
|
|
add_gui_example(dnn_mmod_dog_hipsterizer)
|
|
|
|
add_gui_example(dnn_imagenet_ex)
|
|
|
|
add_gui_example(dnn_mmod_find_cars_ex)
|
|
|
|
add_gui_example(dnn_mmod_find_cars2_ex)
|
|
|
|
add_example(dnn_mmod_train_find_cars_ex)
|
|
|
|
add_gui_example(dnn_semantic_segmentation_ex)
|
|
|
|
add_gui_example(dnn_instance_segmentation_ex)
|
|
|
|
add_example(dnn_imagenet_train_ex)
|
|
|
|
add_example(dnn_semantic_segmentation_train_ex)
|
|
|
|
add_example(dnn_instance_segmentation_train_ex)
|
|
|
|
add_example(dnn_metric_learning_on_images_ex)
|
|
|
|
add_gui_example(dnn_dcgan_train_ex)
|
|
|
|
add_gui_example(dnn_yolo_train_ex)
|
|
|
|
add_gui_example(dnn_self_supervised_learning_ex)
|
2016-10-02 09:49:57 +08:00
|
|
|
add_gui_example(3d_point_cloud_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(bayes_net_ex)
|
|
|
|
add_example(bayes_net_from_disk_ex)
|
2016-10-02 09:49:57 +08:00
|
|
|
add_gui_example(bayes_net_gui_ex)
|
2011-05-15 02:09:06 +08:00
|
|
|
add_example(bridge_ex)
|
2012-10-22 07:22:42 +08:00
|
|
|
add_example(bsp_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(compress_stream_ex)
|
2009-05-31 02:01:38 +08:00
|
|
|
add_example(config_reader_ex)
|
2010-12-31 12:53:44 +08:00
|
|
|
add_example(custom_trainer_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(dir_nav_ex)
|
2010-01-04 10:42:59 +08:00
|
|
|
add_example(empirical_kernel_map_ex)
|
2016-10-02 09:49:57 +08:00
|
|
|
add_gui_example(face_detection_ex)
|
|
|
|
add_gui_example(face_landmark_detection_ex)
|
|
|
|
add_gui_example(fhog_ex)
|
|
|
|
add_gui_example(fhog_object_detector_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(file_to_code_ex)
|
2012-05-21 06:25:49 +08:00
|
|
|
add_example(graph_labeling_ex)
|
2016-10-02 09:49:57 +08:00
|
|
|
add_gui_example(gui_api_ex)
|
|
|
|
add_gui_example(hough_transform_ex)
|
|
|
|
add_gui_example(image_ex)
|
2013-05-25 09:42:40 +08:00
|
|
|
add_example(integrate_function_adapt_simp_ex)
|
2012-11-18 03:48:42 +08:00
|
|
|
add_example(iosockstream_ex)
|
2008-05-23 08:26:28 +08:00
|
|
|
add_example(kcentroid_ex)
|
2008-05-31 07:24:11 +08:00
|
|
|
add_example(kkmeans_ex)
|
2008-05-23 08:08:49 +08:00
|
|
|
add_example(krls_ex)
|
2008-06-14 21:32:12 +08:00
|
|
|
add_example(krls_filter_ex)
|
2010-07-24 08:38:22 +08:00
|
|
|
add_example(krr_classification_ex)
|
|
|
|
add_example(krr_regression_ex)
|
2014-02-21 11:39:48 +08:00
|
|
|
add_example(learning_to_track_ex)
|
2010-12-05 03:37:58 +08:00
|
|
|
add_example(least_squares_ex)
|
2010-05-13 10:46:17 +08:00
|
|
|
add_example(linear_manifold_regularizer_ex)
|
2014-04-27 05:32:06 +08:00
|
|
|
add_example(logger_custom_output_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(logger_ex)
|
|
|
|
add_example(logger_ex_2)
|
|
|
|
add_example(matrix_ex)
|
2010-07-19 03:57:34 +08:00
|
|
|
add_example(matrix_expressions_ex)
|
2014-12-08 01:11:13 +08:00
|
|
|
add_example(max_cost_assignment_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(member_function_pointer_ex)
|
|
|
|
add_example(mlp_ex)
|
2009-10-17 03:16:52 +08:00
|
|
|
add_example(model_selection_ex)
|
2016-10-02 09:49:57 +08:00
|
|
|
add_gui_example(mpc_ex)
|
2010-12-31 02:59:13 +08:00
|
|
|
add_example(multiclass_classification_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(multithreaded_object_ex)
|
2016-10-02 09:49:57 +08:00
|
|
|
add_gui_example(object_detector_advanced_ex)
|
|
|
|
add_gui_example(object_detector_ex)
|
|
|
|
add_gui_example(one_class_classifiers_ex)
|
2009-01-23 10:38:20 +08:00
|
|
|
add_example(optimization_ex)
|
2013-03-03 12:43:46 +08:00
|
|
|
add_example(parallel_for_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(pipe_ex)
|
2009-01-16 12:13:43 +08:00
|
|
|
add_example(pipe_ex_2)
|
2008-12-25 08:32:29 +08:00
|
|
|
add_example(quantum_computing_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(queue_ex)
|
2008-07-06 00:26:22 +08:00
|
|
|
add_example(rank_features_ex)
|
2013-05-25 09:42:40 +08:00
|
|
|
add_example(running_stats_ex)
|
2008-09-14 21:47:26 +08:00
|
|
|
add_example(rvm_ex)
|
2008-09-14 23:38:45 +08:00
|
|
|
add_example(rvm_regression_ex)
|
2011-11-03 10:40:18 +08:00
|
|
|
add_example(sequence_labeler_ex)
|
2013-06-04 09:26:56 +08:00
|
|
|
add_example(sequence_segmenter_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(server_http_ex)
|
2012-11-18 03:48:42 +08:00
|
|
|
add_example(server_iostream_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(sockets_ex)
|
|
|
|
add_example(sockstreambuf_ex)
|
|
|
|
add_example(std_allocator_ex)
|
2016-10-02 09:49:57 +08:00
|
|
|
add_gui_example(surf_ex)
|
2014-12-10 07:13:45 +08:00
|
|
|
add_example(svm_c_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(svm_ex)
|
2009-03-09 01:38:04 +08:00
|
|
|
add_example(svm_pegasos_ex)
|
2012-11-24 05:09:41 +08:00
|
|
|
add_example(svm_rank_ex)
|
2009-03-23 05:31:27 +08:00
|
|
|
add_example(svm_sparse_ex)
|
2013-08-09 07:07:50 +08:00
|
|
|
add_example(svm_struct_ex)
|
2010-12-31 22:17:51 +08:00
|
|
|
add_example(svr_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(thread_function_ex)
|
2008-11-06 12:13:03 +08:00
|
|
|
add_example(thread_pool_ex)
|
2014-12-10 07:13:45 +08:00
|
|
|
add_example(threaded_object_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(threads_ex)
|
|
|
|
add_example(timer_ex)
|
2016-10-02 09:49:57 +08:00
|
|
|
add_gui_example(train_object_detector)
|
2014-08-22 10:42:48 +08:00
|
|
|
add_example(train_shape_predictor_ex)
|
2011-06-04 10:15:14 +08:00
|
|
|
add_example(using_custom_kernels_ex)
|
2016-10-02 09:49:57 +08:00
|
|
|
add_gui_example(video_tracking_ex)
|
2008-05-02 22:19:38 +08:00
|
|
|
add_example(xml_parser_ex)
|
2014-11-16 00:39:26 +08:00
|
|
|
|
|
|
|
|
2015-01-28 12:40:53 +08:00
|
|
|
if (DLIB_LINK_WITH_SQLITE3)
|
|
|
|
add_example(sqlite_ex)
|
|
|
|
endif()
|
|
|
|
|
2023-01-30 09:17:34 +08:00
|
|
|
if (DLIB_USE_FFMPEG AND NOT DLIB_NO_GUI_SUPPORT)
|
|
|
|
add_example(ffmpeg_webcam_face_pose_ex)
|
2023-02-11 11:03:25 +08:00
|
|
|
add_example(ffmpeg_video_demuxing_ex)
|
2023-05-16 09:24:47 +08:00
|
|
|
add_example(ffmpeg_video_demuxing2_ex)
|
2023-02-11 11:03:25 +08:00
|
|
|
add_example(ffmpeg_video_decoding_ex)
|
2023-05-16 09:24:47 +08:00
|
|
|
add_example(ffmpeg_video_decoding2_ex)
|
2023-02-11 11:03:25 +08:00
|
|
|
add_example(ffmpeg_info_ex)
|
|
|
|
add_example(ffmpeg_screen_grab_ex)
|
2023-04-01 21:48:26 +08:00
|
|
|
add_example(ffmpeg_video_encoding_ex)
|
2023-04-09 02:45:30 +08:00
|
|
|
add_example(ffmpeg_video_muxing_ex)
|
2023-04-09 22:34:31 +08:00
|
|
|
add_example(ffmpeg_rtsp_ex)
|
2023-04-13 10:47:58 +08:00
|
|
|
add_example(ffmpeg_microphone_to_file_ex)
|
|
|
|
add_example(ffmpeg_file_to_speaker_ex)
|
2023-01-30 09:17:34 +08:00
|
|
|
endif()
|
|
|
|
|
2022-08-01 05:45:18 +08:00
|
|
|
if (DLIB_NO_GUI_SUPPORT)
|
|
|
|
message("No GUI support, so we won't build the webcam_face_pose_ex example.")
|
|
|
|
else()
|
|
|
|
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::dlib ${OpenCV_LIBS} )
|
|
|
|
else()
|
|
|
|
message("OpenCV not found, so we won't build the webcam_face_pose_ex example.")
|
|
|
|
endif()
|
2023-02-04 06:43:00 +08:00
|
|
|
endif()
|