mirror of
https://github.com/minetest-mods/irc.git
synced 2024-12-29 02:00:17 +01:00
Added option to not build luasocket as part of the mod
This commit is contained in:
parent
105db6bc60
commit
977bc94f11
@ -5,11 +5,15 @@ cmake_minimum_required(VERSION 2.8)
|
|||||||
|
|
||||||
project(MINETEST_IRC C)
|
project(MINETEST_IRC C)
|
||||||
|
|
||||||
set(MINETEST_IRC_VERSION 0.1.0)
|
set(MINETEST_IRC_VERSION 0.1.2)
|
||||||
|
|
||||||
|
option(LITE_VERSION "Do not build & package luasocket as part of the mod" OFF)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
set(LUA_SRCS
|
if(NOT LITE_VERSION)
|
||||||
|
|
||||||
|
set(LUA_SRCS
|
||||||
src/lua/lapi.c
|
src/lua/lapi.c
|
||||||
src/lua/lcode.c
|
src/lua/lcode.c
|
||||||
src/lua/ldebug.c
|
src/lua/ldebug.c
|
||||||
@ -39,9 +43,9 @@ set(LUA_SRCS
|
|||||||
src/lua/lstrlib.c
|
src/lua/lstrlib.c
|
||||||
src/lua/loadlib.c
|
src/lua/loadlib.c
|
||||||
src/lua/linit.c
|
src/lua/linit.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(LUASOCKET_SRCS
|
set(LUASOCKET_SRCS
|
||||||
src/luasocket/compat51.c
|
src/luasocket/compat51.c
|
||||||
src/luasocket/luasocket.c
|
src/luasocket/luasocket.c
|
||||||
src/luasocket/timeout.c
|
src/luasocket/timeout.c
|
||||||
@ -60,25 +64,25 @@ set(LUASOCKET_SRCS
|
|||||||
src/luasocket/timeout.c
|
src/luasocket/timeout.c
|
||||||
src/luasocket/io.c
|
src/luasocket/io.c
|
||||||
src/luasocket/mime.c
|
src/luasocket/mime.c
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
list(APPEND LUASOCKET_SRCS src/luasocket/wsocket.c)
|
list(APPEND LUASOCKET_SRCS src/luasocket/wsocket.c)
|
||||||
set(LUASOCKET_EXTRA_LIBS -lwininet)
|
set(LUASOCKET_EXTRA_LIBS -lwininet)
|
||||||
else()
|
else()
|
||||||
list(APPEND LUASOCKET_SRCS src/luasocket/usocket.c src/luasocket/unix.c)
|
list(APPEND LUASOCKET_SRCS src/luasocket/usocket.c src/luasocket/unix.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/lua)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/lua)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/luasocket)
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/luasocket)
|
||||||
|
|
||||||
add_library(luasocket_lib MODULE ${LUASOCKET_SRCS} ${LUA_SRCS})
|
add_library(luasocket_lib MODULE ${LUASOCKET_SRCS} ${LUA_SRCS})
|
||||||
|
|
||||||
set_target_properties(luasocket_lib PROPERTIES
|
set_target_properties(luasocket_lib PROPERTIES
|
||||||
OUTPUT_NAME luasocket)
|
OUTPUT_NAME luasocket)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# When using MinGW32, CMake prefixes DLLs with "lib". Force remove
|
# When using MinGW32, CMake prefixes DLLs with "lib". Force remove
|
||||||
# this prefix regardless of compiler.
|
# this prefix regardless of compiler.
|
||||||
set_target_properties(luasocket_lib PROPERTIES
|
set_target_properties(luasocket_lib PROPERTIES
|
||||||
@ -92,19 +96,27 @@ if(WIN32)
|
|||||||
endif()
|
endif()
|
||||||
find_library(ws2_32_lib NAMES ws2_32)
|
find_library(ws2_32_lib NAMES ws2_32)
|
||||||
target_link_libraries(luasocket_lib ${ws2_32_lib})
|
target_link_libraries(luasocket_lib ${ws2_32_lib})
|
||||||
else() # Possibly Unix
|
else() # Possibly Unix
|
||||||
set_target_properties(luasocket_lib PROPERTIES
|
set_target_properties(luasocket_lib PROPERTIES
|
||||||
COMPILE_FLAGS "-Wall -Werror")
|
COMPILE_FLAGS "-Wall -Werror")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(lib "${CMAKE_CURRENT_BINARY_DIR}/luasocket.dll")
|
||||||
|
else()
|
||||||
|
set(lib "${CMAKE_CURRENT_BINARY_DIR}/libluasocket.so")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(inst_lib COMMAND ${CMAKE_COMMAND} -E copy ${lib} ${dir})
|
||||||
|
|
||||||
|
else(NOT LITE_VERSION)
|
||||||
|
|
||||||
|
set(inst_lib)
|
||||||
|
|
||||||
|
endif(NOT LITE_VERSION)
|
||||||
|
|
||||||
set(dir ${CMAKE_CURRENT_BINARY_DIR}/irc/)
|
set(dir ${CMAKE_CURRENT_BINARY_DIR}/irc/)
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
set(lib "${CMAKE_CURRENT_BINARY_DIR}/luasocket.dll")
|
|
||||||
else()
|
|
||||||
set(lib "${CMAKE_CURRENT_BINARY_DIR}/libluasocket.so")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_target(pack_mod
|
add_custom_target(pack_mod
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
|
||||||
@ -125,7 +137,7 @@ add_custom_target(pack_mod
|
|||||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/tp.lua ${dir}
|
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/tp.lua ${dir}
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/url.lua ${dir}
|
COMMAND ${CMAKE_COMMAND} -E copy src/luasocket/url.lua ${dir}
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy doc/LICENSE-luasocket.txt ${dir}
|
COMMAND ${CMAKE_COMMAND} -E copy doc/LICENSE-luasocket.txt ${dir}
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${lib} ${dir}
|
${inst_lib}
|
||||||
|
|
||||||
# IRC mod
|
# IRC mod
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
|
||||||
|
Loading…
Reference in New Issue
Block a user