changeset 2:9d9266316a91

Resync with Git
author Eric Wing <ewing . public |-at-| gmail . com>
date Fri, 29 Aug 2008 22:48:39 -0700
parents cf0892e34f45
children 5496bdcc73f6
files CMakeLists.txt src/CMakeLists.txt src/mime/CMakeLists.txt src/unix/CMakeLists.txt
diffstat 4 files changed, 130 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Wed Aug 27 22:44:22 2008 -0700
+++ b/CMakeLists.txt	Fri Aug 29 22:48:39 2008 -0700
@@ -2,6 +2,8 @@
 
 PROJECT(LuaSocket)
 
+INCLUDE(CPack)
+
 IF(USING_LUA_MULTI_SET)
 	IF(NOT LUA_LIBRARIES)
 		IF(lua_library_module)
@@ -17,8 +19,15 @@
 	FIND_PACKAGE(Lua51 REQUIRED)
 ENDIF(USING_LUA_MULTI_SET)
 
-OPTION(WANTS_BUILD_SHARED_LIBRARY "Set to ON to build dynamic library." ON)
-#OPTION(WANTS_BUILD_STATIC_LIBRARY "Set to ON to build static library." ON)
+OPTION(WANTS_BUILD_MODULE_LIBRARY "Set to ON to build loadable module." ON)
+OPTION(WANTS_BUILD_STATIC_LIBRARY "Set to ON to build static library." ON)
+
+IF(NOT WANTS_BUILD_STATIC_LIBRARY AND NOT WANTS_BUILD_MODULE_LIBRARY)
+	MESSAGE(SEND_ERROR "Either WANTS_BUILD_STATIC_LIBRARY or WANTS_BUILD_MODULE_LIBRARY needs to be selected, but both are OFF. So there is nothing to build.")
+ENDIF(NOT WANTS_BUILD_STATIC_LIBRARY AND NOT WANTS_BUILD_MODULE_LIBRARY)
+
+
+
 
 SET(LUAPACKAGE_CDIR "lib/lua/5.1" CACHE STRING "Path for Lua packaged platform specific things.")
 SET(LUAPACKAGE_LDIR "share/lua/5.1" CACHE STRING "Path for Lua packages platform independent things.")
--- a/src/CMakeLists.txt	Wed Aug 27 22:44:22 2008 -0700
+++ b/src/CMakeLists.txt	Fri Aug 29 22:48:39 2008 -0700
@@ -1,4 +1,15 @@
 
+IF(WIN32)
+	SET(luasocket_PLATFORM_SPECIFIC
+		${LuaSocket_SOURCE_DIR}/src/wsocket.h
+		${LuaSocket_SOURCE_DIR}/src/wsocket.c
+	)
+ELSEIF(UNIX)
+	SET(luasocket_PLATFORM_SPECIFIC
+		${LuaSocket_SOURCE_DIR}/src/usocket.h
+		${LuaSocket_SOURCE_DIR}/src/usocket.c
+	)
+ENDIF(WIN32)
 
 SET(luasocket_SOCKET
 		${LuaSocket_SOURCE_DIR}/src/luasocket.c
@@ -12,29 +23,24 @@
 		${LuaSocket_SOURCE_DIR}/src/except.c
 		${LuaSocket_SOURCE_DIR}/src/select.h
 		${LuaSocket_SOURCE_DIR}/src/select.c
-)
-
-SET(luasocket_UNIX
+		${LuaSocket_SOURCE_DIR}/src/timeout.h
+		${LuaSocket_SOURCE_DIR}/src/timeout.c
 		${LuaSocket_SOURCE_DIR}/src/buffer.h
 		${LuaSocket_SOURCE_DIR}/src/buffer.c
+		${LuaSocket_SOURCE_DIR}/src/io.h
+		${LuaSocket_SOURCE_DIR}/src/io.c
 		${LuaSocket_SOURCE_DIR}/src/auxiliar.h
 		${LuaSocket_SOURCE_DIR}/src/auxiliar.c
 		${LuaSocket_SOURCE_DIR}/src/options.h
 		${LuaSocket_SOURCE_DIR}/src/options.c
-		${LuaSocket_SOURCE_DIR}/src/timeout.h
-		${LuaSocket_SOURCE_DIR}/src/timeout.c
-		${LuaSocket_SOURCE_DIR}/src/io.h
-		${LuaSocket_SOURCE_DIR}/src/io.c
-		${LuaSocket_SOURCE_DIR}/src/usocket.h
-		${LuaSocket_SOURCE_DIR}/src/usocket.c
-		${LuaSocket_SOURCE_DIR}/src/unix.h
-		${LuaSocket_SOURCE_DIR}/src/unix.c
+		${luasocket_PLATFORM_SPECIFIC}
 )
 
 SET(luasocket_PUBLIC_HEADERS
 		${LuaSocket_SOURCE_DIR}/src/luasocket.h
 )
 
