mirror of
https://github.com/minetest-mods/irc.git
synced 2024-12-28 09:40:17 +01:00
Added option to not build luasocket as part of the mod
This commit is contained in:
parent
105db6bc60
commit
977bc94f11
196
CMakeLists.txt
196
CMakeLists.txt
@ -5,106 +5,118 @@ 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)
|
||||||
src/lua/lapi.c
|
|
||||||
src/lua/lcode.c
|
|
||||||
src/lua/ldebug.c
|
|
||||||
src/lua/ldo.c
|
|
||||||
src/lua/ldump.c
|
|
||||||
src/lua/lfunc.c
|
|
||||||
src/lua/lgc.c
|
|
||||||
src/lua/llex.c
|
|
||||||
src/lua/lmem.c
|
|
||||||
src/lua/lobject.c
|
|
||||||
src/lua/lopcodes.c
|
|
||||||
src/lua/lparser.c
|
|
||||||
src/lua/lstate.c
|
|
||||||
src/lua/lstring.c
|
|
||||||
src/lua/ltable.c
|
|
||||||
src/lua/ltm.c
|
|
||||||
src/lua/lundump.c
|
|
||||||
src/lua/lvm.c
|
|
||||||
src/lua/lzio.c
|
|
||||||
src/lua/lauxlib.c
|
|
||||||
src/lua/lbaselib.c
|
|
||||||
src/lua/ldblib.c
|
|
||||||
src/lua/liolib.c
|
|
||||||
src/lua/lmathlib.c
|
|
||||||
src/lua/loslib.c
|
|
||||||
src/lua/ltablib.c
|
|
||||||
src/lua/lstrlib.c
|
|
||||||
src/lua/loadlib.c
|
|
||||||
src/lua/linit.c
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LUASOCKET_SRCS
|
set(LUA_SRCS
|
||||||
src/luasocket/compat51.c
|
src/lua/lapi.c
|
||||||
src/luasocket/luasocket.c
|
src/lua/lcode.c
|
||||||
src/luasocket/timeout.c
|
src/lua/ldebug.c
|
||||||
src/luasocket/buffer.c
|
src/lua/ldo.c
|
||||||
src/luasocket/io.c
|
src/lua/ldump.c
|
||||||
src/luasocket/auxiliar.c
|
src/lua/lfunc.c
|
||||||
src/luasocket/options.c
|
src/lua/lgc.c
|
||||||
src/luasocket/inet.c
|
src/lua/llex.c
|
||||||
src/luasocket/tcp.c
|
src/lua/lmem.c
|
||||||
src/luasocket/udp.c
|
src/lua/lobject.c
|
||||||
src/luasocket/except.c
|
src/lua/lopcodes.c
|
||||||
src/luasocket/select.c
|
src/lua/lparser.c
|
||||||
src/luasocket/buffer.c
|
src/lua/lstate.c
|
||||||
src/luasocket/auxiliar.c
|
src/lua/lstring.c
|
||||||
src/luasocket/options.c
|
src/lua/ltable.c
|
||||||
src/luasocket/timeout.c
|
src/lua/ltm.c
|
||||||
src/luasocket/io.c
|
src/lua/lundump.c
|
||||||
src/luasocket/mime.c
|
src/lua/lvm.c
|
||||||
)
|
src/lua/lzio.c
|
||||||
|
src/lua/lauxlib.c
|
||||||
if(WIN32)
|
src/lua/lbaselib.c
|
||||||
list(APPEND LUASOCKET_SRCS src/luasocket/wsocket.c)
|
src/lua/ldblib.c
|
||||||
set(LUASOCKET_EXTRA_LIBS -lwininet)
|
src/lua/liolib.c
|
||||||
else()
|
src/lua/lmathlib.c
|
||||||
list(APPEND LUASOCKET_SRCS src/luasocket/usocket.c src/luasocket/unix.c)
|
src/lua/loslib.c
|
||||||
endif()
|
src/lua/ltablib.c
|
||||||
|
src/lua/lstrlib.c
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
src/lua/loadlib.c
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/lua)
|
src/lua/linit.c
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/luasocket)
|
)
|
||||||
|
|
||||||
add_library(luasocket_lib MODULE ${LUASOCKET_SRCS} ${LUA_SRCS})
|
set(LUASOCKET_SRCS
|
||||||
|
src/luasocket/compat51.c
|
||||||
set_target_properties(luasocket_lib PROPERTIES
|
src/luasocket/luasocket.c
|
||||||
OUTPUT_NAME luasocket)
|
src/luasocket/timeout.c
|
||||||
|
src/luasocket/buffer.c
|
||||||
if(WIN32)
|
src/luasocket/io.c
|
||||||
# When using MinGW32, CMake prefixes DLLs with "lib". Force remove
|
src/luasocket/auxiliar.c
|
||||||
# this prefix regardless of compiler.
|
src/luasocket/options.c
|
||||||
set_target_properties(luasocket_lib PROPERTIES
|
src/luasocket/inet.c
|
||||||
PREFIX "")
|
src/luasocket/tcp.c
|
||||||
if (NOT MSVC) # GCC?
|
src/luasocket/udp.c
|
||||||
# The `-fPIC' flag generates a warning on MinGW32, which combined
|
src/luasocket/except.c
|
||||||
# with `-Werror' makes that an error though `-fPIC' is ignored.
|
src/luasocket/select.c
|
||||||
# We use `-fno-PIC' to avoid that.
|
src/luasocket/buffer.c
|
||||||
set_target_properties(luasocket_lib PROPERTIES
|
src/luasocket/auxiliar.c
|
||||||
COMPILE_FLAGS "-fno-PIC -Wall -Werror")
|
src/luasocket/options.c
|
||||||
|
src/luasocket/timeout.c
|
||||||
|
src/luasocket/io.c
|
||||||
|
src/luasocket/mime.c
|
||||||
|
)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
list(APPEND LUASOCKET_SRCS src/luasocket/wsocket.c)
|
||||||
|
set(LUASOCKET_EXTRA_LIBS -lwininet)
|
||||||
|
else()
|
||||||
|
list(APPEND LUASOCKET_SRCS src/luasocket/usocket.c src/luasocket/unix.c)
|
||||||
endif()
|
endif()
|
||||||
find_library(ws2_32_lib NAMES ws2_32)
|
|
||||||
target_link_libraries(luasocket_lib ${ws2_32_lib})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
else() # Possibly Unix
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/lua)
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/luasocket)
|
||||||
|
|
||||||
|
add_library(luasocket_lib MODULE ${LUASOCKET_SRCS} ${LUA_SRCS})
|
||||||
|
|
||||||
set_target_properties(luasocket_lib PROPERTIES
|
set_target_properties(luasocket_lib PROPERTIES
|
||||||
COMPILE_FLAGS "-Wall -Werror")
|
OUTPUT_NAME luasocket)
|
||||||
endif()
|
|
||||||
|
if(WIN32)
|
||||||
|
# When using MinGW32, CMake prefixes DLLs with "lib". Force remove
|
||||||
|
# this prefix regardless of compiler.
|
||||||
|
set_target_properties(luasocket_lib PROPERTIES
|
||||||
|
PREFIX "")
|
||||||
|
if (NOT MSVC) # GCC?
|
||||||
|
# The `-fPIC' flag generates a warning on MinGW32, which combined
|
||||||
|
# with `-Werror' makes that an error though `-fPIC' is ignored.
|
||||||
|
# We use `-fno-PIC' to avoid that.
|
||||||
|
set_target_properties(luasocket_lib PROPERTIES
|
||||||
|
COMPILE_FLAGS "-fno-PIC -Wall -Werror")
|
||||||
|
endif()
|
||||||
|
find_library(ws2_32_lib NAMES ws2_32)
|
||||||
|
target_link_libraries(luasocket_lib ${ws2_32_lib})
|
||||||
|
else() # Possibly Unix
|
||||||
|
set_target_properties(luasocket_lib PROPERTIES
|
||||||
|
COMPILE_FLAGS "-Wall -Werror")
|
||||||
|
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