1
0
mirror of https://github.com/anope/anope.git synced 2026-07-10 09:23:14 +02:00

Moved some files and diretories around, made cmake skip files it knows it can't compile because of missing dependices.

This commit is contained in:
Adam
2010-07-15 22:55:02 -04:00
parent 43b1e43afb
commit a22f8d3b2d
190 changed files with 324 additions and 479 deletions
+6 -5
View File
@@ -68,7 +68,7 @@ else(MINOR_VERSION GREATER 5)
endif(MINOR_VERSION GREATER 5)
# Override the module include path to include our directory, for our Anope.cmake, as well as we are using our own version of the NSIS template
set(CMAKE_MODULE_PATH ${Anope_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${Anope_SOURCE_DIR}/cmake)
include(Anope)
@@ -411,7 +411,7 @@ set(VERSION_FULL_NOBUILD "${VERSION_DOTTED_NOBUILD}${VERSION_EXTRA}")
# Only do the following for Windows
if(WIN32)
# Generate the win32.rc file using the above variables
configure_file(${Anope_SOURCE_DIR}/src/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32.rc)
configure_file(${Anope_SOURCE_DIR}/src/win32/win32.rc.cmake ${Anope_BINARY_DIR}/src/win32/win32.rc)
endif(WIN32)
# Add the initial files to ignore which will be ignored regardless of if you are building in-source or out-of-source
@@ -435,6 +435,7 @@ add_subdirectory(data)
add_subdirectory(docs)
add_subdirectory(lang)
add_subdirectory(src)
add_subdirectory(modules)
add_subdirectory(include)
# Get the filename of the Anope binary, to use later
@@ -454,7 +455,7 @@ if(NOT WIN32 AND RUNGROUP)
endif(NOT WIN32 AND RUNGROUP)
# On Windows platforms, install extra files
if(WIN32)
install(FILES ${Anope_SOURCE_DIR}/anope.bat
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
DESTINATION bin
)
install(FILES ${Anope_SOURCE_DIR}/docs/Changes ${Anope_SOURCE_DIR}/docs/Changes.conf ${Anope_SOURCE_DIR}/docs/Changes.lang
@@ -490,8 +491,8 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
)
# The following doesn't work, but a bug report has been filed about it
#set(CPACK_CREATE_DESKTOP_LINK_${SERVICES_BINARY} TRUE)
set(CPACK_NSIS_MUI_ICON "${Anope_SOURCE_DIR}/src\\\\anope-icon.ico")
set(CPACK_NSIS_MUI_UNIICON "${Anope_SOURCE_DIR}/src\\\\anope-icon.ico")
set(CPACK_NSIS_MUI_ICON "${Anope_SOURCE_DIR}/src\\\\win32\\\\anope-icon.ico")
set(CPACK_NSIS_MUI_UNIICON "${Anope_SOURCE_DIR}/src\\\\win32\\\\anope-icon.ico")
set(CPACK_NSIS_INSTALLED_ICON_NAME "${SERVICES_BINARY}")
set(CPACK_NSIS_URL_INFO_ABOUT "http://www.anope.org/")
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
+67 -28
View File
@@ -359,12 +359,12 @@ macro(find_includes SRC INCLUDES)
endmacro(find_includes)
###############################################################################
# calculate_depends(<source filename> [<optional output variable for includes>])
# calculate_depends(<source filename> <output variable set to TRUE on fail> [<optional output variable for includes>])
#
# This macro is used in most of the src (sub)directories to calculate the
# header file dependencies for the given source file.
###############################################################################
macro(calculate_depends SRC)
macro(calculate_depends SRC SKIP)
# Temporarily set that we didn't get a 2nd argument before we actually check if we did get one or not
set(CHECK_ANGLE_INCLUDES FALSE)
# Check for a second argument
@@ -375,6 +375,8 @@ macro(calculate_depends SRC)
find_includes(${SRC} INCLUDES)
# Reset the list of headers to empty
set(HEADERS)
# Reset skip
set(${SKIP} FALSE)
# Iterate through the strings containing #include (if any)
foreach(INCLUDE ${INCLUDES})
# Extract the filename from the #include line
@@ -398,7 +400,8 @@ macro(calculate_depends SRC)
endif(FOUND_IN_INCLUDES EQUAL -1)
endif(FOUND_IN_DEFAULTS EQUAL -1)
else(FOUND_${FILENAME}_INCLUDE)
message(FATAL_ERROR "${SRC} needs header file ${FILENAME} but we were unable to locate that header file! Check that the header file is within the search path of your OS.")
set(${SKIP} TRUE)
message("${SRC} needs header file ${FILENAME} but we were unable to locate that header file! Check that the header file is within the search path of your OS.")
endif(FOUND_${FILENAME}_INCLUDE)
endif(CHECK_ANGLE_INCLUDES)
endif(QUOTE_TYPE STREQUAL "angle brackets")
@@ -406,12 +409,12 @@ macro(calculate_depends SRC)
endmacro(calculate_depends)
###############################################################################
# calculate_libraries(<source filename> <output variable for linker flags> <output variable for extra depends>)
# calculate_libraries(<source filename> <output variable set to TRUE on fail> <output variable for linker flags> <output variable for extra depends>)
#
# This macro is used in most of the src (sub)directories to calculate the
# This macro is used in most of the module (sub)directories to calculate the
# library dependencies for the given source file.
###############################################################################
macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
macro(calculate_libraries SRC SKIP SRC_LDFLAGS EXTRA_DEPENDS)
# Set up a temporary LDFLAGS for this file
set(THIS_LDFLAGS "${LDFLAGS}")
# Reset extra dependencies
@@ -420,6 +423,8 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
set(LIBRARY_PATHS)
# Reset libraries
set(LIBRARIES)
# Default to not skipping this file
set(${SKIP} FALSE)
# Check to see if there are any lines matching: /* RequiredLibraries: [something] */
read_from_file(${SRC} "/\\\\*[ \t]*RequiredLibraries:[ \t]*.*[ \t]*\\\\*/" REQUIRED_LIBRARIES)
# Iterate through those lines
@@ -449,34 +454,68 @@ macro(calculate_libraries SRC SRC_LDFLAGS EXTRA_DEPENDS)
append_to_list(LIBRARIES "${LIBRARY}")
endif(MSVC)
else(FOUND_${LIBRARY}_LIBRARY)
# Skip this file
set(${SKIP} TRUE)
# In the case of the library not being found, we fatally error so CMake stops trying to generate
message(FATAL_ERROR "${SRC} needs library ${LIBRARY} but we were unable to locate that library! Check that the library is within the search path of your OS.")
message("${SRC} needs library ${LIBRARY} but we were unable to locate that library! Check that the library is within the search path of your OS.")
endif(FOUND_${LIBRARY}_LIBRARY)
endforeach(LIBRARY)
endforeach(REQUIRED_LIBRARY)
# Remove duplicates from the library paths
if(LIBRARY_PATHS)
remove_list_duplicates(LIBRARY_PATHS)
endif(LIBRARY_PATHS)
# Remove diplicates from the libraries
if(LIBRARIES)
remove_list_duplicates(LIBRARIES)
endif(LIBRARIES)
# Iterate through library paths and add them to the linker flags
foreach(LIBRARY_PATH ${LIBRARY_PATHS})
find_in_list(DEFAULT_LIBRARY_DIRS "${LIBRARY_PATH}" FOUND_IN_DEFAULTS)
if(FOUND_IN_DEFAULTS EQUAL -1)
set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}")
endif(FOUND_IN_DEFAULTS EQUAL -1)
endforeach(LIBRARY_PATH)
# Iterate through libraries and add them to the linker flags
foreach(LIBRARY ${LIBRARIES})
set(THIS_LDFLAGS "${THIS_LDFLAGS} -l${LIBRARY}")
endforeach(LIBRARY)
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
if(NOT ${SKIP})
# Remove duplicates from the library paths
if(LIBRARY_PATHS)
remove_list_duplicates(LIBRARY_PATHS)
endif(LIBRARY_PATHS)
# Remove diplicates from the libraries
if(LIBRARIES)
remove_list_duplicates(LIBRARIES)
endif(LIBRARIES)
# Iterate through library paths and add them to the linker flags
foreach(LIBRARY_PATH ${LIBRARY_PATHS})
find_in_list(DEFAULT_LIBRARY_DIRS "${LIBRARY_PATH}" FOUND_IN_DEFAULTS)
if(FOUND_IN_DEFAULTS EQUAL -1)
set(THIS_LDFLAGS "${THIS_LDFLAGS} -L${LIBRARY_PATH}")
endif(FOUND_IN_DEFAULTS EQUAL -1)
endforeach(LIBRARY_PATH)
# Iterate through libraries and add them to the linker flags
foreach(LIBRARY ${LIBRARIES})
set(THIS_LDFLAGS "${THIS_LDFLAGS} -l${LIBRARY}")
endforeach(LIBRARY)
set(${SRC_LDFLAGS} "${THIS_LDFLAGS}")
set(${EXTRA_DEPENDS} "${EXTRA_DEPENDENCIES}")
endif(NOT ${SKIP})
endmacro(calculate_libraries)
###############################################################################
# check_functions(<source filename> <output variable set to TRUE on success>)
#
# This macro is used in most of the module (sub)directories to calculate the
# fcuntion dependencies for the given source file.
###############################################################################
macro(check_functions SRC SUCCESS)
# Default to true
set(${SUCCESS} TRUE)
# Check to see if there are any lines matching: /* RequiredFunctions: [something] */
read_from_file(${SRC} "/\\\\*[ \t]*RequiredFunctions:[ \t]*.*[ \t]*\\\\*/" REQUIRED_FUNCTIONS)
# Iterate through those lines
foreach(REQUIRED_FUNCTION ${REQUIRED_FUNCTIONS})
# Strip off the /* RequiredFunctions: and */ from the line
string(REGEX REPLACE "/\\*[ \t]*RequiredFunctions:[ \t]*([^ \t]*)[ \t]*\\*/" "\\1" REQUIRED_FUNCTION ${REQUIRED_FUNCTION})
# Replace all commas with semicolons
string(REGEX REPLACE "," ";" REQUIRED_FUNCTION ${REQUIRED_FUNCTION})
# Iterate through the functions given
foreach(FUNCTION ${REQUIRED_FUNCTION})
# Check if the function exists
check_function_exists(${REQUIRED_FUNCTION} HAVE_${REQUIRED_FUNCTION})
# If we don't have the function warn the user and set SUCCESS to FALSE
if(NOT HAVE_${REQUIRED_FUNCTION})
message("${SRC} needs function ${REQUIRED_FUNCTION} but we were unable to locate that function!")
set(${SUCCESS} FALSE)
endif(NOT HAVE_${REQUIRED_FUNCTION})
endforeach(FUNCTION)
endforeach(REQUIRED_FUNCTION)
endmacro(check_functions)
###############################################################################
# add_to_cpack_ignored_files(<item> [TRUE])
#
+1 -1
View File
@@ -7,7 +7,7 @@ if(WIN32)
# Add README.txt to list of files for CPack to ignore
add_to_cpack_ignored_files("README.txt$" TRUE)
endif(IN_SOURCE)
set(DOCS DEFCON FAQ INSTALL MODULES NEWS PROXY ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
set(DOCS DEFCON FAQ INSTALL MODULES NEWS ${CMAKE_CURRENT_BINARY_DIR}/README.txt WIN32.txt)
install(FILES ${DOCS}
DESTINATION docs
)
-41
View File
@@ -1,41 +0,0 @@
Anope Proxy Detector
--------------------
1) Introduction
2) Alternatives
1) Introduction
Anope has had a built-in proxy detector since it's first version. Recently,
however, this built-in proxy detector has been removed. This was because
the Anope team found that the proxy detector was showing it's age, and the
time needed to restore it to a good state wasn't worth it, also considering
that there are currently good alternatives out there which do the job as
good as it can be done already.
2) Alternatives
A) Blitzed Open Proxy Monitor (BOPM)
B) NeoStats + OPSB
Note that these are seperate projects and that the Anope team won't give
support on these programs. For support, please refer to the sites of the
creators of the software packages.
A) Blitzed Open Proxy Monitor (BOPM)
URL: http://wiki.blitzed.org/BOPM
BOPM is currently the leading proxy detector for IRC networks out
there. Altough it is not designed to run on a central place for the
entire network, it can be done with some minor tweaking on most IRCd's.
The Anope Team advises BOPM for the best security.
B) NeoStats + OPSB
URL: http://www.neostats.net/
NeoStats is the swiss knife of IRC tools. In combination with the OPSB
module by NeoStats Software, it can scan for proxies in a similar way
as BOPM does. The OPSB module is based on BOPM and has been adjusted to
be able to scan all clients from one centralized proxy detector.
+13
View File
@@ -13,6 +13,19 @@
#ifndef HASHCOMP_H
#define HASHCOMP_H
#ifdef _WIN32
# ifdef MODULE_COMPILE
# define CoreExport __declspec(dllimport)
# define DllExport __declspec(dllexport)
# else
# define CoreExport __declspec(dllexport)
# define DllExport __declspec(dllimport)
# endif
#else
# define CoreExport
# define DllExport
#endif
#include <string>
#ifndef _WIN32
+187
View File
@@ -0,0 +1,187 @@
# Get a list of ALL files and directories within the current directory
file(GLOB MODULES_FOLDERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
remove_item_from_list(MODULES_FOLDERS "CMakeFiles")
# If using Windows, add the MODULE_COMPILE define
if(WIN32)
add_definitions(-DMODULE_COMPILE)
endif(WIN32)
# Iterate through the directories
foreach(MODULE_FOLDER ${MODULES_FOLDERS})
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_FOLDER}")
# Get a list of all .cpp files in this directory
file(GLOB MODULES_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${MODULE_FOLDER}/*.cpp")
sort_list(MODULES_SRCS)
# 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_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
# Create an empty list to store extra include directories
set(EXTRA_INCLUDES)
# Get the length of the folder name
string(LENGTH ${MODULE_FOLDER} FOLDER_LEN)
# Add one (the /)
math(EXPR FOLDER_LEN "${FOLDER_LEN} + 1")
# Iterate through all the source files
foreach(SRC ${MODULES_SRCS})
# Get the length of the new source file
string(LENGTH ${SRC} SRC_LEN)
# Set FILE_LEN to the length of the source file minus folder length
math(EXPR FILE_LEN "${SRC_LEN} - ${FOLDER_LEN}")
# Get the real name of the source file now
string(SUBSTRING ${SRC} ${FOLDER_LEN} ${FILE_LEN} SRC_REALNAME)
# Convert the real source file extension to have a .so extension
string(REGEX REPLACE "\\.cpp$" ".so" SO ${SRC_REALNAME})
# Reset skip_depends
set(SKIP_DEPENDS)
# Temporary variable for the current source's include directories
set(TEMP_INCLUDES)
# Calculate the header file dependencies for the given source file
calculate_depends(${SRC} SKIP_DEPENDS TEMP_INCLUDES)
# If there were some extra include directories, add them to the list
if(TEMP_INCLUDES)
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
endif(TEMP_INCLUDES)
# Reset linker flags
set(TEMP_LDFLAGS)
# Reset extra dependencies
set(TEMP_DEPENDENCIES)
# Reset skip_libraries
set(SKIP_LIBRARIES)
# Calculate the library dependencies for the given source file
calculate_libraries(${SRC} SKIP_LIBRARIES TEMP_LDFLAGS TEMP_DEPENDENCIES)
if(NOT SKIP AND NOT SKIP_LIBRARIES)
# Reset has_function
set(HAS_FUNCTION)
# Check the function dependencies for the given source file
check_functions(${SRC} HAS_FUNCTION)
# Only continue if this module has all of the required functions
if(HAS_FUNCTION)
# For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
if(MSVC)
set(WIN32_MEMORY win32_memory)
else(MSVC)
set(WIN32_MEMORY)
endif(MSVC)
# Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand
add_library(${SO} MODULE ${SRC})
set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${TEMP_LDFLAGS}")
add_dependencies(${SO} ${PROGRAM_NAME})
# For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
if(WIN32)
target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY} ${TEMP_DEPENDENCIES})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${SO}
DESTINATION data/modules
)
endif(HAS_FUNCTION)
endif(NOT SKIP AND NOT SKIP_LIBRARIES)
endforeach(SRC)
# Get a list of ALL files and directories within this modules directory
file(GLOB SUBMODULE_DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${MODULE_FOLDER}/*")
remove_item_from_list(SUBMODULE_DIRS "CMakeFiles")
remove_item_from_list(SUBMODULE_DIRS "extra/mysql") # XXX till sql is fixed
foreach(SUBDIR ${SUBMODULE_DIRS})
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}")
file(GLOB MODULES_SUBDIR_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${SUBDIR}/*.cpp")
sort_list(MODULES_SUBDIR_SRCS)
# 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}")
# Get the length of this subdir
string(LENGTH ${SUBDIR} SUBDIR_LEN)
# Calculate the length of the folder
math(EXPR FILE_LEN "${SUBDIR_LEN} - ${FOLDER_LEN}")
# Extract this subfolders name to use to generate the .so file
string(SUBSTRING ${SUBDIR} ${FOLDER_LEN} ${FILE_LEN} SUBDIR_REALNAME)
# Add .so to the end of the directory name, this will be the module's name
set(SO "${SUBDIR_REALNAME}.so")
# Temporary linker flags for this subdirectory
set(SUBDIR_LDFLAGS "${LDFLAGS}")
# Temporary extra dependencies for this subdirectory
set(SUBDIR_EXTRA_DEPENDS)
# Reset skip_depends
set(SKIP_DEPENDS)
# Reset skip_libraries
set(SKIP_LIBRARIES)
# Reset has_function
set(HAS_FUNCTION TRUE)
# Iterate through the source files in the subdirectory
foreach(SRC ${MODULES_SUBDIR_SRCS})
if(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES AND HAS_FUNCTION)
# Temporary variable for the current source's include directories
set(TEMP_INCLUDES)
# Calculate the header file dependencies for the given source file
calculate_depends(${SRC} SKIP_DEPENDS TEMP_INCLUDES)
# If there were some extra include directories, add them to the list
if(TEMP_INCLUDES)
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
endif(TEMP_INCLUDES)
# Reset linker flags
set(TEMP_LDFLAGS)
# Reset extra dependencies
set(TEMP_DEPENDENCIES)
# Calculate the library dependencies for the given source file
calculate_libraries(${SRC} SKIP_LIBRARIES TEMP_LDFLAGS TEMP_DEPENDENCIES)
# Check the function dependencies for the given source file
check_functions(${SRC} HAS_FUNCTION)
# Append this source file's linker flags to the subdirectoy's linker flags, if there are any to append
if(TEMP_DEPENDENCIES)
append_to_list(SUBDIR_EXTRA_DEPENDS ${TEMP_DEPDENCIES})
endif(TEMP_DEPENDENCIES)
endif(NOT SKIP_DEPENDS AND NOT SKIP_LIBRARIES AND HAS_FUNCTION)
endforeach(SRC)
# Continue if library and function requirements are met
if(NOT SKIP AND HAS_FUNCTION)
# Remove duplicates from the linker flags
if(SUBDIR_LDFLAGS)
remove_list_duplicates(SUBDIR_LDFLAGS)
endif(SUBDIR_LDFLAGS)
# Remove duplicates from the extra dependencies
if(SUBDIR_EXTRA_DEPENDS)
remove_list_duplicates(SUBDIR_EXTRA_DEPENDS)
endif(SUBDIR_EXTRA_DEPENDS)
# For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
if(MSVC)
set(WIN32_MEMORY win32_memory)
else(MSVC)
set(WIN32_MEMORY)
endif(MSVC)
# Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand
add_library(${SO} MODULE ${MODULES_SUBDIR_SRCS})
set_target_properties(${SO} PROPERTIES LINKER_LANGUAGE CXX PREFIX "" SUFFIX "" LINK_FLAGS "${SUBDIR_LDFLAGS}")
add_dependencies(${SO} ${PROGRAM_NAME})
# For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
if(WIN32)
target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY} ${SUBDIR_EXTRA_DEPENDS})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
install(TARGETS ${SO}
DESTINATION data/modules
)
endif(NOT SKIP AND HAS_FUNCTION)
endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}")
endforeach(SUBDIR)
endif(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_FOLDER}")
endforeach(MODULE_FOLDER)
# If there were extra include directories, remove the duplicates and add the directories to the include path
if(EXTRA_INCLUDES)
remove_list_duplicates(EXTRA_INCLUDES)
include_directories(${EXTRA_INCLUDES})
endif(EXTRA_INCLUDES)

Some files were not shown because too many files have changed in this diff Show More