mirror of
https://github.com/anope/anope.git
synced 2026-06-12 17:04:47 +02:00
Clean up more obsolete build system cruft.
This commit is contained in:
+4
-4
@@ -243,11 +243,11 @@ endif()
|
||||
|
||||
# Get the filename of the Anope binary, to use later
|
||||
set(SERVICES_BINARY "$<TARGET_FILE:${PROGRAM_NAME}>")
|
||||
get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME)
|
||||
cmake_path(GET SERVICES_BINARY FILENAME SERVICES_BINARY)
|
||||
|
||||
# At install time, create the following additional directories
|
||||
get_filename_component(ABSOLUTE_DATA_DIR ${DATA_DIR} REALPATH BASE_DIR ${CMAKE_INSTALL_PREFIX})
|
||||
get_filename_component(ABSOLUTE_LOG_DIR ${LOG_DIR} REALPATH BASE_DIR ${CMAKE_INSTALL_PREFIX})
|
||||
file(REAL_PATH ${DATA_DIR} ABSOLUTE_DATA_DIR BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX})
|
||||
file(REAL_PATH ${LOG_DIR} ABSOLUTE_LOG_DIR BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX})
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ABSOLUTE_DATA_DIR}/backups\")")
|
||||
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ABSOLUTE_LOG_DIR}\")")
|
||||
if(WIN32)
|
||||
@@ -266,7 +266,7 @@ if(WIN32)
|
||||
)
|
||||
endif()
|
||||
|
||||
get_filename_component(ABSOLUTE_MODULE_DIR ${MODULE_DIR} REALPATH BASE_DIR ${CMAKE_INSTALL_PREFIX})
|
||||
file(REAL_PATH ${MODULE_DIR} ABSOLUTE_MODULE_DIR BASE_DIRECTORY ${CMAKE_INSTALL_PREFIX})
|
||||
install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${ABSOLUTE_MODULE_DIR}\")")
|
||||
|
||||
# Only process the CPack section if we have CPack
|
||||
|
||||
@@ -33,29 +33,29 @@ Run_Build_System () {
|
||||
EXTRA_LIBS=""
|
||||
|
||||
if [ "$INSTDIR" != "" ] ; then
|
||||
WITH_INST="-DINSTDIR:STRING=$INSTDIR"
|
||||
WITH_INST="-DINSTDIR=$INSTDIR"
|
||||
fi
|
||||
|
||||
if [ "$RUNGROUP" != "" ] ; then
|
||||
WITH_RUN="-DRUNGROUP:STRING=$RUNGROUP"
|
||||
WITH_RUN="-DRUNGROUP=$RUNGROUP"
|
||||
fi
|
||||
|
||||
if [ "$UMASK" != "" ] ; then
|
||||
WITH_PERM="-DDEFUMASK:STRING=$UMASK"
|
||||
WITH_PERM="-DDEFUMASK=$UMASK"
|
||||
fi
|
||||
|
||||
if [ "$DEBUG" = "yes" ] ; then
|
||||
BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=Debug"
|
||||
BUILD_TYPE="-DCMAKE_BUILD_TYPE=Debug"
|
||||
else
|
||||
BUILD_TYPE="-DCMAKE_BUILD_TYPE:STRING=Release"
|
||||
BUILD_TYPE="-DCMAKE_BUILD_TYPE=Release"
|
||||
fi
|
||||
|
||||
if [ "$EXTRA_INCLUDE_DIRS" != "" ] ; then
|
||||
EXTRA_INCLUDE="-DEXTRA_INCLUDE:STRING=$EXTRA_INCLUDE_DIRS"
|
||||
EXTRA_INCLUDE="-DEXTRA_INCLUDE=$EXTRA_INCLUDE_DIRS"
|
||||
fi
|
||||
|
||||
if [ "$EXTRA_LIB_DIRS" != "" ] ; then
|
||||
EXTRA_LIBS="-DEXTRA_LIBS:STRING=$EXTRA_LIB_DIRS"
|
||||
EXTRA_LIBS="-DEXTRA_LIBS=$EXTRA_LIB_DIRS"
|
||||
fi
|
||||
|
||||
BUILD_PATHS="-B ${SOURCE_DIR}/build ${SOURCE_DIR}"
|
||||
|
||||
@@ -11,7 +11,7 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h ${CMAKE_CURRENT_
|
||||
DEPENDS version-bin ${SRC_SRCS}
|
||||
)
|
||||
# Add version-bin to list of files for CPack to ignore
|
||||
get_filename_component(version_BINARY ${version_BINARY} NAME)
|
||||
cmake_path(GET version_BINARY FILENAME version_BINARY)
|
||||
add_to_cpack_ignored_files("${version_BINARY}$" TRUE)
|
||||
if(NOT WIN32)
|
||||
add_to_cpack_ignored_files("version.h$" TRUE)
|
||||
|
||||
+6
-19
@@ -54,17 +54,10 @@ macro(build_module SRC MODULE_SRC)
|
||||
add_library(${SO} MODULE ${MODULE_SRC})
|
||||
# Execute inline CMake code for the module
|
||||
inline_cmake(${SO} ${MODULE_SRC})
|
||||
# Windows requires this because it's weird
|
||||
if(WIN32)
|
||||
set(WIN32_NO_LIBS "/nodefaultlib:\"libcmt.lib\" /OPT:NOREF")
|
||||
else()
|
||||
set(WIN32_NO_LIBS)
|
||||
endif()
|
||||
set_target_properties(${SO} PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH ON
|
||||
FOLDER "Modules"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON
|
||||
LINK_FLAGS "${WIN32_NO_LIBS}"
|
||||
PREFIX ""
|
||||
SUFFIX ""
|
||||
)
|
||||
@@ -72,9 +65,9 @@ macro(build_module SRC MODULE_SRC)
|
||||
if(HAVE_LOCALIZATION)
|
||||
add_dependencies(${SO} module_language)
|
||||
endif()
|
||||
# For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set its version
|
||||
# For Windows only, have the module link to the export library of Anope as well as Winsock (most of the modules probably don't need this, but this is to be on the safe side)
|
||||
if(WIN32)
|
||||
target_link_libraries(${SO} PUBLIC ${PROGRAM_NAME} wsock32 Ws2_32 ${WIN32_MEMORY})
|
||||
target_link_libraries(${SO} PUBLIC ${PROGRAM_NAME} "Ws2_32" ${WIN32_MEMORY})
|
||||
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
|
||||
elseif(APPLE)
|
||||
target_link_libraries(${SO} PUBLIC ${PROGRAM_NAME})
|
||||
@@ -105,17 +98,12 @@ macro(build_subdir)
|
||||
file(GLOB_RECURSE MODULES_SUBDIR_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} CONFIGURE_DEPENDS "*.cpp")
|
||||
list(SORT MODULES_SUBDIR_SRCS)
|
||||
|
||||
GET_FILENAME_COMPONENT(FOLDER_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
cmake_path(GET CMAKE_CURRENT_SOURCE_DIR FILENAME FOLDER_NAME)
|
||||
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}")
|
||||
|
||||
# Remove duplicates from the linker flags
|
||||
if(SUBDIR_LDFLAGS)
|
||||
list(REMOVE_DUPLICATES SUBDIR_LDFLAGS)
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
@@ -129,7 +117,6 @@ macro(build_subdir)
|
||||
BUILD_WITH_INSTALL_RPATH ON
|
||||
FOLDER "Modules"
|
||||
INSTALL_RPATH_USE_LINK_PATH ON
|
||||
LINK_FLAGS "${SUBDIR_LDFLAGS}"
|
||||
PREFIX ""
|
||||
SUFFIX ""
|
||||
)
|
||||
@@ -137,10 +124,10 @@ macro(build_subdir)
|
||||
if(HAVE_LOCALIZATION)
|
||||
add_dependencies(${SO} module_language)
|
||||
endif()
|
||||
# For Windows only, have the module link to the export library of Anope as well as wsock32 and Ws2_32 libraries (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
|
||||
# For Windows only, have the module link to the export library of Anope as well Winsock (most of the modules probably don't need this, but this is to be on the safe side)
|
||||
if(WIN32)
|
||||
target_link_libraries(${SO} PUBLIC ${PROGRAM_NAME} PUBLIC wsock32 Ws2_32 ${WIN32_MEMORY})
|
||||
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
|
||||
target_link_libraries(${SO} PUBLIC ${PROGRAM_NAME} PUBLIC "Ws2_32" ${WIN32_MEMORY})
|
||||
set_target_properties(${SO} PROPERTIES VERSION "${VERSION_DOTTED}")
|
||||
elseif(APPLE)
|
||||
target_link_libraries(${SO} PUBLIC ${PROGRAM_NAME})
|
||||
endif()
|
||||
|
||||
+9
-5
@@ -39,18 +39,22 @@ if(MSVC)
|
||||
set_source_files_properties(win32/win32_memory.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
|
||||
add_library(win32_memory STATIC win32/win32_memory.cpp)
|
||||
set(WIN32_MEMORY win32_memory)
|
||||
set(EXTRA_LDFLAGS "/OPT:NOREF") # https://sourceware.org/bugzilla/show_bug.cgi?id=12633
|
||||
else()
|
||||
set(WIN32_MEMORY)
|
||||
endif()
|
||||
|
||||
# Generate the Anope executable and set it's linker flags, also set it to export it's symbols even though it's not a module
|
||||
add_executable(${PROGRAM_NAME} ${SRC_SRCS})
|
||||
set_target_properties(${PROGRAM_NAME} PROPERTIES LINK_FLAGS "${LDFLAGS} ${EXTRA_LDFLAGS}" ENABLE_EXPORTS ON INSTALL_RPATH_USE_LINK_PATH ON BUILD_WITH_INSTALL_RPATH ON)
|
||||
set_target_properties(${PROGRAM_NAME} PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH ON
|
||||
ENABLE_EXPORTS ON
|
||||
INSTALL_RPATH_USE_LINK_PATH ON
|
||||
LINK_FLAGS "${LDFLAGS}"
|
||||
)
|
||||
|
||||
# On Windows, also link Anope to the wsock32 and Ws2_32 library, as well as set the version
|
||||
# On Windows, also link Anope to the Winsock library
|
||||
if(WIN32)
|
||||
target_link_libraries(${PROGRAM_NAME} PUBLIC wsock32 Ws2_32 ${LINK_LIBS} ${WIN32_MEMORY})
|
||||
target_link_libraries(${PROGRAM_NAME} PUBLIC "Ws2_32" ${LINK_LIBS} ${WIN32_MEMORY})
|
||||
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
|
||||
else()
|
||||
target_link_libraries(${PROGRAM_NAME} PUBLIC ${LINK_LIBS})
|
||||
@@ -70,7 +74,7 @@ endif()
|
||||
|
||||
# Get the filename of the Anope executable as it is in on this system
|
||||
set(SERVICES_BINARY "$<TARGET_FILE:${PROGRAM_NAME}>")
|
||||
get_filename_component(SERVICES_BINARY ${SERVICES_BINARY} NAME)
|
||||
cmake_path(GET SERVICES_BINARY FILENAME SERVICES_BINARY)
|
||||
# Add the Anope executable to the list of files for CPack to ignore
|
||||
add_to_cpack_ignored_files("${SERVICES_BINARY}$" TRUE)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ foreach(SRC ${TOOLS_SRCS})
|
||||
)
|
||||
# Add the executable to the list of files for CPack to ignore
|
||||
set(EXE_BINARY "$<TARGET_FILE:${EXE}>")
|
||||
get_filename_component(EXE_BINARY ${EXE_BINARY} NAME)
|
||||
cmake_path(GET EXE_BINARY FILENAME EXE_BINARY)
|
||||
add_to_cpack_ignored_files("${EXE_BINARY}$" TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -38,7 +38,8 @@ if(NOT WIN32)
|
||||
endif()
|
||||
|
||||
configure_file(${Anope_SOURCE_DIR}/src/tools/anoperc.in ${Anope_BINARY_DIR}/src/tools/anoperc)
|
||||
install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/anoperc
|
||||
install(
|
||||
PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/anoperc
|
||||
DESTINATION ${BIN_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user