summaryrefslogtreecommitdiff
path: root/source/luametatex/cmake/luasocket.cmake
blob: e36f1f7e65607e6617cfe4c4c2c18be5ebf7b2d0 (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
70
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()

# It seems to depend on the mingw installation: 

if (__MINGW64_TOOLCHAIN_)
    target_compile_definitions(luasocket PRIVATE
        LUASOCKET_INET_PTON
    )
endif()

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