From 0156b27b4778f037da30f633b875791d95ef6988 Mon Sep 17 00:00:00 2001 From: Misha Chornyi Date: Wed, 31 Jul 2024 13:54:37 -0700 Subject: [PATCH] 1. Disable target compilation for WIN32. 2. Removing non existing parameter '-Wno-unused-parameter'. .ref: https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html --- src/c++/library/CMakeLists.txt | 92 +++++++++++++++++----------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/src/c++/library/CMakeLists.txt b/src/c++/library/CMakeLists.txt index 7a62971e5..943671f04 100644 --- a/src/c++/library/CMakeLists.txt +++ b/src/c++/library/CMakeLists.txt @@ -75,7 +75,7 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER OR TRITON_ENABLE_EXAMPLE target_compile_options( ${_json_target} PRIVATE $<$,$,$>: - -Wall -Wextra -Wno-unused-parameter -Werror> + -Wall -Wextra -Werror> $<$:/W0 /D_WIN32_WINNT=0x0A00 /EHsc> ) @@ -126,55 +126,57 @@ target_link_libraries( client-common-library ) -add_library( - shm_utils_static STATIC - $ -) - -add_library( - TritonClient::shm_utils_static ALIAS shm_utils_static -) - -foreach(_shm_target shm-utils-library shm_utils_static) - target_compile_features(${_shm_target} PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) - target_compile_options( - ${_shm_target} PRIVATE - $<$,$,$>: - -Wall -Wextra -Wno-unused-parameter -Werror> - $<$:/W0 /D_WIN32_WINNT=0x0A00 /EHsc> +if(NOT WIN32) + add_library( + shm_utils_static STATIC + $ ) - set_target_properties( - ${_shm_target} - PROPERTIES - POSITION_INDEPENDENT_CODE ON + add_library( + TritonClient::shm_utils_static ALIAS shm_utils_static ) - target_include_directories( - ${_shm_target} - PUBLIC - $ - $ - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - ) + foreach(_shm_target shm-utils-library shm_utils_static) + target_compile_features(${_shm_target} PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) + target_compile_options( + ${_shm_target} PRIVATE + $<$,$,$>: + -Wall -Wextra -Werror> + $<$:/W0 /D_WIN32_WINNT=0x0A00 /EHsc> + ) + + set_target_properties( + ${_shm_target} + PROPERTIES + POSITION_INDEPENDENT_CODE ON + ) + + target_include_directories( + ${_shm_target} + PUBLIC + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/shm_utils.h + DESTINATION include + ) + endforeach() install( - FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shm_utils.h - DESTINATION include + TARGETS + shm_utils_static + EXPORT + triton-client-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -endforeach() - -install( - TARGETS - shm_utils_static - EXPORT - triton-client-targets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) +endif(NOT WIN32) if(TRITON_ENABLE_CC_GRPC OR TRITON_ENABLE_PERF_ANALYZER) # @@ -260,7 +262,7 @@ if(TRITON_ENABLE_CC_GRPC OR TRITON_ENABLE_PERF_ANALYZER) target_compile_options( ${_client_target} PRIVATE $<$,$,$>: - -Wall -Wextra -Wno-unused-parameter -Werror> + -Wall -Wextra -Werror> $<$:/W0 /D_WIN32_WINNT=0x0A00 /EHsc> ) @@ -443,7 +445,7 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER) target_compile_options( ${_client_target} PRIVATE $<$,$,$>: - -Wall -Wextra -Wno-unused-parameter -Werror> + -Wall -Wextra -Werror> $<$:/W0 /D_WIN32_WINNT=0x0A00 /EHsc> )