CMakeLists.txt 1.0 KB
Newer Older
H
refact  
Hongze Cheng 已提交
1
aux_source_directory(src OS_SRC)
S
monitor  
Shengliang Guan 已提交
2
add_library(os STATIC ${OS_SRC})
H
refact  
Hongze Cheng 已提交
3 4
target_include_directories(
    os
wafwerar's avatar
wafwerar 已提交
5 6 7 8
    PUBLIC "${TD_SOURCE_DIR}/include/os"
    PUBLIC "${TD_SOURCE_DIR}/include"
    PUBLIC "${TD_SOURCE_DIR}/include/util"
    PUBLIC "${TD_SOURCE_DIR}/contrib/pthread"
wafwerar's avatar
wafwerar 已提交
9 10
    PUBLIC "${TD_SOURCE_DIR}/contrib/iconv"
    PUBLIC "${TD_SOURCE_DIR}/contrib/msvcregex"
S
Shengliang Guan 已提交
11
)
wafwerar's avatar
wafwerar 已提交
12 13 14 15 16
# iconv
find_path(IconvApiIncludes iconv.h PATHS)
if(NOT IconvApiIncludes)
    add_definitions(-DDISALLOW_NCHAR_WITHOUT_ICONV) 
endif ()
wafwerar's avatar
wafwerar 已提交
17 18 19
if(USE_TD_MEMORY)
    add_definitions(-DUSE_TD_MEMORY) 
endif ()
wafwerar's avatar
wafwerar 已提交
20 21 22 23 24 25 26 27 28 29
if(BUILD_ADDR2LINE)
    target_include_directories(
        os
        PUBLIC "${TD_SOURCE_DIR}/contrib/libdwarf/src/lib/libdwarf"
    )
    add_definitions(-DUSE_ADDR2LINE)
    target_link_libraries(
        os PUBLIC addr2line dl z
    )
endif ()
S
Shengliang Guan 已提交
30
target_link_libraries(
wafwerar's avatar
wafwerar 已提交
31
    os PUBLIC pthread
32
)
wafwerar's avatar
wafwerar 已提交
33 34
if(NOT TD_WINDOWS)
    target_link_libraries(
wafwerar's avatar
wafwerar 已提交
35
        os PUBLIC dl m rt
wafwerar's avatar
wafwerar 已提交
36 37 38
    )
else()
    target_link_libraries(
wafwerar's avatar
wafwerar 已提交
39
        os PUBLIC ws2_32 iconv msvcregex wcwidth winmm
wafwerar's avatar
wafwerar 已提交
40 41
    )
endif(NOT TD_WINDOWS)