<commit_before>#
# Lua bindings for 0MQ
#
cmake_minimum_required(VERSION 2.8)

project(lua-zmq C)

set(BUILD_SHARED_LIBS TRUE)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

set(INSTALL_LMOD ${CMAKE_INSTALL_PREFIX}/share/lua/5.1 CACHE PATH
				"Directory to install Lua source modules (configure lua via LUA_PATH)")
set(INSTALL_CMOD ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1 CACHE PATH
				"Directory to install Lua binary modules (configure lua via LUA_CPATH)")
set(LUA_NATIVE_OBJECTS_PATH ../LuaNativeObjects CACHE PATH
				"Directory to LuaNativeObjects bindings generator.")
set(USE_PRE_GENERATED_BINDINGS TRUE CACHE BOOL
				"Set this to FALSE to re-generate bindings using LuaNativeObjects")
set(ZMQ_PATH "" CACHE PATH
				"Directory to libzmq. (by default use pkg-config to detect path)")

set(COMMON_CFLAGS "${CFLAGS}")
set(COMMON_LDFLAGS)
set(COMMON_LIBS)

## Lua 5.1.x
include(FindLua51)
if(NOT ${LUA51_FOUND})
	message(FATAL_ERROR "The FindLua51 module could not find lua :-(")
endif()
if(WIN32)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -I${LUA_INCLUDE_DIR}")
	set(COMMON_LDFLAGS "${COMMON_LDFLAGS} ${LUA_LIBRARY}")
endif()
## MAC OSX needs extra linker flags
if(APPLE)
	set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -undefined dynamic_lookup")
endif()

## LibZMQ
if(WIN32)
	## need ZMQ_PATH
	if(IS_DIRECTORY "${ZMQ_PATH}")
	else()
		message(FATAL_ERROR "Please set the ZMQ_PATH CMake variable.")
	endif()
endif()
if(IS_DIRECTORY ${ZMQ_PATH})
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -I${ZMQ_PATH}/include")
	set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -L${ZMQ_PATH}/lib")
	set(COMMON_LIBS "${COMMON_LIBS};zmq")
else()
	## fallback to using pkg-config
	include(FindPkgConfig)
	pkg_search_module(ZMQ REQUIRED libzmq)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} ${ZMQ_CFLAGS}")
	set(COMMON_LDFLAGS "${COMMON_LDFLAGS} ${ZMQ_LDFLAGS}")
	set(COMMON_LIBS "${COMMON_LIBS};${ZMQ_LIBRARIES}")
endif()

## LuaNativeObjects
include(LuaNativeObjects)
include(CustomMacros)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}
                    ${CMAKE_CURRENT_BINARY_DIR}
                    ${LUA_INCLUDE_DIR})

link_directories(${ZMQ_LIBRARY_DIRS})

## LuaZMQ
set(LUA_ZMQ_SRC
	zmq.nobj.lua
)

## LuaZMQ Lua source modules
set(LUA_ZMQ_SRC_LUA_MODS
	src/poller.lua
	src/threads.lua
)

if(${USE_PRE_GENERATED_BINDINGS})
	set(LUA_ZMQ_SRC src/pre_generated-zmq.nobj.c)
else()
	# Generate Lua bindings.
	GenLuaNativeObjects(LUA_ZMQ_SRC)
endif()

