]> jfr.im git - irc/rizon/plexus4.git/commitdiff
[ci skip] Start on cmake build system origin/cmake
authorOrillion <redacted>
Wed, 12 Jul 2017 16:42:53 +0000 (18:42 +0200)
committerOrillion <redacted>
Wed, 12 Jul 2017 16:42:53 +0000 (18:42 +0200)
CMakeLists.txt [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5c1faf6
--- /dev/null
@@ -0,0 +1,119 @@
+project(Plexus4 C)
+cmake_minimum_required(VERSION 3.2)
+
+include(CheckFunctionExists)
+include(CheckIncludeFiles)
+include(CheckLibraryExists)
+include(GNUInstallDirs)
+# If found, will set OPENSSL_FOUND, OPENSSL_INCLUDE_DIR, OPENSSL_LIBRARIES and OPENSSL_VERSION
+include(FindOpenSSL)
+include(TestBigEndian)
+include(CheckSymbolExists)
+
+TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
+
+option(PREFIX "Installation location prefix" "/usr/local/bin")
+option(GEOIP "Enable GeoIP support" OFF)
+option(LUA "Enable LUA" OFF)
+option(JSON "Enable JSON support, required for upgrading" OFF)
+option(HTTPD "Enable libmicrohttpd" OFF)
+option(ASSERTS "Enable asserts" OFF)
+option(HALFOPS "Enable halfops (+h / %) for channels" ON)
+option(CHANAQ "Enable owner (+q / ~) for channels" ON)
+
+include_directories(${Plexus4_SOURCE_DIR}/include
+                    ${Plexus4_SOURCE_DIR})
+
+function(AX_CHECK_LIB_IPV4)
+       CHECK_FUNCTION_EXISTS(getaddrinfo HAVE_GETADDRINFO)
+       CHECK_FUNCTION_EXISTS(getnameinfo HAVE_GETNAMEINFO)
+       find_library(SOCKET_LIBRARIES NAMES socket REQUIRED)
+       CHECK_SYMBOL_EXISTS(sockaddr_in "sys/types.h;sys/socket.h;netdb.h" HAVE_SOCKADDR_IN)
+       CHECK_SYMBOL_EXISTS("struct sockaddr_storage" "sys/types.h;sys/socket.h;netdb.h" HAVE_SOCKADDR_STORAGE)
+endfunction()
+
+AX_CHECK_LIB_IPV4()
+if (NOT HAVE_SOCKADDR_IN)
+       message("struct sockaddr_in not found")
+endif()
+
+SET(NO_STRICT_ALIASING "-fno-strict-aliasing")
+
+SET(CMAKE_C_FLAGS "${NO_STRICT_ALIASING}")
+SET(C_STANDARD 99)
+
+find_library(IPV4_LIBRARIES NAMES IPV4 REQUIRED)
+find_library(IPV6_LIBRARIES NAMES IPV6 REQUIRED)
+
+message("${IPV6_LIBRARIES}")
+message("${OPENSSL_LIBRARIES}")
+
+CHECK_FUNCTION_EXISTS(strtok_r HAVE_STRTOK_R)
+CHECK_FUNCTION_EXISTS(usleep   HAVE_USLEEP)
+CHECK_FUNCTION_EXISTS(strlcat  HAVE_STRLCAT)
+CHECK_FUNCTION_EXISTS(strlcpy  HAVE_STRLCPY)
+
+CHECK_INCLUDE_FILES(crypt.h        HAVE_CRYPT_H)
+CHECK_INCLUDE_FILES(sys/resource.h HAVE_SYS_RESOURCE_H)
+CHECK_INCLUDE_FILES(sys/param.h    HAVE_SYS_PARAM_H)
+CHECK_INCLUDE_FILES(types.h        HAVE_TYPES_H)
+CHECK_INCLUDE_FILES(socket.h       HAVE_SOCKET_H)
+CHECK_INCLUDE_FILES(sys/wait.h     HAVE_SYS_WAIT_H)
+CHECK_INCLUDE_FILES(wait.h         HAVE_WAIT_H)
+
+find_program(YACC yacc DOC "Path to YACC")
+find_program(LEX lex DOC "Path to LEX")
+find_program(INSTALL install DOC "Path to INSTALL")
+
+message("${YACC}")
+message("${LEX}")
+message("${INSTALL}")
+
+if (GEOIP)
+       find_path(GEOIP_INCLUDE_DIRS GeoIP.h)
+       find_library(GEOIP_LIBRARIES NAMES GeoIP REQUIRED)
+       include_directories(${GEOIP_INCLUDE_DIRS})
+       SET(HAVE_LIBGEOIP ON)
+endif()
+
+if (JSON)
+       find_path(JANSSON_INCLUDE_DIRS jansson.h)
+       find_library(JANSSON_LIBRARIES NAMES jansson REQUIRED)
+       include_directories(${JANSSON_INCLUDE_DIRS})
+       SET(HAVE_LIBJANSSON ON)
+endif()
+
+if (ASSERTS)
+       SET(NDEBUG 1)
+endif()
+
+
+
+SET(NICKNAMEHISTORYLENGTH    32 * 1024)
+SET(MP_CHUNK_SIZE_CHANNEL  1024 * 1024)
+SET(MP_CHUNK_SIZE_MEMBER   2048 * 1024)
+SET(MP_CHUNK_SIZE_BAN      1024 * 1024)
+SET(MP_CHUNK_SIZE_CLIENT   1024 * 1024)
+SET(MP_CHUNK_SIZE_LCLIENT   512 * 1024)
+SET(MP_CHUNK_SIZE_DNODE      32 * 1024)
+SET(MP_CHUNK_SIZE_DBUF      512 * 1024)
+SET(MP_CHUNK_SIZE_AUTH      128 * 1024)
+SET(MP_CHUNK_SIZE_DNS        64 * 1024)
+SET(MP_CHUNK_SIZE_WATCH       8 * 1024)
+SET(MP_CHUNK_SIZE_USERHOST  128 * 1024)
+SET(MP_CHUNK_SIZE_IP_ENTRY  128 * 1024)
+SET(MP_CHUNK_SIZE_INVITE      8 * 1024)
+
+add_definitions(HAVE_CONFIG_H)
+configure_file(config.h.cmake config.h)
+
+
+#add_subdirectory(src)
+#add_subdirectory(tools)
+#add_subdirectory(libltdl)
+#add_subdirectory(doc)
+#add_subdirectory(help)
+#add_subdirectory(modules)
+#add_subdirectory(ircd)
+#add_subdirectory(scripts)
+