2021-06-23 01:37:29 +03:00
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
if ( NOT DEFINED CMAKE_MINIMUM_REQUIRED_VERSION )
cmake_minimum_required ( VERSION 3.18 )
endif ( )
2021-06-23 01:43:23 +03:00
# canon way of using sf_c_util from another repo is below. It assumes the using repo has placed sf-c-util in "deps"
2021-06-23 01:37:29 +03:00
2021-06-23 01:43:23 +03:00
#if ((NOT TARGET sf_c_util) AND (EXISTS ${CMAKE_CURRENT_LIST_DIR}/deps/sf-c-util/CMakeLists.txt))
# add_subdirectory(deps/sf-c-util)
2022-09-29 19:54:08 +03:00
# include_directories(deps/sf-c-util/inc)
2022-06-22 01:16:20 +03:00
#endif()
2021-06-23 01:37:29 +03:00
2021-06-23 01:43:23 +03:00
if ( TARGET sf_c_util )
2021-06-23 01:37:29 +03:00
RETURN ( )
endif ( )
2021-06-23 01:43:23 +03:00
project ( sf_c_util )
2021-06-23 01:37:29 +03:00
#the following variables are project-wide and can be used with cmake-gui
option ( run_unittests "set run_unittests to ON to run unittests (default is OFF)" OFF )
option ( run_e2e_tests "set run_e2e_tests to ON to run e2e tests (default is OFF). Chsare dutility does not have any e2e tests, but the option needs to exist to evaluate in IF statements" OFF )
option ( run_int_tests "set run_int_tests to ON to integration tests (default is OFF)." OFF )
option ( run_perf_tests "set run_perf_tests to ON to build performance tests (default is OFF)." OFF )
2021-10-21 21:48:15 +03:00
option ( run_reals_check "set run_reals_check to ON to run reals check (default is OFF)." OFF )
2021-06-23 01:37:29 +03:00
option ( use_cppunittest "set use_cppunittest to ON to build CppUnitTest tests on Windows (default is OFF)" OFF )
option ( run_traceability "run traceability tool (default is ON)" ON )
#bring in dependencies
#do not add or build any tests of the dependencies
set ( original_run_e2e_tests ${ run_e2e_tests } )
set ( original_run_int_tests ${ run_int_tests } )
set ( original_run_perf_tests ${ run_perf_tests } )
set ( original_run_unittests ${ run_unittests } )
set ( original_run_traceability ${ run_traceability } )
2021-10-21 21:48:15 +03:00
set ( original_run_reals_check ${ run_reals_check } )
2021-06-23 01:37:29 +03:00
set ( run_e2e_tests OFF )
set ( run_int_tests OFF )
set ( run_perf_tests OFF )
set ( run_unittests OFF )
set ( run_traceability OFF )
2021-10-21 21:48:15 +03:00
set ( run_reals_check OFF )
2021-06-23 01:37:29 +03:00
if ( ( NOT TARGET c_build_tools ) AND ( EXISTS ${ CMAKE_CURRENT_LIST_DIR } /deps/c-build-tools/CMakeLists.txt ) )
add_subdirectory ( deps/c-build-tools )
set_default_build_options ( )
endif ( )
2024-03-14 01:26:18 +03:00
if ( ( WIN32 ) AND ( "${GBALLOC_LL_TYPE}" STREQUAL "JEMALLOC" ) )
# Bring in vcpkg
use_vcpkg ( ${ CMAKE_CURRENT_LIST_DIR } /deps/vcpkg )
endif ( )
2021-06-23 01:37:29 +03:00
if ( ( NOT TARGET macro_utils_c ) AND ( EXISTS ${ CMAKE_CURRENT_LIST_DIR } /deps/macro-utils-c/CMakeLists.txt ) )
add_subdirectory ( deps/macro-utils-c )
include_directories ( ${ MACRO_UTILS_INC_FOLDER } )
endif ( )
if ( ( NOT TARGET c_logging ) AND ( EXISTS ${ CMAKE_CURRENT_LIST_DIR } /deps/c-logging/CMakeLists.txt ) )
add_subdirectory ( deps/c-logging )
2023-06-29 03:34:03 +03:00
include_directories ( deps/c-logging/v2/inc )
2021-06-23 01:37:29 +03:00
endif ( )
if ( ( NOT TARGET ctest ) AND ( EXISTS ${ CMAKE_CURRENT_LIST_DIR } /deps/ctest/CMakeLists.txt ) )
add_subdirectory ( deps/ctest )
include_directories ( ${ CTEST_INC_FOLDER } )
endif ( )
if ( ( NOT TARGET testrunnerswitcher ) AND ( EXISTS ${ CMAKE_CURRENT_LIST_DIR } /deps/c-testrunnerswitcher/CMakeLists.txt ) )
add_subdirectory ( deps/c-testrunnerswitcher )
include_directories ( ${ TESTRUNNERSWITCHER_INC_FOLDER } )
endif ( )
if ( ( NOT TARGET umock_c ) AND ( EXISTS ${ CMAKE_CURRENT_LIST_DIR } /deps/umock-c/CMakeLists.txt ) )
add_subdirectory ( deps/umock-c )
include_directories ( ${ UMOCK_C_INC_FOLDER } )
endif ( )
if ( ( NOT TARGET c_pal ) AND ( EXISTS ${ CMAKE_CURRENT_LIST_DIR } /deps/c-pal/CMakeLists.txt ) )
add_subdirectory ( deps/c-pal )
include_directories ( ${ C_PAL_INC_FOLDER } )
endif ( )
2021-06-23 02:45:15 +03:00
if ( ( NOT TARGET c_util ) AND ( EXISTS ${ CMAKE_CURRENT_LIST_DIR } /deps/c-util/CMakeLists.txt ) )
add_subdirectory ( deps/c-util )
include_directories ( ${ C_UTIL_INC_FOLDER } )
endif ( )
2021-06-23 01:37:29 +03:00
if ( ( NOT TARGET com_wrapper ) AND ( EXISTS ${ CMAKE_CURRENT_LIST_DIR } /deps/com-wrapper/CMakeLists.txt ) )
add_subdirectory ( deps/com-wrapper )
endif ( )
set ( run_e2e_tests ${ original_run_e2e_tests } )
set ( run_int_tests ${ original_run_int_tests } )
set ( run_perf_tests ${ original_run_perf_tests } )
set ( run_unittests ${ original_run_unittests } )
set ( run_traceability ${ original_run_traceability } )
2021-10-21 21:48:15 +03:00
set ( run_reals_check ${ original_run_reals_check } )
2021-06-23 01:37:29 +03:00
2021-06-23 01:49:51 +03:00
add_subdirectory ( deps/servicefabric )
2022-06-22 01:16:20 +03:00
if ( ( CMAKE_GENERATOR MATCHES "Visual Studio" ) AND ( ${ run_traceability } ) )
#add traceability custom target
add_custom_target ( sf_c_util_traceability ALL
C O M M A N D t r a c e a b i l i t y t o o l - b u i l d c h e c k - e $ { C M A K E _ C U R R E N T _ L I S T _ D I R } / d e p s - i $ { C M A K E _ C U R R E N T _ L I S T _ D I R } )
add_dependencies ( sf_c_util_traceability traceabilitytool )
endif ( )
2021-06-23 01:43:23 +03:00
set ( sf_c_util_h_files
2021-06-23 06:23:43 +03:00
i n c / s f _ c _ u t i l / c o n f i g u r a t i o n _ r e a d e r . h
i n c / s f _ c _ u t i l / f a b r i c _ a s y n c _ o p _ c b . h
i n c / s f _ c _ u t i l / f a b r i c _ a s y n c _ o p _ c b _ c o m . h
i n c / s f _ c _ u t i l / f a b r i c _ a s y n c _ o p _ w r a p p e r . h
i n c / s f _ c _ u t i l / f a b r i c _ a s y n c _ o p _ s y n c _ w r a p p e r . h
i n c / s f _ c _ u t i l / f a b r i c _ o p _ c o m p l e t e d _ s y n c _ c t x . h
i n c / s f _ c _ u t i l / f a b r i c _ o p _ c o m p l e t e d _ s y n c _ c t x _ c o m . h
i n c / s f _ c _ u t i l / f a b r i c _ s t r i n g _ r e s u l t . h
i n c / s f _ c _ u t i l / f a b r i c _ s t r i n g _ r e s u l t _ c o m . h
i n c / s f _ c _ u t i l / h r e s u l t _ t o _ s t r i n g . h
i n c / s f _ c _ u t i l / s e r v i c e f a b r i c _ e n u m s _ t o _ s t r i n g s . h
2022-06-22 01:16:20 +03:00
i n c / s f _ c _ u t i l / s f _ s e r v i c e _ c o n f i g . h
2022-10-28 20:14:34 +03:00
i n c / s f _ c _ u t i l / c o m m o n _ a r g c _ a r g v . h
2022-10-30 04:13:24 +03:00
i n c / s f _ c _ u t i l / f c _ p a r a m e t e r _ a r g c _ a r g v . h
i n c / s f _ c _ u t i l / f c _ p a r a m e t e r _ l i s t _ a r g c _ a r g v . h
i n c / s f _ c _ u t i l / f c _ s e c t i o n _ a r g c _ a r g v . h
2022-10-30 21:45:37 +03:00
i n c / s f _ c _ u t i l / f c _ s e c t i o n _ l i s t _ a r g c _ a r g v . h
2022-10-31 23:25:38 +03:00
i n c / s f _ c _ u t i l / f c _ p a c k a g e _ c o m . h
i n c / s f _ c _ u t i l / f c _ p a c k a g e . h
2022-11-01 03:56:35 +03:00
i n c / s f _ c _ u t i l / f c _ a c t i v a t i o n _ c o n t e x t _ c o m . h
i n c / s f _ c _ u t i l / f c _ a c t i v a t i o n _ c o n t e x t . h
2022-11-02 21:06:11 +03:00
i n c / s f _ c _ u t i l / f a b r i c _ s t r i n g _ l i s t _ r e s u l t . h
i n c / s f _ c _ u t i l / f a b r i c _ s t r i n g _ l i s t _ r e s u l t _ c o m . h
2022-11-03 20:44:24 +03:00
i n c / s f _ c _ u t i l / f c _ e r d _ a r g c _ a r g v . h
2022-11-04 00:29:30 +03:00
i n c / s f _ c _ u t i l / f c _ e r d l _ a r g c _ a r g v . h
2021-06-23 01:37:29 +03:00
)
2021-06-23 01:43:23 +03:00
set ( sf_c_util_c_files
2021-06-23 01:37:29 +03:00
s r c / c o n f i g u r a t i o n _ r e a d e r . c
s r c / f a b r i c _ a s y n c _ o p _ c b . c
s r c / f a b r i c _ a s y n c _ o p _ c b _ c o m . c
s r c / f a b r i c _ o p _ c o m p l e t e d _ s y n c _ c t x . c
s r c / f a b r i c _ o p _ c o m p l e t e d _ s y n c _ c t x _ c o m . c
s r c / f a b r i c _ s t r i n g _ r e s u l t . c
s r c / f a b r i c _ s t r i n g _ r e s u l t _ c o m . c
2021-06-23 03:06:12 +03:00
s r c / h r e s u l t _ t o _ s t r i n g . c
s r c / s e r v i c e f a b r i c _ e n u m s _ t o _ s t r i n g s . c
2022-10-30 04:13:24 +03:00
s r c / f c _ p a r a m e t e r _ a r g c _ a r g v . c
s r c / f c _ p a r a m e t e r _ l i s t _ a r g c _ a r g v . c
2022-10-28 20:14:34 +03:00
s r c / c o m m o n _ a r g c _ a r g v . c
2022-10-30 04:13:24 +03:00
s r c / f c _ s e c t i o n _ a r g c _ a r g v . c
2022-10-30 21:45:37 +03:00
s r c / f c _ s e c t i o n _ l i s t _ a r g c _ a r g v . c
2022-10-31 23:25:38 +03:00
s r c / f c _ p a c k a g e _ c o m . c
s r c / f c _ p a c k a g e . c
2022-11-01 03:56:35 +03:00
s r c / f c _ a c t i v a t i o n _ c o n t e x t _ c o m . c
s r c / f c _ a c t i v a t i o n _ c o n t e x t . c
2022-11-02 21:06:11 +03:00
s r c / f a b r i c _ s t r i n g _ l i s t _ r e s u l t . c
s r c / f a b r i c _ s t r i n g _ l i s t _ r e s u l t _ c o m . c
2022-11-03 20:44:24 +03:00
s r c / f c _ e r d _ a r g c _ a r g v . c
2022-11-04 00:29:30 +03:00
s r c / f c _ e r d l _ a r g c _ a r g v . c
2021-06-23 01:37:29 +03:00
)
include_directories ( ${ CMAKE_CURRENT_LIST_DIR } /inc )
2021-06-23 02:49:42 +03:00
include_directories ( ${ CMAKE_CURRENT_LIST_DIR } /deps/servicefabric/inc )
2021-06-23 01:37:29 +03:00
2021-06-23 01:43:23 +03:00
FILE ( GLOB sf_c_util_md_files "devdoc/*.md" )
SOURCE_GROUP ( devdoc FILES ${ sf_c_util_md_files } )
2021-06-23 01:37:29 +03:00
2021-06-23 01:43:23 +03:00
add_library ( sf_c_util ${ sf_c_util_h_files } ${ sf_c_util_c_files } ${ sf_c_util_md_files } )
target_include_directories ( sf_c_util PUBLIC ${ CMAKE_CURRENT_LIST_DIR } /inc )
2023-06-29 03:34:03 +03:00
target_link_libraries ( sf_c_util c_logging_v2 c_pal com_wrapper c_util )
2021-06-23 01:37:29 +03:00
2021-08-02 08:28:16 +03:00
add_subdirectory ( sfwrapper )
2021-06-23 01:37:29 +03:00
add_subdirectory ( tests )
2021-10-21 21:48:15 +03:00
if ( ${ run_reals_check } )
add_reals_check_target ( )
endif ( )