add_library(lua-zmq MODULE ${LUA_ZMQ_SRC})
target_link_libraries(lua-zmq ${COMMON_LIBS})
set_target_properties(lua-zmq PROPERTIES PREFIX "")
add_target_properties(lua-zmq COMPILE_FLAGS "${COMMON_CFLAGS}")
add_target_properties(lua-zmq LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
set_target_properties(lua-zmq PROPERTIES OUTPUT_NAME zmq)

install(TARGETS lua-zmq
        DESTINATION "${INSTALL_CMOD}")

install(FILES ${LUA_ZMQ_SRC_LUA_MODS}
        DESTINATION "${INSTALL_LMOD}/zmq")

<commit_msg>Export module functions for FFI support on windows.<commit_after>#
# Lua bindings for 0MQ
#
cmake_minimum_required(VERSION 2.8)

project(lua-zmq C)

set(BUILD_SHARED_LIBS TRUE)

set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

set(INSTALL_LMOD ${CMAKE_INSTALL_PREFIX}/share/lua/5.1 CACHE PATH
				"Directory to install Lua source modules (configure lua via LUA_PATH)")
set(INSTALL_CMOD ${CMAKE_INSTALL_PREFIX}/lib/lua/5.1 CACHE PATH
				"Directory to install Lua binary modules (configure lua via LUA_CPATH)")
set(LUA_NATIVE_OBJECTS_PATH ../LuaNativeObjects CACHE PATH
				"Directory to LuaNativeObjects bindings generator.")
set(USE_PRE_GENERATED_BINDINGS TRUE CACHE BOOL
				"Set this to FALSE to re-generate bindings using LuaNativeObjects")
set(ZMQ_PATH "" CACHE PATH
				"Directory to libzmq. (by default use pkg-config to detect path)")

set(COMMON_CFLAGS "${CFLAGS}")
set(COMMON_LDFLAGS)
set(COMMON_LIBS)

## Lua 5.1.x
include(FindLua51)
if(NOT ${LUA51_FOUND})
	message(FATAL_ERROR "The FindLua51 module could not find lua :-(")
endif()
if(WIN32)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -I${LUA_INCLUDE_DIR}")
	set(COMMON_LDFLAGS "${COMMON_LDFLAGS} ${LUA_LIBRARY} -Wl,--export-all-symbols")
endif()
## MAC OSX needs extra linker flags
if(APPLE)
	set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -undefined dynamic_lookup")
endif()

## LibZMQ
if(WIN32)
	## need ZMQ_PATH
	if(IS_DIRECTORY "${ZMQ_PATH}")
	else()
		message(FATAL_ERROR "Please set the ZMQ_PATH CMake variable.")
	endif()
endif()
if(IS_DIRECTORY ${ZMQ_PATH})
	set(COMMON_CFLAGS "${COMMON_CFLAGS} -I${ZMQ_PATH}/include")
	set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -L${ZMQ_PATH}/lib")
	set(COMMON_LIBS "${COMMON_LIBS};zmq")
else()
	## fallback to using pkg-config
	include(FindPkgConfig)
	pkg_search_module(ZMQ REQUIRED libzmq)
	set(COMMON_CFLAGS "${COMMON_CFLAGS} ${ZMQ_CFLAGS}")
	set(COMMON_LDFLAGS "${COMMON_LDFLAGS} ${ZMQ_LDFLAGS}")
	set(COMMON_LIBS "${COMMON_LIBS};${ZMQ_LIBRARIES}")
endif()

## LuaNativeObjects
include(LuaNativeObjects)
include(CustomMacros)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}
                    ${CMAKE_CURRENT_BINARY_DIR}
                    ${LUA_INCLUDE_DIR})

link_directories(${ZMQ_LIBRARY_DIRS})

## LuaZMQ
set(LUA_ZMQ_SRC
	zmq.nobj.lua
)

## LuaZMQ Lua source modules
set(LUA_ZMQ_SRC_LUA_MODS
	src/poller.lua
	src/threads.lua
)

if(${USE_PRE_GENERATED_BINDINGS})
	set(LUA_ZMQ_SRC src/pre_generated-zmq.nobj.c)
else()
	# Generate Lua bindings.
	GenLuaNativeObjects(LUA_ZMQ_SRC)
endif()

add_library(lua-zmq MODULE ${LUA_ZMQ_SRC})
target_link_libraries(lua-zmq ${COMMON_LIBS})
set_target_properties(lua-zmq PROPERTIES PREFIX "")
add_target_properties(lua-zmq COMPILE_FLAGS "${COMMON_CFLAGS}")
add_target_properties(lua-zmq LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
set_target_properties(lua-zmq PROPERTIES OUTPUT_NAME zmq)

install(TARGETS lua-zmq
        DESTINATION "${INSTALL_CMOD}")

install(FILES ${LUA_ZMQ_SRC_LUA_MODS}
        DESTINATION "${INSTALL_LMOD}/zmq")


{'fraction_non_alphanumeric': 0.12212570260602963, 'fraction_numerical': 0.006472491909385114, 'mean_word_length': 6.33083645443196, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1945488', 'n_tokens_mistral': 2447, 'n_tokens_neox': 2287, 'n_words': 430}