+
 SET(luasocket_RESOURCE_FILES
 		${LuaSocket_SOURCE_DIR}/src/http.lua
 		${LuaSocket_SOURCE_DIR}/src/tp.lua
@@ -49,35 +55,41 @@
 		${LuaSocket_SOURCE_DIR}/src/mime.lua
 )
 
-IF(WANTS_BUILD_SHARED_LIBRARY)
-	ADD_LIBRARY(luasocket_library_module MODULE ${luasocket_PUBLIC_HEADERS} ${luasocket_SOCKET} ${luasocket_UNIX})
+IF(WANTS_BUILD_MODULE_LIBRARY)
+	ADD_LIBRARY(luasocket_library_module MODULE ${luasocket_PUBLIC_HEADERS} ${luasocket_SOCKET})
 	SET_TARGET_PROPERTIES(luasocket_library_module PROPERTIES 
 		PREFIX ""
 		OUTPUT_NAME "core"
 	)
 	TARGET_LINK_LIBRARIES(luasocket_library_module ${LUA_LIBRARIES} ${LUASOCKET_LINK_FLAGS})
 	SET_TARGET_PROPERTIES(luasocket_library_module PROPERTIES COMPILE_FLAGS "${LUASOCKET_C_FLAGS}")
-ENDIF(WANTS_BUILD_SHARED_LIBRARY)
-#IF(WANTS_BUILD_STATIC_LIBRARY)
-	ADD_LIBRARY(luasocket_library_static STATIC ${luasocket_PUBLIC_HEADERS} ${luasocket_SOCKET} ${luasocket_UNIX})
-	SET_TARGET_PROPERTIES(luasocket_library_static PROPERTIES OUTPUT_NAME "socket")
+
+ENDIF(WANTS_BUILD_MODULE_LIBRARY)
+
+IF(WANTS_BUILD_STATIC_LIBRARY)
+	ADD_LIBRARY(luasocket_library_static STATIC ${luasocket_PUBLIC_HEADERS} ${luasocket_SOCKET})
+	SET_TARGET_PROPERTIES(luasocket_library_static PROPERTIES OUTPUT_NAME "luasocket")
 	SET_TARGET_PROPERTIES(luasocket_library_static PROPERTIES COMPILE_FLAGS "${LUASOCKET_C_FLAGS}")
 	TARGET_LINK_LIBRARIES(luasocket_library_static ${LUA_LIBRARIES} ${LUASOCKET_LINK_FLAGS})
 
-#ENDIF(WANTS_BUILD_STATIC_LIBRARY)
+
+ENDIF(WANTS_BUILD_STATIC_LIBRARY)
 
 
-INSTALL(TARGETS
-	luasocket_library_static
-	RUNTIME DESTINATION bin
-	LIBRARY DESTINATION lib
-	ARCHIVE DESTINATION lib
-	#	ARCHIVE DESTINATION lib/static
-)
+IF(WANTS_BUILD_STATIC_LIBRARY)
+	INSTALL(TARGETS
+		luasocket_library_static
+		#	RUNTIME DESTINATION bin
+		LIBRARY DESTINATION lib
+		ARCHIVE DESTINATION lib
+		#	ARCHIVE DESTINATION lib/static
+	)
 
-IF(WANTS_BUILD_SHARED_LIBRARY)
+ENDIF(WANTS_BUILD_STATIC_LIBRARY)
+
+IF(WANTS_BUILD_MODULE_LIBRARY)
 	INSTALL(TARGETS luasocket_library_module DESTINATION ${LUAPACKAGE_CDIR}/socket)
