mirror of
https://github.com/lunarmodules/luasocket.git
synced 2025-04-29 20:06:43 +02:00
Compare commits
4 Commits
6a8a3cce39
...
1ce24bf223
Author | SHA1 | Date | |
---|---|---|---|
|
1ce24bf223 | ||
|
23241717bf | ||
|
20920473dd | ||
|
be6399cb9d |
67
CMakeLists.txt
Normal file
67
CMakeLists.txt
Normal file
@ -0,0 +1,67 @@
|
||||
project(luasocket)
|
||||
cmake_minimum_required(VERSION 2.8...3.20)
|
||||
include(CheckIncludeFile)
|
||||
check_include_file("lua.h" HAVE_LUA)
|
||||
set(socket_VERSION "3.0-rc1")
|
||||
set(MIME_VERSION "1.0.3")
|
||||
|
||||
include_directories(BEFORE "${PROJECT_SOURCE_DIR}/src/")
|
||||
|
||||
# add header files directory
|
||||
# include_directories()
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2 /Ot /MD /W3 /nologo")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow -Wextra -Wimplicit -O2 -ggdb3 -fpic")
|
||||
endif()
|
||||
|
||||
|
||||
if(WIN32)
|
||||
if(${HAVE_LUA})
|
||||
set(
|
||||
SOURCE
|
||||
"src/auxiliar.c"
|
||||
"src/buffer.c"
|
||||
"src/except.c"
|
||||
"src/inet.c"
|
||||
"src/io.c"
|
||||
"src/options.c"
|
||||
"src/select.c"
|
||||
"src/tcp.c"
|
||||
"src/udp.c"
|
||||
"src/wsocket.c"
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "can not found lua.h or lualib.h \n Maybe you can set \"include_directories(xxx/include)\"to solve this problem")
|
||||
endif()
|
||||
add_library(socket SHARED "${SOURCE}")
|
||||
add_library(mime SHARED "src/mime.c" "src/compat.c")
|
||||
set_target_properties(socket PROPERTIES OUTPUT_NAME "socket")
|
||||
set_target_properties(mime PROPERTIES OUTPUT_NAME "mime")
|
||||
elseif(APPLE)
|
||||
# MACOS build
|
||||
elseif(UNIX)
|
||||
# Linux or Unix build
|
||||
endif()
|
||||
|
||||
set(
|
||||
TO_SOCKET_LDIR
|
||||
"src/http.lua"
|
||||
"src/url.lua"
|
||||
"src/tp.lua"
|
||||
"src/ftp.lua"
|
||||
"src/headers.lua"
|
||||
"src/smtp.lua"
|
||||
)
|
||||
|
||||
set(
|
||||
TO_TOP_LDIR
|
||||
"src/ltn12.lua"
|
||||
"src/socket.lua"
|
||||
"src/mime.lua"
|
||||
)
|
||||
|
||||
install(TARGETS socket LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/luasocket/socket")
|
||||
install(FILES ${TO_SOCKET_LDIR} DESTINATION "${CMAKE_INSTALL_PREFIX}/luasocket/socket")
|
||||
install(FILES ${TO_TOP_LDIR} DESTINATION "${CMAKE_INSTALL_PREFIX}/luasocket")
|
@ -40,7 +40,7 @@ Pump, Support, Library">
|
||||
<h2 id="ltn12">LTN12</h2>
|
||||
|
||||
<p> The <tt>ltn12</tt> namespace implements the ideas described in
|
||||
<a href="http://lua-users.org/wiki/FiltersSourcesAndSinks">
|
||||
<a href="https://github.com/lunarmodules/luasocket/blob/master/ltn012.md">
|
||||
LTN012, Filters sources and sinks</a>. This manual simply describes the
|
||||
functions. Please refer to the LTN for a deeper explanation of the
|
||||
functionality provided by this module.
|
||||
|
@ -164,6 +164,9 @@ Creates and returns a <em>clean</em>
|
||||
<a href="#try"><tt>try</tt></a>
|
||||
function that allows for cleanup before the exception
|
||||
is raised.
|
||||
This implements the ideas described in
|
||||
<a href="https://github.com/lunarmodules/luasocket/blob/master/ltn013.md">
|
||||
LTN012, Using finalized exceptions</a>.
|
||||
</p>
|
||||
|
||||
<p class="parameters">
|
||||
@ -207,6 +210,9 @@ Converts a function that throws exceptions into a safe function. This
|
||||
function only catches exceptions thrown by the <a href="#try"><tt>try</tt></a>
|
||||
and <a href="#newtry"><tt>newtry</tt></a> functions. It does not catch normal
|
||||
Lua errors.
|
||||
This implements the ideas described in
|
||||
<a href="https://github.com/lunarmodules/luasocket/blob/master/ltn013.md">
|
||||
LTN012, Using finalized exceptions</a>.
|
||||
</p>
|
||||
|
||||
<p class="parameters">
|
||||
@ -425,6 +431,9 @@ socket.<b>try(</b>ret<sub>1</sub> [, ret<sub>2</sub> ... ret<sub>N</sub>]<b>)</b
|
||||
Throws an exception in case <tt>ret<sub>1</sub></tt> is falsy, using
|
||||
<tt>ret<sub>2</sub></tt> as the error message. The exception is supposed to be caught
|
||||
by a <a href="#protect"><tt>protect</tt></a>ed function only.
|
||||
This implements the ideas described in
|
||||
<a href="https://github.com/lunarmodules/luasocket/blob/master/ltn013.md">
|
||||
LTN012, Using finalized exceptions</a>.
|
||||
</p>
|
||||
|
||||
<p class="parameters">
|
||||
|
Loading…
x
Reference in New Issue
Block a user