mirror of
https://github.com/anope/anope.git
synced 2026-06-27 08:26:38 +02:00
Use native file extensions on macOS and Windows.
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
// The default umask to use for files.
|
||||
#cmakedefine DEFUMASK @DEFUMASK@
|
||||
|
||||
// The extension used for module file extensions.
|
||||
#define DLL_EXT "@CMAKE_SHARED_LIBRARY_SUFFIX@"
|
||||
|
||||
// Whether Anope was built in debug mode.
|
||||
#cmakedefine01 DEBUG_BUILD
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ macro(build_modules SRC)
|
||||
set_source_files_properties(${MODULE_SRC} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
|
||||
file(RELATIVE_PATH FNAME ${SRC} ${MODULE_SRC})
|
||||
# Convert the real source file extension to have a .so extension
|
||||
string(REGEX REPLACE "\\.cpp$" ".so" SO ${FNAME})
|
||||
# Convert the real source file extension to have a library extension
|
||||
string(REGEX REPLACE "\\.cpp$" "${CMAKE_SHARED_LIBRARY_SUFFIX}" SO ${FNAME})
|
||||
# Reset linker flags
|
||||
set(TEMP_LDFLAGS)
|
||||
# Reset extra dependencies
|
||||
@@ -111,7 +111,7 @@ macro(build_subdir)
|
||||
list(SORT MODULES_SUBDIR_SRCS)
|
||||
|
||||
GET_FILENAME_COMPONENT(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
set(SO "${FOLDER_NAME}.so")
|
||||
set(SO "${FOLDER_NAME}.${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
|
||||
# Set all the files to use C++ as well as set their compile flags (use the module-specific compile flags, though)
|
||||
set_source_files_properties(${MODULES_SUBDIR_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
|
||||
@@ -55,7 +55,7 @@ void ModuleManager::CleanupRuntimeDirectory()
|
||||
*/
|
||||
static ModuleReturn moduleCopyFile(const Anope::string &name, Anope::string &output)
|
||||
{
|
||||
Anope::string input = Anope::ModuleDir + "/modules/" + name + ".so";
|
||||
Anope::string input = Anope::ModuleDir + "/modules/" + name + DLL_EXT;
|
||||
|
||||
struct stat s;
|
||||
if (stat(input.c_str(), &s) == -1)
|
||||
@@ -133,7 +133,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u)
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Generate the filename for the temporary copy of the module */
|
||||
Anope::string pbuf = Anope::DataDir + "/runtime/" + modname + ".so.XXXXXX";
|
||||
Anope::string pbuf = Anope::DataDir + "/runtime/" + modname + DLL_EXT ".XXXXXX";
|
||||
|
||||
/* Don't skip return value checking! -GD */
|
||||
ModuleReturn ret = moduleCopyFile(modname, pbuf);
|
||||
@@ -146,7 +146,7 @@ ModuleReturn ModuleManager::LoadModule(const Anope::string &modname, User *u)
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
Anope::string pbuf = Anope::ModuleDir + "/modules/" + modname + ".so";
|
||||
Anope::string pbuf = Anope::ModuleDir + "/modules/" + modname + DLL_EXT;
|
||||
#endif
|
||||
|
||||
dlerror();
|
||||
|
||||
Reference in New Issue
Block a user