summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Wachter <bwachter-tmw@lart.info>2010-08-14 23:56:51 +0300
committerBernd Wachter <bwachter-tmw@lart.info>2010-08-15 00:34:20 +0300
commit730974c34134c45f2fc20598908005d7a9b5636b (patch)
tree971d8538c726dc473561900ce5ca4b43cc7cda3d
parent7950455d2370bfcdd1ed5472c9e5401b0fd8dbe8 (diff)
downloadmana-730974c34134c45f2fc20598908005d7a9b5636b.tar.gz
mana-730974c34134c45f2fc20598908005d7a9b5636b.tar.bz2
mana-730974c34134c45f2fc20598908005d7a9b5636b.tar.xz
mana-730974c34134c45f2fc20598908005d7a9b5636b.zip
Add included enet to CMake
-rw-r--r--CMakeLists.txt2
-rw-r--r--libs/enet/CMakeLists.txt55
-rw-r--r--src/CMakeLists.txt12
3 files changed, 66 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b396b8e1..552ab6e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,5 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+CMAKE_POLICY(VERSION 2.6)
PROJECT(MANA)
@@ -45,6 +46,7 @@ ELSE (WIN32)
ENDIF (WIN32)
ADD_SUBDIRECTORY(data)
+ADD_SUBDIRECTORY(libs/enet)
ADD_SUBDIRECTORY(src)
IF (GETTEXT_FOUND AND ENABLE_NLS)
diff --git a/libs/enet/CMakeLists.txt b/libs/enet/CMakeLists.txt
new file mode 100644
index 00000000..714d9c03
--- /dev/null
+++ b/libs/enet/CMakeLists.txt
@@ -0,0 +1,55 @@
+INCLUDE(CheckFunctionExists)
+CHECK_FUNCTION_EXISTS(gethostbyaddr_r HAS_GETHOSTBYNAME_R)
+IF(HAS_GETHOSTBYNAME_R EQUAL 1)
+ SET (FLAGS "${FLAGS} -DHAS_GETHOSTBYADDR_R")
+ENDIF()
+
+CHECK_FUNCTION_EXISTS(poll HAS_POLL)
+IF(HAS_POLL EQUAL 1)
+ SET (FLAGS "${FLAGS} -DHAS_POLL")
+ENDIF()
+
+CHECK_FUNCTION_EXISTS(fcntl HAS_FCNTL)
+IF(HAS_FCNTL)
+ SET (FLAGS "${FLAGS} -DHAS_FCNTL")
+ENDIF()
+
+CHECK_FUNCTION_EXISTS(inet_pton HAS_INETPTON)
+IF(HAS_INETPTON EQUAL 1)
+ SET (FLAGS "${FLAGS} -DHAS_INETPTON")
+ENDIF()
+
+CHECK_FUNCTION_EXISTS(inet_ntop HAS_INETNTOP)
+IF(HAS_INETNTOP EQUAL 1)
+ SET (FLAGS "${FLAGS} -DHAS_INETNTOP")
+ENDIF()
+
+INCLUDE(CheckTypeSize)
+SET (CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
+CHECK_TYPE_SIZE(socklen_t SOCKLEN_T)
+IF(HAVE_SOCKLEN_T)
+ SET (FLAGS "${FLAGS} -DHAS_SOCKLEN_T")
+ENDIF()
+
+INCLUDE(CheckStructHasMember)
+CHECK_STRUCT_HAS_MEMBER("struct msghdr" msg_flags sys/socket.h HAS_MSGHDR_FLAGS)
+IF(HAS_MSGHDR_FLAGS EQUAL 1)
+ SET (FLAGS "${FLAGS} -DHAS_MSGHDR_FLAGS")
+ENDIF()
+
+SET (SRCS
+ callbacks.c
+ compress.c
+ host.c
+ list.c
+ packet.c
+ peer.c
+ protocol.c
+ unix.c
+ win32.c
+ )
+
+INCLUDE_DIRECTORIES("include")
+
+ADD_LIBRARY(enet STATIC ${SRCS})
+SET_TARGET_PROPERTIES(enet PROPERTIES COMPILE_FLAGS "${FLAGS}") \ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6c470aef..38589505 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,7 +4,6 @@ FIND_PACKAGE(SDL_mixer REQUIRED)
FIND_PACKAGE(SDL_net REQUIRED)
FIND_PACKAGE(SDL_ttf REQUIRED)
FIND_PACKAGE(SDL_gfx REQUIRED)
-FIND_PACKAGE(ENet REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(LibXml2 REQUIRED)
FIND_PACKAGE(PhysFS REQUIRED)
@@ -22,6 +21,13 @@ IF (CMAKE_COMPILER_IS_GNUCXX)
ENDIF()
ENDIF()
+IF (POLICY CMP0015)
+ CMAKE_POLICY(SET CMP0015 OLD)
+ENDIF()
+INCLUDE_DIRECTORIES("../libs/enet/include")
+LINK_DIRECTORIES("../libs/enet")
+SET(INTERNAL_LIBRARIES enet)
+
SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
@@ -71,7 +77,6 @@ INCLUDE_DIRECTORIES(
${SDLNET_INCLUDE_DIR}
${SDLTTF_INCLUDE_DIR}
${SDLGFX_INCLUDE_DIR}
- ${ENET_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
${PHYSFS_INCLUDE_DIR}
${CURL_INCLUDE_DIR}
@@ -623,13 +628,13 @@ SET (PROGRAMS mana)
ADD_EXECUTABLE(mana WIN32 ${SRCS} ${SRCS_MANA} ${SRCS_TMWA})
TARGET_LINK_LIBRARIES(mana
+ ${INTERNAL_LIBRARIES}
${SDLGFX_LIBRARIES}
${SDL_LIBRARY}
${SDLIMAGE_LIBRARY}
${SDLMIXER_LIBRARY}
${SDLNET_LIBRARY}
${SDLTTF_LIBRARY}
- ${ENET_LIBRARIES}
${PNG_LIBRARIES}
${PHYSFS_LIBRARY}
${CURL_LIBRARIES}
@@ -638,6 +643,7 @@ TARGET_LINK_LIBRARIES(mana
${OPENGL_LIBRARIES}
${LIBINTL_LIBRARIES}
${EXTRA_LIBRARIES})
+
INSTALL(TARGETS mana RUNTIME DESTINATION ${PKG_BINDIR})
IF (CMAKE_SYSTEM_NAME STREQUAL SunOS)