summaryrefslogtreecommitdiff
path: root/source/luametatex/cmake/luasocket.cmake
blob: 8489b0a80e5213b3acb3e0c56a51568e184b2f94 (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
set(luasocket_sources

    source/luacore/luasocket/src/auxiliar.c
    source/luacore/luasocket/src/buffer.c
    source/luacore/luasocket/src/compat.c
    source/luacore/luasocket/src/except.c
    source/luacore/luasocket/src/inet.c
    source/luacore/luasocket/src/io.c
    source/luacore/luasocket/src/luasocket.c
    source/luacore/luasocket/src/mime.c
    source/luacore/luasocket/src/options.c
    source/luacore/luasocket/src/select.c
    source/luacore/luasocket/src/socket.c
    source/luacore/luasocket/src/tcp.c
    source/luacore/luasocket/src/timeout.c
    source/luacore/luasocket/src/udp.c

  # source/luacore/luasocket/src/serial.c
  # source/luacore/luasocket/src/usocket.c
  # source/luacore/luasocket/src/wsocket.c

  # source/luacore/luasec/src/config.c
  # source/luacore/luasec/src/options.c
  # source/luacore/luasec/src/ec.c
  # source/luacore/luasec/src/x509.c
  # source/luacore/luasec/src/context.c
  # source/luacore/luasec/src/ssl.c

)

add_library(luasocket STATIC ${luasocket_sources})

target_include_directories(luasocket PRIVATE
    source/luacore/luasocket
  # source/luacore/luasec
  # source/luacore/luasec/src
    source/luacore/lua54/src
)

if (NOT MSVC)
    target_compile_options(luasocket PRIVATE
        -Wno-cast-qual
        -Wno-cast-align
    )
endif()

if (WIN32)
    target_link_libraries(luasocket PRIVATE
        wsock32
        ws2_32
    )
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
    target_compile_definitions(luasocket PRIVATE
        LUASOCKET_INET_PTON
    )
endif()