Created
November 5, 2023 01:32
-
-
Save TheStaticTurtle/b0f8da68128066dc45231cd87d50b1ce to your computer and use it in GitHub Desktop.
LuaSocket cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CMAKE_MINIMUM_REQUIRED(VERSION 3.25) | |
PROJECT(LuaSocket VERSION 3.0.0) | |
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | |
IF(WIN32) | |
SET(LUASOCKET_LINK_FLAGS "wsock32" "Ws2_32") | |
ADD_DEFINITIONS(-DLUASOCKET_DEBUG "-DLUASOCKET_API=__declspec(dllexport)") | |
ENDIF(WIN32) | |
IF(WIN32) | |
SET(LUASOCKET_PLATFORM_SOURCES | |
src/wsocket.h | |
src/wsocket.c | |
) | |
ELSEIF(UNIX) | |
SET(LUASOCKET_PLATFORM_SOURCES | |
src/usocket.h | |
src/usocket.c | |
src/unix.h | |
src/unix.c | |
src/unixdgram.h | |
src/unixdgram.c | |
src/unixstream.h | |
src/unixstream.c | |
src/serial.c | |
) | |
ENDIF(WIN32) | |
SET(LUASOCKET_SOURCES | |
src/luasocket.h | |
src/luasocket.c | |
src/mime.h | |
src/mime.c | |
src/inet.h | |
src/inet.c | |
src/tcp.h | |
src/tcp.c | |
src/udp.h | |
src/udp.c | |
src/except.h | |
src/except.c | |
src/select.h | |
src/select.c | |
src/timeout.h | |
src/timeout.c | |
src/buffer.h | |
src/buffer.c | |
src/io.h | |
src/io.c | |
src/auxiliar.h | |
src/auxiliar.c | |
src/options.h | |
src/options.c | |
src/compat.h | |
src/compat.c | |
src/pierror.h | |
src/socket.h | |
${LUASOCKET_PLATFORM_SOURCES} | |
) | |
SET(LUASOCKET_LUA_SOURCES | |
src/ltn12.lua | |
src/socket.lua | |
src/mime.lua | |
src/http.lua | |
src/tp.lua | |
src/ftp.lua | |
src/smtp.lua | |
src/url.lua | |
src/mbox.lua | |
src/headers.lua | |
) | |
add_library(${PROJECT_NAME} STATIC ${LUASOCKET_SOURCES}) | |
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${LUASOCKET_C_FLAGS}") | |
target_include_directories(${PROJECT_NAME} PUBLIC src) | |
target_link_libraries(${PROJECT_NAME} PRIVATE ${LUASOCKET_LINK_FLAGS}) | |
find_package(Lua REQUIRED) | |
target_link_libraries(${PROJECT_NAME} PRIVATE ${LUA_LIBRARIES}) | |
target_include_directories(${PROJECT_NAME} PUBLIC ${LUA_INCLUDE_DIR} src/) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment