|
|
@@ -1,73 +1,68 @@
|
|
|
-add_definitions(-DHV_SOURCE=1)
|
|
|
+list(APPEND EXAMPLES
|
|
|
+ hmain_test
|
|
|
+ hloop_test
|
|
|
+ htimer_test
|
|
|
+ tcp
|
|
|
+ udp
|
|
|
+ nc
|
|
|
+ nmap
|
|
|
+)
|
|
|
|
|
|
-aux_source_directory(../base BASE_SRCS)
|
|
|
-aux_source_directory(../utils UTILS_SRCS)
|
|
|
-aux_source_directory(../event EVENT_SRCS)
|
|
|
-aux_source_directory(../http HTTP_SRCS)
|
|
|
-aux_source_directory(../http/client HTTP_CLIENT_SRCS)
|
|
|
-aux_source_directory(../http/server HTTP_SERVER_SRCS)
|
|
|
-aux_source_directory(../consul CONSUL_SRCS)
|
|
|
-aux_source_directory(httpd HTTPD_SRCS)
|
|
|
+include_directories(.. ../base ../event ../utils)
|
|
|
|
|
|
-add_executable(hmain_test hmain_test.cpp ${BASE_SRCS} ${UTILS_SRCS})
|
|
|
-target_include_directories(hmain_test PRIVATE .. ../base ../utils)
|
|
|
-target_link_libraries(hmain_test ${LIBS})
|
|
|
+add_executable(hmain_test hmain_test.cpp)
|
|
|
+target_link_libraries(hmain_test hv)
|
|
|
|
|
|
-add_executable(htimer_test htimer_test.c ${BASE_SRCS} ${EVENT_SRCS})
|
|
|
-target_include_directories(htimer_test PRIVATE .. ../base ../event)
|
|
|
-target_link_libraries(htimer_test ${LIBS})
|
|
|
+add_executable(hloop_test hloop_test.c)
|
|
|
+target_link_libraries(hloop_test hv)
|
|
|
|
|
|
-add_executable(hloop_test hloop_test.c ${BASE_SRCS} ${EVENT_SRCS})
|
|
|
-target_include_directories(hloop_test PRIVATE .. ../base ../event)
|
|
|
-target_link_libraries(hloop_test ${LIBS})
|
|
|
+add_executable(htimer_test htimer_test.c)
|
|
|
+target_link_libraries(htimer_test hv)
|
|
|
|
|
|
-add_executable(tcp tcp.c ${BASE_SRCS} ${EVENT_SRCS})
|
|
|
-target_include_directories(tcp PRIVATE .. ../base ../event)
|
|
|
-target_link_libraries(tcp ${LIBS})
|
|
|
+add_executable(tcp tcp.c)
|
|
|
+target_link_libraries(tcp hv)
|
|
|
|
|
|
-add_executable(udp udp.c ${BASE_SRCS} ${EVENT_SRCS})
|
|
|
-target_include_directories(udp PRIVATE .. ../base ../event)
|
|
|
-target_link_libraries(udp ${LIBS})
|
|
|
+add_executable(udp udp.c)
|
|
|
+target_link_libraries(udp hv)
|
|
|
|
|
|
-add_executable(nc nc.c ${BASE_SRCS} ${EVENT_SRCS})
|
|
|
-target_include_directories(nc PRIVATE .. ../base ../event)
|
|
|
-target_link_libraries(nc ${LIBS})
|
|
|
+add_executable(nc nc.c)
|
|
|
+target_link_libraries(nc hv)
|
|
|
|
|
|
-add_executable(nmap nmap.cpp ${BASE_SRCS} ${EVENT_SRCS})
|
|
|
+add_executable(nmap nmap.cpp)
|
|
|
target_compile_definitions(nmap PRIVATE -DPRINT_DEBUG)
|
|
|
-target_include_directories(nmap PRIVATE .. ../base ../event)
|
|
|
-target_link_libraries(nmap ${LIBS})
|
|
|
+target_link_libraries(nmap hv)
|
|
|
|
|
|
-add_executable(httpd ${BASE_SRCS} ${UTILS_SRCS} ${EVENT_SRCS} ${HTTP_SRCS} ${HTTP_SERVER_SRCS} ${HTTPD_SRCS})
|
|
|
-target_include_directories(httpd PRIVATE .. ../base ../utils ../event ../http ../http/server httpd)
|
|
|
-target_link_libraries(httpd ${LIBS})
|
|
|
+if(WITH_HTTP)
|
|
|
+ include_directories(../http)
|
|
|
+if(WITH_HTTP_SERVER)
|
|
|
+ include_directories(../http/server)
|
|
|
+ list(APPEND EXAMPLES httpd)
|
|
|
+ aux_source_directory(httpd HTTPD_SRCS)
|
|
|
+ add_executable(httpd ${HTTPD_SRCS})
|
|
|
+ target_link_libraries(httpd hv)
|
|
|
+endif()
|
|
|
|
|
|
-if(WITH_CURL)
|
|
|
- set(CURL_TARGET_NAME hv_curl)
|
|
|
-else()
|
|
|
+if(WITH_HTTP_CLIENT)
|
|
|
+ include_directories(../http/client)
|
|
|
set(CURL_TARGET_NAME curl)
|
|
|
+ if(WITH_CURL)
|
|
|
+ set(CURL_TARGET_NAME hv_curl)
|
|
|
+ endif()
|
|
|
+ list(APPEND EXAMPLES ${CURL_TARGET_NAME})
|
|
|
+ add_executable(${CURL_TARGET_NAME} curl.cpp)
|
|
|
+ if(WITH_CURL)
|
|
|
+ set_target_properties(${CURL_TARGET_NAME} PROPERTIES OUTPUT_NAME curl)
|
|
|
+ endif()
|
|
|
+ target_link_libraries(${CURL_TARGET_NAME} hv)
|
|
|
endif()
|
|
|
-add_executable(${CURL_TARGET_NAME} curl.cpp ${BASE_SRCS} ${UTILS_SRCS} ${HTTP_SRCS} ${HTTP_CLIENT_SRCS})
|
|
|
-if(WITH_CURL)
|
|
|
- set_target_properties(${CURL_TARGET_NAME} PROPERTIES OUTPUT_NAME curl)
|
|
|
-endif()
|
|
|
-target_include_directories(${CURL_TARGET_NAME} PRIVATE .. ../base ../utils ../http ../http/client)
|
|
|
-target_link_libraries(${CURL_TARGET_NAME} ${LIBS})
|
|
|
|
|
|
-add_executable(consul_cli consul_cli.cpp ${BASE_SRCS} ${UTILS_SRCS} ${HTTP_SRCS} ${HTTP_CLIENT_SRCS} ${CONSUL_SRCS})
|
|
|
-target_compile_definitions(consul_cli PRIVATE PRINT_DEBUG)
|
|
|
-target_include_directories(consul_cli PRIVATE .. ../base ../utils ../http ../http/client ../consul)
|
|
|
-target_link_libraries(consul_cli ${LIBS})
|
|
|
+if(WITH_CONSUL)
|
|
|
+ include_directories(../consul)
|
|
|
+ list(APPEND EXAMPLES consul_cli)
|
|
|
+ add_executable(consul_cli consul_cli.cpp)
|
|
|
+ target_compile_definitions(consul_cli PRIVATE PRINT_DEBUG)
|
|
|
+ target_link_libraries(consul_cli hv)
|
|
|
+endif()
|
|
|
+endif()
|
|
|
|
|
|
-add_custom_target(examples DEPENDS
|
|
|
- hmain_test
|
|
|
- htimer_test
|
|
|
- hloop_test
|
|
|
- tcp
|
|
|
- udp
|
|
|
- nc
|
|
|
- nmap
|
|
|
- httpd
|
|
|
- ${CURL_TARGET_NAME}
|
|
|
- consul_cli
|
|
|
-)
|
|
|
+add_custom_target(examples DEPENDS ${EXAMPLES})
|