aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: 0dda750292652918b7848d712f12cc80ab8fbcbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
find_package(Libcurl REQUIRED)
find_package(JsonC REQUIRED)
add_subdirectory(hash)
add_subdirectory(vdf)
add_subdirectory(threading)

set(CFLAGS
    -Wall -Wextra -pedantic -Wfloat-equal
    -Wstrict-overflow=5 -Wunreachable-code
    -Wcast-qual -Wswitch-default
    -Wconversion -Wshadow -Wstrict-aliasing
    -Winit-self -Wcast-align -Wpointer-arith
    -Wmissing-declarations -Wmissing-include-dirs
    -Wno-unused-parameter -Wuninitialized
    ${LIBCURL_CFLAGS}
    ${JSONC_CFLAGS}
)

list(APPEND
    CORE_SOURCES
    ${CMAKE_CURRENT_SOURCE_DIR}/fs.c
    ${CMAKE_CURRENT_SOURCE_DIR}/fs.h
    ${CMAKE_CURRENT_SOURCE_DIR}/net.c
    ${CMAKE_CURRENT_SOURCE_DIR}/net.h
    ${CMAKE_CURRENT_SOURCE_DIR}/proc.c
    ${CMAKE_CURRENT_SOURCE_DIR}/proc.h
    ${CMAKE_CURRENT_SOURCE_DIR}/steam.c
    ${CMAKE_CURRENT_SOURCE_DIR}/steam.h
    ${CMAKE_CURRENT_SOURCE_DIR}/toast.c
    ${CMAKE_CURRENT_SOURCE_DIR}/toast.h
)

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
    add_compile_definitions(HAS_HOOKS)
    add_subdirectory(hook)
endif()

add_library(tvn STATIC ${CORE_SOURCES})
target_compile_options(tvn PUBLIC ${CFLAGS})

target_include_directories(tvn PUBLIC ${LIBCURL_INCLUDE_DIRS})
target_include_directories(tvn PUBLIC ${JSONC_INCLUDE_DIRS})
target_include_directories(tvn PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(tvn LINK_PUBLIC ${LIBCURL_LIBRARIES})
target_link_libraries(tvn LINK_PUBLIC ${JSONC_LIBRARIES})
target_link_libraries(tvn LINK_PUBLIC md5)
target_link_libraries(tvn LINK_PUBLIC vdf)
target_link_libraries(tvn LINK_PUBLIC hook)

if (WIN32)
    target_link_libraries(tvn LINK_PUBLIC shlwapi)
endif()

# frontends are included last so they will be
# put in the root of the build directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

if(BUILD_CLI)
    add_subdirectory(cli)
endif()

if(BUILD_QT)
    add_subdirectory(qt)
endif()

if (BUILD_MIRROR)
    add_subdirectory(mirror)
endif()