1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 19:14:47 +02:00

use Conan for extra's dependencies on Windows

conan install src\win32\conanfile.txt --build=missing
cmake -B build .
cmake --build build --config Release --target PACKAGE
This commit is contained in:
Adam
2023-06-02 18:20:19 -04:00
parent fe3926f572
commit 07babdbd77
5 changed files with 53 additions and 6 deletions
-4
View File
@@ -502,10 +502,6 @@ if(WIN32)
install(FILES ${Anope_SOURCE_DIR}/src/win32/anope.bat
DESTINATION ${BIN_DIR}
)
# Package any DLLs in src/win/
file(GLOB EXTRA_DLLS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${Anope_SOURCE_DIR}/src/win32/*.dll")
install(FILES ${EXTRA_DLLS} DESTINATION ${BIN_DIR})
endif(WIN32)
install(CODE "file(REMOVE_RECURSE \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${LIB_DIR}/modules\")")
+33
View File
@@ -3,6 +3,39 @@ if(WIN32)
add_definitions(-DMODULE_COMPILE)
endif(WIN32)
# enable extra modules if conan is used
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../conanbuildinfo.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/../conanbuildinfo.cmake")
conan_basic_setup()
function(enable_extra NAME PACKAGE)
if(DEFINED "CONAN_${PACKAGE}_ROOT")
message("Enabling the ${NAME} module")
# copy the modules out of extra so it gets picked up by build_modules
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/extra/${NAME}.cpp" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}")
else()
message("Unable to enable the ${NAME} module (missing library)")
endif()
endfunction()
function(copy_extra NAME)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/extra/${NAME}.cpp" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}")
endfunction()
enable_extra("m_mysql" "LIBMYSQLCLIENT")
enable_extra("m_regex_pcre2" "PCRE2")
enable_extra("m_sqlite" "SQLITE3")
enable_extra("m_ssl_openssl" "OPENSSL")
# these don't actually have extra dependencies, but require a module which does
copy_extra("m_sql_authentication")
copy_extra("m_sql_log")
copy_extra("m_sql_oper")
# Package extra dlls
file(GLOB EXTRA_DLLS "${Anope_SOURCE_DIR}/extradll/bin/*.dll" "${Anope_SOURCE_DIR}/extradll/lib/*.dll")
install(FILES ${EXTRA_DLLS} DESTINATION ${BIN_DIR})
endif()
macro(build_modules SRC)
if(NOT ${SRC} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND EXISTS "${SRC}/CMakeLists.txt")
add_subdirectory("${SRC}")
+1 -1
View File
@@ -7,7 +7,7 @@
*/
/* RequiredLibraries: pcre2-8 */
/* RequiredWindowsLibraries: libpcre2-8 */
/* RequiredWindowsLibraries: pcre2-8 */
#include "module.h"
+1 -1
View File
@@ -7,7 +7,7 @@
*/
/* RequiredLibraries: ssl,crypto */
/* RequiredWindowsLibraries: ssleay32,libeay32 */
/* RequiredWindowsLibraries: libssl,libcrypto */
#include "module.h"
#include "modules/ssl.h"
+18
View File
@@ -0,0 +1,18 @@
[requires]
libmysqlclient/8.0.31
openssl/1.1.1t
pcre2/10.42
sqlite3/3.41.1
[options]
libmysqlclient/*:shared=True
openssl/*:shared=True
pcre2/*:shared=True
sqlite3/*:shared=True
[imports]
., *.dll -> extradll
., *.lib -> extralib
[generators]
cmake