Skip to content

Commit

Permalink
rename examples to samples
Browse files Browse the repository at this point in the history
  • Loading branch information
weidonglian committed Aug 25, 2024
1 parent a15eb1d commit f94e86f
Show file tree
Hide file tree
Showing 27 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@ endif()

add_subdirectory(third_party)
add_subdirectory(logger)
add_subdirectory(examples)
add_subdirectory(samples)
add_subdirectory(algorithms)
55 changes: 0 additions & 55 deletions examples/CMakeLists.txt

This file was deleted.

55 changes: 55 additions & 0 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
function(add_sample)
cmake_parse_arguments(EXAM
""
"NAME"
"HDRS;SRCS;DEPS;DEFS"
${ARGN}
)

if(OpenMP_CXX_FOUND)
set(LINK_LIB_OPENMP OpenMP::OpenMP_CXX)
endif()

add_executable(${EXAM_NAME} ${EXAM_SRCS} ${EXAM_HDRS})
target_link_libraries(${EXAM_NAME} Threads::Threads ${EXAM_DEPS} ${LINK_LIB_OPENMP})
target_compile_definitions(${EXAM_NAME} PUBLIC ${EXAM_DEFS})

INSTALL(TARGETS ${EXAM_NAME} RUNTIME DESTINATION .)
add_test(NAME test-${EXAM_NAME} COMMAND ${EXAM_NAME})
endfunction()

# c++ types and semantic
add_sample(NAME type_erasure SRCS type_erasure.cpp)
add_sample(NAME objects_alignment SRCS objects_alignment.cpp)
add_sample(NAME func_over_load_ride_hide SRCS func_over_load_ride_hide.cpp)
add_sample(NAME floating_point_number SRCS floating_point_number.cpp)
add_sample(NAME unsigned_int_wrap SRCS unsigned_int_wrap.cpp)
add_sample(NAME ctor_dtor_throws SRCS ctor_dtor_throws.cpp)
add_sample(NAME rule_three_five_zero SRCS rule_three_five_zero.cpp)
add_sample(NAME construct_move_destroy SRCS construct_move_destroy.cpp)

# c++ libraries
add_sample(NAME time_duration_clock SRCS time_duration_clock.cpp)
add_sample(NAME steady_system_clock SRCS steady_system_clock.cpp)
add_sample(NAME lock_guard SRCS lock_guard.cpp)
add_sample(NAME stringstream_thread_safe SRCS stringstream_thread_safe.cpp)
add_sample(NAME time_generation SRCS time_generation.cpp)
add_sample(NAME file_system SRCS file_system.cpp)

# asio
add_sample(NAME asio_tcp_clients SRCS asio_tcp_clients.cpp DEPS asio)
add_sample(NAME asio_http_client SRCS asio_http_client.cpp DEPS asio)

# continuable
add_sample(NAME continuable_hello_world SRCS continuable_hello_world.cpp DEPS continuable)
add_sample(NAME continuable_asio SRCS continuable_asio.cpp DEPS logger continuable asio)

# c++ 20/23 goroutine and generator
add_sample(NAME coroutine_generator SRCS coroutine_generator.cpp DEPS libcoro)
add_sample(NAME coroutine_task SRCS coroutine_task.cpp DEPS libcoro)

# boost
add_sample(NAME fiber_shared_work SRCS fiber_shared_work.cpp DEPS Boost::boost Boost::fiber)

# parallelism
add_sample(NAME openmp_vs_std SRCS openmp_vs_std.cpp)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f94e86f

Please sign in to comment.