aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-04-19 12:54:16 +0100
committerGravatar Sadie Powell2026-04-27 17:26:08 +0100
commit0dc19894f43ae03a7e78dabfb3784695bd0216fd (patch)
treead44bd4f6ce3e01b046905f00bace5352c366d87 /include
parentMerge branch 'insp4' into master. (diff)
Switch the build system to CMake.
Diffstat (limited to 'include')
-rw-r--r--include/CMakeLists.txt27
-rw-r--r--include/compat.h2
-rw-r--r--include/config.h.in68
-rw-r--r--include/dynamic.h9
4 files changed, 96 insertions, 10 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
new file mode 100644
index 000000000..34d0e6623
--- /dev/null
+++ b/include/CMakeLists.txt
@@ -0,0 +1,27 @@
+#
+# InspIRCd -- Internet Relay Chat Daemon
+#
+# Copyright (C) 2026 Sadie Powell <sadie@witchery.services>
+#
+# This file is part of InspIRCd. InspIRCd is free software: you can
+# redistribute it and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation, version 2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+if(CMAKE_CURRENT_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
+ message(FATAL_ERROR "You must run CMake using the CMakeLists.txt in the root directory!")
+endif()
+
+check_function_exists("arc4random_buf" HAS_ARC4RANDOM_BUF)
+check_function_exists("clock_gettime" HAS_CLOCK_GETTIME)
+check_function_exists("getentropy" HAS_GETENTROPY)
+
+configure_file("config.h.in" "config.h")
diff --git a/include/compat.h b/include/compat.h
index c9fdb65d5..136f1a9bb 100644
--- a/include/compat.h
+++ b/include/compat.h
@@ -50,7 +50,6 @@ template<typename T> concept fmt_formattable = fmt::formattable<T>;
* order to build on Windows correctly.
*/
#ifdef _WIN32
-# include "win32wrapper.h"
# ifdef INSPIRCD_CORE
# define CoreExport __declspec(dllexport)
# define DllExport __declspec(dllimport)
@@ -58,6 +57,7 @@ template<typename T> concept fmt_formattable = fmt::formattable<T>;
# define CoreExport __declspec(dllimport)
# define DllExport __declspec(dllexport)
# endif
+# include "win32wrapper.h"
#else
# define DllExport __attribute__ ((visibility ("default")))
# define CoreExport __attribute__ ((visibility ("default")))
diff --git a/include/config.h.in b/include/config.h.in
new file mode 100644
index 000000000..00583f8dd
--- /dev/null
+++ b/include/config.h.in
@@ -0,0 +1,68 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ * Copyright (C) 2014, 2016, 2018-2021, 2024 Sadie Powell <sadie@witchery.services>
+ *
+ * This file is part of InspIRCd. InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#pragma once
+
+// The branch version that is shown to unprivileged users.
+#define INSPIRCD_BRANCH "InspIRCd-@VERSION_MAJOR@"
+
+// The full version that is shown to privileged users.
+#define INSPIRCD_VERSION "InspIRCd-@VERSION_FULL@"
+
+// Determines whether this version of InspIRCd is older than the requested version.
+#define INSPIRCD_VERSION_BEFORE(MAJOR, MINOR) (((@VERSION_MAJOR@ << 8) | @VERSION_MINOR@) < ((MAJOR << 8) | (MINOR)))
+
+// Determines whether this version of InspIRCd is equal to or newer than the requested version.
+#define INSPIRCD_VERSION_SINCE(MAJOR, MINOR) (((@VERSION_MAJOR@ << 8) | @VERSION_MINOR@) >= ((MAJOR << 8) | (MINOR)))
+
+// The default location that config files are stored in.
+#define INSPIRCD_CONFIG_PATH "@ABSOLUTE_CONFIG_DIR@"
+
+// The default location that example config files are stored in.
+#define INSPIRCD_EXAMPLE_PATH "@ABSOLUTE_EXAMPLE_DIR@"
+
+// The default location that data files are stored in.
+#define INSPIRCD_DATA_PATH "@ABSOLUTE_DATA_DIR@"
+
+// The default location that log files are stored in.
+#define INSPIRCD_LOG_PATH "@ABSOLUTE_LOG_DIR@"
+
+// The default location that module files are stored in.
+#define INSPIRCD_MODULE_PATH "@ABSOLUTE_MODULE_DIR@"
+
+// The default location that runtime files are stored in.
+#define INSPIRCD_RUNTIME_PATH "@ABSOLUTE_RUNTIME_DIR@"
+
+// The extension used by module files.
+#define INSPIRCD_MODULE_EXT "@CMAKE_SHARED_LIBRARY_SUFFIX@"
+
+// The URL of the InspIRCd docs site.
+#define INSPIRCD_DOCS "https://docs.inspircd.org/@VERSION_MAJOR@/"
+
+// Whether the arc4random_buf() function was available at compile time.
+#cmakedefine HAS_ARC4RANDOM_BUF
+
+// Whether the clock_gettime() function was available at compile time.
+#cmakedefine HAS_CLOCK_GETTIME
+
+// Whether the getentropy() function was available at compile time.
+#cmakedefine HAS_GETENTROPY
+
+// Whether the sigabbrev_np() function was available at compile time.
+#cmakedefine HAS_SIGABBREV_NP
diff --git a/include/dynamic.h b/include/dynamic.h
index dd484359e..c95a419fe 100644
--- a/include/dynamic.h
+++ b/include/dynamic.h
@@ -25,15 +25,6 @@
#pragma once
-/** The extension that dynamic libraries end with. */
-#if defined __APPLE__
-# define INSPIRCD_MODULE_EXT ".dylib"
-#elif defined _WIN32
-# define INSPIRCD_MODULE_EXT ".dll"
-#else
-# define INSPIRCD_MODULE_EXT ".so"
-#endif
-
/** The DLLManager class is able to load a module file by filename,
* and locate its init_module symbol.
*/