-ENDIF(WANTS_BUILD_SHARED_LIBRARY)
+ENDIF(WANTS_BUILD_MODULE_LIBRARY)
 
 INSTALL(FILES ${luasocket_PUBLIC_HEADERS} DESTINATION include)
 
@@ -85,3 +97,8 @@
 INSTALL(FILES ${luasocketcommon_RESOURCE_FILES} DESTINATION ${LUAPACKAGE_LDIR})
 
 ADD_SUBDIRECTORY(mime)
+IF(UNIX)
+	ADD_SUBDIRECTORY(unix)
+ENDIF(UNIX)
+
+
--- a/src/mime/CMakeLists.txt	Wed Aug 27 22:44:22 2008 -0700
+++ b/src/mime/CMakeLists.txt	Fri Aug 29 22:48:39 2008 -0700
@@ -16,7 +16,7 @@
 )
 
 
-IF(WANTS_BUILD_SHARED_LIBRARY)
+IF(WANTS_BUILD_MODULE_LIBRARY)
 	ADD_LIBRARY(luamime_library_module MODULE ${luasocket_MIME_PUBLIC_HEADERS} ${luasocket_MIME})
 	SET_TARGET_PROPERTIES(luamime_library_module PROPERTIES
 		PREFIX ""
@@ -24,25 +24,28 @@
 	)
 	SET_TARGET_PROPERTIES(luamime_library_module PROPERTIES COMPILE_FLAGS "${LUASOCKET_C_FLAGS}")
 	TARGET_LINK_LIBRARIES(luamime_library_module ${LUA_LIBRARIES} ${LUASOCKET_LINK_FLAGS})
-ENDIF(WANTS_BUILD_SHARED_LIBRARY)
-#IF(WANTS_BUILD_STATIC_LIBRARY)
+ENDIF(WANTS_BUILD_MODULE_LIBRARY)
+
+IF(WANTS_BUILD_STATIC_LIBRARY)
 	ADD_LIBRARY(luamime_library_static STATIC ${luasocket_MIME_PUBLIC_HEADERS} ${luasocket_MIME})
-	SET_TARGET_PROPERTIES(luamime_library_static PROPERTIES OUTPUT_NAME "mime")
+	SET_TARGET_PROPERTIES(luamime_library_static PROPERTIES OUTPUT_NAME "luasocketmime")
 	SET_TARGET_PROPERTIES(luamime_library_static PROPERTIES COMPILE_FLAGS "${LUASOCKET_C_FLAGS}")
 	TARGET_LINK_LIBRARIES(luamime_library_static ${LUA_LIBRARIES} ${LUASOCKET_LINK_FLAGS})
-#ENDIF(WANTS_BUILD_STATIC_LIBRARY)
+ENDIF(WANTS_BUILD_STATIC_LIBRARY)
 
-INSTALL(TARGETS
-	luamime_library_static
-	RUNTIME DESTINATION bin
-	LIBRARY DESTINATION lib
-	ARCHIVE DESTINATION lib
-	#	ARCHIVE DESTINATION lib/static
-)
+IF(WANTS_BUILD_STATIC_LIBRARY)
+	INSTALL(TARGETS
+		luamime_library_static
+		#		RUNTIME DESTINATION bin
+		LIBRARY DESTINATION lib
+		ARCHIVE DESTINATION lib
+		#	ARCHIVE DESTINATION lib/static
+	)
+ENDIF(WANTS_BUILD_STATIC_LIBRARY)
 
-IF(WANTS_BUILD_SHARED_LIBRARY)
+IF(WANTS_BUILD_MODULE_LIBRARY)
 	INSTALL(TARGETS luamime_library_module DESTINATION ${LUAPACKAGE_CDIR}/mime)
-ENDIF(WANTS_BUILD_SHARED_LIBRARY)
+ENDIF(WANTS_BUILD_MODULE_LIBRARY)
 
 INSTALL(FILES ${luamime_RESOURCE_FILES} DESTINATION ${LUAPACKAGE_LDIR}/mime)
 INSTALL(FILES ${luasocket_MIME_PUBLIC_HEADERS} DESTINATION include)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/unix/CMakeLists.txt	Fri Aug 29 22:48:39 2008 -0700
