@ -110,14 +110,12 @@ function(find_fluid_modules TARGET_NAME)
endif ( )
endfunction ( find_fluid_modules )
function ( common_link TARGET_NAME )
if ( WITH_PROFILER )
target_link_libraries ( ${ TARGET_NAME } gperftools::profiler )
endif ( )
endfunction ( )
# f i n d a l l t h i r d _ p a r t y m o d u l e s i s u s e d f o r p a d d l e s t a t i c l i b r a r y
# f o r r e d u c e t h e d e p e n d e n c y w h e n b u i l d i n g t h e i n f e r e n c e l i b s .
set_property ( GLOBAL PROPERTY FLUID_THIRD_PARTY )
@ -238,7 +236,7 @@ function(merge_static_libs TARGET_NAME)
endfunction ( merge_static_libs )
function ( cc_library TARGET_NAME )
set ( options STATIC static SHARED shared )
set ( options STATIC static SHARED shared INTERFACE interface )
set ( oneValueArgs "" )
set ( multiValueArgs SRCS DEPS )
cmake_parse_arguments ( cc_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ ARGN } )
@ -247,13 +245,16 @@ function(cc_library TARGET_NAME)
set ( ${ TARGET_NAME } _LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}${TARGET_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE STRING "output library name for target ${TARGET_NAME}" )
endif ( WIN32 )
if ( cc_library_SRCS )
if ( cc_library_SHARED OR cc_library_shared ) # b u i l d * . s o
add_library ( ${ TARGET_NAME } SHARED ${ cc_library_SRCS } )
else ( )
add_library ( ${ TARGET_NAME } STATIC ${ cc_library_SRCS } )
find_fluid_modules ( ${ TARGET_NAME } )
endif ( )
if ( cc_library_SHARED OR cc_library_shared ) # b u i l d * . s o
add_library ( ${ TARGET_NAME } SHARED ${ cc_library_SRCS } )
elseif ( cc_library_INTERFACE OR cc_library_interface )
set ( target_SRCS ${ CMAKE_CURRENT_BINARY_DIR } / ${ TARGET_NAME } _dummy.c )
file ( WRITE ${ target_SRCS } "const char *dummy_${TARGET_NAME} = \" ${ target_SRCS } \";")
add_library ( ${ TARGET_NAME } STATIC ${ target_SRCS } )
else ( )
add_library ( ${ TARGET_NAME } STATIC ${ cc_library_SRCS } )
find_fluid_modules ( ${ TARGET_NAME } )
endif ( )
if ( cc_library_DEPS )
# D o n ' t n e e d l i n k l i b w a r p c t c . s o
if ( "${cc_library_DEPS};" MATCHES "warpctc;" )
@ -285,7 +286,6 @@ function(cc_library TARGET_NAME)
endif ( WIN32 )
endif ( )
target_link_libraries ( ${ TARGET_NAME } ${ cc_library_DEPS } )
add_dependencies ( ${ TARGET_NAME } ${ cc_library_DEPS } )
common_link ( ${ TARGET_NAME } )
endif ( )
@ -322,6 +322,7 @@ function(sep_library TARGET_NAME)
set ( dummy_offset 1 )
# t h e d u m m y t a r g e t w o u l d b e c o n s i s t e d o f l i m i t s i z e l i b r a r i e s
set ( dummy_limit 50 )
list ( REMOVE_DUPLICATES sep_library_DEPS )
list ( LENGTH sep_library_DEPS sep_all_len )
foreach ( v ${ sep_library_DEPS } )
list ( APPEND dummy_list ${ v } )