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

Implemented CMake build system to replace the old autoconf-based build system.

(Note: Although each Makefile was changed, they will be removed later as CMake reconstructs them.)
Also fixed generation of language files and version.h to not rely on the current directory they are in.
Edited Config to send parameters to cmake, but it is no longer a requirement.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1835 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
cyberbotx
2008-12-17 20:16:25 +00:00
parent 1fca479d8e
commit 1cd73b4dad
24 changed files with 9366 additions and 501 deletions
+59
View File
@@ -0,0 +1,59 @@
#if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
# set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
#else(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
# file(RELATIVE_PATH DIR ${Anope_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
# set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/${DIR})
#endif(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
file(GLOB PROTOCOL_SRCS_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
file(GLOB PROTOCOL_SRCS_CPP RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
set(PROTOCOL_SRCS ${PROTOCOL_SRCS_C} ${PROTOCOL_SRCS_CPP})
list(SORT PROTOCOL_SRCS)
#add_custom_target(protocol ALL)
#add_custom_target(modules)
#add_dependencies(protocol build)
set_source_files_properties(${PROTOCOL_SRCS} PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
foreach(SRC ${PROTOCOL_SRCS})
string(REGEX REPLACE "\\.cpp$" ".x" SRC_X ${SRC})
string(REGEX REPLACE "\\.c$" ".o" SRC_O ${SRC_X})
string(REGEX REPLACE "\\.x$" ".o" OBJ ${SRC_O})
#string(REGEX REPLACE "\\." "_" OBJ_TARGET ${OBJ})
string(REGEX REPLACE "\\.o" ".so" SO ${OBJ})
#string(REGEX REPLACE "\\.o" "" SO ${OBJ})
#string(REGEX REPLACE "\\." "_" SO_TARGET ${SO})
#add_custom_command(OUTPUT ${BUILD_DIR}/${OBJ}
# COMMAND ${MY_COMPILER} ${MY_COMP_ARG} ${CMAKE_CXX_CFLAGS} -I${Anope_SOURCE_DIR}/include -c ${SRC} -o ${BUILD_DIR}/${OBJ}
# MAIN_DEPENDENCY ${SRC}
#)
#add_custom_target(modules_${OBJ_TARGET} DEPENDS ${BUILD_DIR}/${OBJ})
#add_custom_command(OUTPUT ${BUILD_DIR}/${SO}
# COMMAND ${MY_COMPILER} ${MY_COMP_ARG} ${CMAKE_CXX_CFLAGS} ${CMAKE_SHARED_LIBRARY_CXX_FLAGS} ${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} ${BUILD_DIR}/${OBJ} -o ${BUILD_DIR}/${SO}
# MAIN_DEPENDENCY ${BUILD_DIR}/${OBJ}
#)
#add_custom_target(protocol_${SO_TARGET} DEPENDS ${BUILD_DIR}/${SO})
#add_dependencies(protocol protocol_${SO_TARGET})
set(HEADERS ${Anope_SOURCE_DIR}/include/services.h ${Anope_SOURCE_DIR}/include/pseudo.h)
if(${SRC}_HEADERS)
foreach(HEADER ${${SRC}_HEADERS})
string(SUBSTRING ${HEADER} 0 1 FIRST_CHAR)
if(FIRST_CHAR STREQUAL "/")
set(HEADERS ${HEADERS} ${HEADER})
else(FIRST_CHAR STREQUAL "/")
set(HEADERS ${HEADERS} ${Anope_SOURCE_DIR}/include/${HEADER})
endif(FIRST_CHAR STREQUAL "/")
endforeach(HEADER)
endif(${SRC}_HEADERS)
if(HEADERS)
set_source_files_properties(${SRC} PROPERTIES OBJECT_DEPENDS "${HEADERS}")
endif(HEADERS)
add_library(${SO} MODULE ${SRC})
add_dependencies(${SO} services)
#set_target_properties(${SO} PROPERTIES PREFIX "" SUFFIX "" COMPILE_FLAGS ${CXXFLAGS})
set_target_properties(${SO} PROPERTIES PREFIX "" SUFFIX "")
install(TARGETS ${SO}
DESTINATION "${DATADIR}/modules"
)
endforeach(SRC)
+362 -36
View File
@@ -1,51 +1,377 @@
include ./Makefile.inc
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.6
MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \
'LDFLAGS=${LDFLAGS}' 'BINDEST=${BINDEST}' 'INSTALL=${INSTALL}' \
'INCLUDEDIR=${INCLUDEDIR}' 'RM=${RM}' 'CP=${CP}' \
'TOUCH=${TOUCH}' 'SHELL=${SHELL}' 'DATDEST=${DATDEST}' \
'RUNGROUP=${RUNGROUP}' 'MODULE_PATH=${MODULE_PATH}' \
'PROFILE=${PROFILE}' 'SHARED=${SHARED}' 'MODULEFLAGS=${MODULEFLAGS}'\
'MAKEBIN=${MAKEBIN}'
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
OBJECTS= $(SRCS:.c=.o)
OBJECTS+= $(SRCS:.cpp=.o)
SO_FILES=$(OBJECTS:.o=.s)
CDEFS= -rdynamic -Wall
#=============================================================================
# Special targets provided by cmake.
all: modules subs
# Disable implicit rules so canoncical targets will work.
.SUFFIXES:
modules: $(OBJECTS) $(SO_FILES)
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
install:
$(CP) ./*.so $(MODULE_PATH)
.SUFFIXES: .hpux_make_needs_suffix_list
distclean: clean spotless
# Suppress display of executed commands.
$(VERBOSE).SILENT:
.c.o:
@$(MAKEBIN) $(CC) ${CFLAGS} ${CDEFS} ${MODULEFLAGS} -I../${INCLUDEDIR} -c $<
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
.cpp.o:
@$(MAKEBIN) $(CC) ${CFLAGS} ${CDEFS} ${MODULEFLAGS} -I../${INCLUDEDIR} -c $<
#=============================================================================
# Set environment variables for the build.
.o.s:
@$(MAKEBIN) $(CC) ${SHARED} ../mod_version.o $< -o $*.so ${PROFILE}
@$(TOUCH) $*.s
# The shell in which to execute make rules.
SHELL = /bin/sh
subs:
@for i in $(SUBS); do \
echo "make all in $$i..."; \
(cd $$i; $(MAKE) $(MAKEARGS) all); done
# The CMake executable.
CMAKE_COMMAND = /usr/local/bin/cmake
subs_clean:
@for i in $(SUBS); do \
echo "cleaning in $$i..."; \
(cd $$i; $(MAKE) clean); done
# The command to remove a file.
RM = /usr/local/bin/cmake -E remove -f
clean: subs_clean
rm -f *.o *.s *.so *.c~ core
# The program to use to edit the cache.
CMAKE_EDIT_COMMAND = /usr/local/bin/ccmake
spotless: subs_clean
rm -f *.o *.s *.so *.c~ core *.so Makefile.inc
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /celes/anope
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /celes/anope
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
cd /celes/anope/src/protocol && /usr/local/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
cd /celes/anope/src/protocol && /usr/local/bin/cmake -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
cd /celes/anope/src/protocol && /usr/local/bin/cmake -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
cd /celes/anope/src/protocol && /usr/local/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: install/local
.PHONY : install/local/fast
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
cd /celes/anope/src/protocol && /usr/local/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: install/strip
.PHONY : install/strip/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
cd /celes/anope/src/protocol && /usr/local/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
cd /celes/anope && $(CMAKE_COMMAND) -E cmake_progress_start /celes/anope/CMakeFiles /celes/anope/src/protocol/CMakeFiles/progress.make
cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 src/protocol/all
$(CMAKE_COMMAND) -E cmake_progress_start /celes/anope/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 src/protocol/clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 src/protocol/preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 src/protocol/preinstall
.PHONY : preinstall/fast
# clear depends
depend:
cd /celes/anope && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
# Convenience name for target.
src/protocol/CMakeFiles/bahamut.so.dir/rule:
cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 src/protocol/CMakeFiles/bahamut.so.dir/rule
.PHONY : src/protocol/CMakeFiles/bahamut.so.dir/rule
# Convenience name for target.
bahamut.so: src/protocol/CMakeFiles/bahamut.so.dir/rule
.PHONY : bahamut.so
# fast build rule for target.
bahamut.so/fast:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/bahamut.so.dir/build.make src/protocol/CMakeFiles/bahamut.so.dir/build
.PHONY : bahamut.so/fast
# Convenience name for target.
src/protocol/CMakeFiles/inspircd11.so.dir/rule:
cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 src/protocol/CMakeFiles/inspircd11.so.dir/rule
.PHONY : src/protocol/CMakeFiles/inspircd11.so.dir/rule
# Convenience name for target.
inspircd11.so: src/protocol/CMakeFiles/inspircd11.so.dir/rule
.PHONY : inspircd11.so
# fast build rule for target.
inspircd11.so/fast:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/inspircd11.so.dir/build.make src/protocol/CMakeFiles/inspircd11.so.dir/build
.PHONY : inspircd11.so/fast
# Convenience name for target.
src/protocol/CMakeFiles/inspircd12.so.dir/rule:
cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 src/protocol/CMakeFiles/inspircd12.so.dir/rule
.PHONY : src/protocol/CMakeFiles/inspircd12.so.dir/rule
# Convenience name for target.
inspircd12.so: src/protocol/CMakeFiles/inspircd12.so.dir/rule
.PHONY : inspircd12.so
# fast build rule for target.
inspircd12.so/fast:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/inspircd12.so.dir/build.make src/protocol/CMakeFiles/inspircd12.so.dir/build
.PHONY : inspircd12.so/fast
# Convenience name for target.
src/protocol/CMakeFiles/ratbox.so.dir/rule:
cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 src/protocol/CMakeFiles/ratbox.so.dir/rule
.PHONY : src/protocol/CMakeFiles/ratbox.so.dir/rule
# Convenience name for target.
ratbox.so: src/protocol/CMakeFiles/ratbox.so.dir/rule
.PHONY : ratbox.so
# fast build rule for target.
ratbox.so/fast:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/ratbox.so.dir/build.make src/protocol/CMakeFiles/ratbox.so.dir/build
.PHONY : ratbox.so/fast
# Convenience name for target.
src/protocol/CMakeFiles/unreal32.so.dir/rule:
cd /celes/anope && $(MAKE) -f CMakeFiles/Makefile2 src/protocol/CMakeFiles/unreal32.so.dir/rule
.PHONY : src/protocol/CMakeFiles/unreal32.so.dir/rule
# Convenience name for target.
unreal32.so: src/protocol/CMakeFiles/unreal32.so.dir/rule
.PHONY : unreal32.so
# fast build rule for target.
unreal32.so/fast:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/unreal32.so.dir/build.make src/protocol/CMakeFiles/unreal32.so.dir/build
.PHONY : unreal32.so/fast
bahamut.o: bahamut.c.o
.PHONY : bahamut.o
# target to build an object file
bahamut.c.o:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/bahamut.so.dir/build.make src/protocol/CMakeFiles/bahamut.so.dir/bahamut.c.o
.PHONY : bahamut.c.o
bahamut.i: bahamut.c.i
.PHONY : bahamut.i
# target to preprocess a source file
bahamut.c.i:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/bahamut.so.dir/build.make src/protocol/CMakeFiles/bahamut.so.dir/bahamut.c.i
.PHONY : bahamut.c.i
bahamut.s: bahamut.c.s
.PHONY : bahamut.s
# target to generate assembly for a file
bahamut.c.s:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/bahamut.so.dir/build.make src/protocol/CMakeFiles/bahamut.so.dir/bahamut.c.s
.PHONY : bahamut.c.s
inspircd11.o: inspircd11.c.o
.PHONY : inspircd11.o
# target to build an object file
inspircd11.c.o:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/inspircd11.so.dir/build.make src/protocol/CMakeFiles/inspircd11.so.dir/inspircd11.c.o
.PHONY : inspircd11.c.o
inspircd11.i: inspircd11.c.i
.PHONY : inspircd11.i
# target to preprocess a source file
inspircd11.c.i:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/inspircd11.so.dir/build.make src/protocol/CMakeFiles/inspircd11.so.dir/inspircd11.c.i
.PHONY : inspircd11.c.i
inspircd11.s: inspircd11.c.s
.PHONY : inspircd11.s
# target to generate assembly for a file
inspircd11.c.s:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/inspircd11.so.dir/build.make src/protocol/CMakeFiles/inspircd11.so.dir/inspircd11.c.s
.PHONY : inspircd11.c.s
inspircd12.o: inspircd12.cpp.o
.PHONY : inspircd12.o
# target to build an object file
inspircd12.cpp.o:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/inspircd12.so.dir/build.make src/protocol/CMakeFiles/inspircd12.so.dir/inspircd12.cpp.o
.PHONY : inspircd12.cpp.o
inspircd12.i: inspircd12.cpp.i
.PHONY : inspircd12.i
# target to preprocess a source file
inspircd12.cpp.i:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/inspircd12.so.dir/build.make src/protocol/CMakeFiles/inspircd12.so.dir/inspircd12.cpp.i
.PHONY : inspircd12.cpp.i
inspircd12.s: inspircd12.cpp.s
.PHONY : inspircd12.s
# target to generate assembly for a file
inspircd12.cpp.s:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/inspircd12.so.dir/build.make src/protocol/CMakeFiles/inspircd12.so.dir/inspircd12.cpp.s
.PHONY : inspircd12.cpp.s
ratbox.o: ratbox.c.o
.PHONY : ratbox.o
# target to build an object file
ratbox.c.o:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/ratbox.so.dir/build.make src/protocol/CMakeFiles/ratbox.so.dir/ratbox.c.o
.PHONY : ratbox.c.o
ratbox.i: ratbox.c.i
.PHONY : ratbox.i
# target to preprocess a source file
ratbox.c.i:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/ratbox.so.dir/build.make src/protocol/CMakeFiles/ratbox.so.dir/ratbox.c.i
.PHONY : ratbox.c.i
ratbox.s: ratbox.c.s
.PHONY : ratbox.s
# target to generate assembly for a file
ratbox.c.s:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/ratbox.so.dir/build.make src/protocol/CMakeFiles/ratbox.so.dir/ratbox.c.s
.PHONY : ratbox.c.s
unreal32.o: unreal32.c.o
.PHONY : unreal32.o
# target to build an object file
unreal32.c.o:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/unreal32.so.dir/build.make src/protocol/CMakeFiles/unreal32.so.dir/unreal32.c.o
.PHONY : unreal32.c.o
unreal32.i: unreal32.c.i
.PHONY : unreal32.i
# target to preprocess a source file
unreal32.c.i:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/unreal32.so.dir/build.make src/protocol/CMakeFiles/unreal32.so.dir/unreal32.c.i
.PHONY : unreal32.c.i
unreal32.s: unreal32.c.s
.PHONY : unreal32.s
# target to generate assembly for a file
unreal32.c.s:
cd /celes/anope && $(MAKE) -f src/protocol/CMakeFiles/unreal32.so.dir/build.make src/protocol/CMakeFiles/unreal32.so.dir/unreal32.c.s
.PHONY : unreal32.c.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... bahamut.so"
@echo "... edit_cache"
@echo "... inspircd11.so"
@echo "... inspircd12.so"
@echo "... install"
@echo "... install/local"
@echo "... install/strip"
@echo "... list_install_components"
@echo "... ratbox.so"
@echo "... rebuild_cache"
@echo "... unreal32.so"
@echo "... bahamut.o"
@echo "... bahamut.i"
@echo "... bahamut.s"
@echo "... inspircd11.o"
@echo "... inspircd11.i"
@echo "... inspircd11.s"
@echo "... inspircd12.o"
@echo "... inspircd12.i"
@echo "... inspircd12.s"
@echo "... ratbox.o"
@echo "... ratbox.i"
@echo "... ratbox.s"
@echo "... unreal32.o"
@echo "... unreal32.i"
@echo "... unreal32.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
cd /celes/anope && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system