aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: f3d8a1349e229e87bb1a35fa45e926426801061b (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
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}/steam.c
    ${CMAKE_CURRENT_SOURCE_DIR}/steam.h
    ${CMAKE_CURRENT_SOURCE_DIR}/toast.c
    ${CMAKE_CURRENT_SOURCE_DIR}/toast.h
)

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)

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()