@@ -0,0 +1,58 @@
+# Ugh. I'm very irritated that the Luasocket people rename the modules to "core". (No prefix, .dll/.so suffix). This makes life difficult because I can't build the libraries directly with the name because there are two libraries (socket, mime) so the names conflict with each other.
+# Furthermore, CMake doesn't offer good support for renaming TARGETS on install.
+# The easiest way to work around this problem was create a new subdirectory just for the mime plugin and build directly to the name 'core'.
+
+SET(luasocket_UNIX
+		${LuaSocket_SOURCE_DIR}/src/buffer.h
+		${LuaSocket_SOURCE_DIR}/src/buffer.c
+		${LuaSocket_SOURCE_DIR}/src/auxiliar.h
+		${LuaSocket_SOURCE_DIR}/src/auxiliar.c
+		${LuaSocket_SOURCE_DIR}/src/options.h
+		${LuaSocket_SOURCE_DIR}/src/options.c
+		${LuaSocket_SOURCE_DIR}/src/timeout.h
+		${LuaSocket_SOURCE_DIR}/src/timeout.c
+		${LuaSocket_SOURCE_DIR}/src/io.h
+		${LuaSocket_SOURCE_DIR}/src/io.c
+		${LuaSocket_SOURCE_DIR}/src/usocket.h
+		${LuaSocket_SOURCE_DIR}/src/usocket.c
+		${LuaSocket_SOURCE_DIR}/src/unix.c
+)
+SET(luasocket_UNIX_PUBLIC_HEADERS
+		${LuaSocket_SOURCE_DIR}/src/unix.h
+)
+
+IF(WANTS_BUILD_MODULE_LIBRARY)
+	ADD_LIBRARY(luasocket_unix_library_module MODULE ${luasocket_UNIX_PUBLIC_HEADERS} ${luasocket_UNIX})
+	SET_TARGET_PROPERTIES(luasocket_unix_library_module PROPERTIES 
+		PREFIX ""
+		OUTPUT_NAME "core"
+	)
+	TARGET_LINK_LIBRARIES(luasocket_unix_library_module ${LUA_LIBRARIES} ${LUASOCKET_LINK_FLAGS})
+	SET_TARGET_PROPERTIES(luasocket_unix_library_module PROPERTIES COMPILE_FLAGS "${LUASOCKET_C_FLAGS}")
+ENDIF(WANTS_BUILD_MODULE_LIBRARY)
+
+
+IF(WANTS_BUILD_STATIC_LIBRARY)
+	ADD_LIBRARY(luasocket_unix_library_static STATIC ${luasocket_UNIX_PUBLIC_HEADERS} ${luasocket_UNIX})
+	SET_TARGET_PROPERTIES(luasocket_unix_library_static PROPERTIES OUTPUT_NAME "luasocketunix")
+	TARGET_LINK_LIBRARIES(luasocket_unix_library_static ${LUA_LIBRARIES} ${LUASOCKET_LINK_FLAGS})
+	SET_TARGET_PROPERTIES(luasocket_unix_library_static PROPERTIES COMPILE_FLAGS "${LUASOCKET_C_FLAGS}")
+ENDIF(WANTS_BUILD_STATIC_LIBRARY)
+
+IF(WANTS_BUILD_STATIC_LIBRARY)
+	INSTALL(TARGETS
+		luasocket_unix_library_static
+		#	RUNTIME DESTINATION bin
+		LIBRARY DESTINATION lib
+		ARCHIVE DESTINATION lib
+		#	ARCHIVE DESTINATION lib/static
+	)
+ENDIF(WANTS_BUILD_STATIC_LIBRARY)
+
+IF(WANTS_BUILD_MODULE_LIBRARY)
+	INSTALL(TARGETS luasocket_unix_library_module DESTINATION ${LUAPACKAGE_CDIR}/unix)
+ENDIF(WANTS_BUILD_MODULE_LIBRARY)
+
+INSTALL(FILES ${luasocket_UNIX_PUBLIC_HEADERS} DESTINATION include)
+
+