First version
This commit is contained in:
parent
344d23bd87
commit
5203f3a6fb
6 changed files with 196 additions and 32 deletions
57
.gitignore
vendored
57
.gitignore
vendored
|
@ -1,32 +1,25 @@
|
||||||
# Prerequisites
|
.ninja_deps
|
||||||
*.d
|
.ninja_log
|
||||||
|
.cache
|
||||||
# Compiled Object files
|
CMakeCache.txt
|
||||||
*.slo
|
CMakeFiles/
|
||||||
*.lo
|
CTestTestfile.cmake
|
||||||
*.o
|
build.ninja
|
||||||
*.obj
|
cmake/CPM.cmake
|
||||||
|
cmake_install.cmake
|
||||||
# Precompiled Headers
|
compile_commands.json
|
||||||
*.gch
|
cpm-package-lock.cmake
|
||||||
*.pch
|
xmppClientLibConfig.cmake
|
||||||
|
xmppClientLibVersionConfig.cmake
|
||||||
# Compiled Dynamic libraries
|
xmpp_client
|
||||||
*.so
|
xmpp_client_tests
|
||||||
*.dylib
|
xmpp_client_tests\[1\]_include.cmake
|
||||||
*.dll
|
xmpp_client_tests\[1\]_tests.cmake
|
||||||
|
utemplConfigVersion.cmake
|
||||||
# Fortran module files
|
install_manifest.txt
|
||||||
*.mod
|
CPM_modules/
|
||||||
*.smod
|
Makefile
|
||||||
|
_deps/
|
||||||
# Compiled Static libraries
|
examples/output
|
||||||
*.lai
|
lib__cmake_cxx23.a
|
||||||
*.la
|
libxmpp_client_lib.so
|
||||||
*.a
|
|
||||||
*.lib
|
|
||||||
|
|
||||||
# Executables
|
|
||||||
*.exe
|
|
||||||
*.out
|
|
||||||
*.app
|
|
||||||
|
|
160
CMakeLists.txt
Normal file
160
CMakeLists.txt
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
cmake_minimum_required(VERSION 3.30)
|
||||||
|
|
||||||
|
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
|
||||||
|
# This specific value changes as experimental support evolves. See
|
||||||
|
# `Help/dev/experimental.rst` in the CMake source corresponding to
|
||||||
|
# your CMake build for the exact value to use.
|
||||||
|
"0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
|
||||||
|
|
||||||
|
project(xmpp_client
|
||||||
|
VERSION 0.1
|
||||||
|
LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
set(FMT_MODULE ON)
|
||||||
|
set(CXX_EXTENSIONS NO)
|
||||||
|
set(BOOST_INCLUDE_LIBRARIES "pfr")
|
||||||
|
option(CPM_USE_LOCAL_PACKAGES "Use local packages" ON)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE LIB_SOURCES "lib/src/*.cpp")
|
||||||
|
file(GLOB_RECURSE SOURCES "src/*.cpp")
|
||||||
|
set(CMAKE_CXX_MODULE_STD 1)
|
||||||
|
|
||||||
|
set_target_properties(__cmake_cxx23 PROPERTIES CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
file(
|
||||||
|
DOWNLOAD
|
||||||
|
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.0/CPM.cmake
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
|
||||||
|
EXPECTED_HASH
|
||||||
|
SHA256=7b354f3a5976c4626c876850c93944e52c83ec59a159ae5de5be7983f0e17a2a
|
||||||
|
)
|
||||||
|
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
|
||||||
|
pkg_check_modules(GTKMM gtkmm-4.0)
|
||||||
|
|
||||||
|
link_directories(
|
||||||
|
${GTKMM_LIBRARY_DIRS} )
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${GTKMM_INCLUDE_DIRS} )
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME Boost
|
||||||
|
VERSION 1.85.0
|
||||||
|
URL "https://github.com/boostorg/boost/releases/download/boost-1.85.0/boost-1.85.0-cmake.tar.xz"
|
||||||
|
EXCLUDE_FROM_ALL ON
|
||||||
|
OPTIONS "BOOST_SKIP_INSTALL_RULES OFF"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(TMP ${CPM_USE_LOCAL_PACKAGES})
|
||||||
|
set(CPM_USE_LOCAL_PACKAGES OFF)
|
||||||
|
|
||||||
|
|
||||||
|
CPMAddPackage("gh:fmtlib/fmt#11.0.2")
|
||||||
|
|
||||||
|
set(CPM_USE_LOCAL_PACKAGES ${TMP})
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME utempl
|
||||||
|
URL "https://github.com/linuxnyasha/utempl/archive/refs/heads/main.zip"
|
||||||
|
EXCLUDE_FROM_ALL ON
|
||||||
|
OPTIONS "ENABLE_TESTS OFF" "ENABLE_EXAMPLES OFF"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cmake_policy(SET CMP0079 NEW)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
add_library(xmpp_client_lib)
|
||||||
|
|
||||||
|
target_compile_features(xmpp_client_lib INTERFACE cxx_std_23)
|
||||||
|
|
||||||
|
target_sources(xmpp_client_lib PUBLIC FILE_SET xmpp_client_lib_set TYPE CXX_MODULES
|
||||||
|
FILES ${LIB_SOURCES})
|
||||||
|
|
||||||
|
|
||||||
|
install(TARGETS xmpp_client_lib
|
||||||
|
EXPORT xmppClientLibTargets
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
FILE_SET xmpp_client_lib_set DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(TARGET Boost::pfr)
|
||||||
|
target_link_libraries(xmpp_client_lib INTERFACE fmt::fmt
|
||||||
|
Boost::pfr utempl::utempl ${GTKMM_LIBRARIES})
|
||||||
|
else()
|
||||||
|
find_package(Boost 1.85.0 REQUIRED)
|
||||||
|
target_link_libraries(xmpp_client_lib INTERFACE fmt::fmt
|
||||||
|
utempl::utempl ${Boost_LIBRARIES} ${GTKMM_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
add_executable(xmpp_client)
|
||||||
|
|
||||||
|
target_compile_features(xmpp_client INTERFACE cxx_std_23)
|
||||||
|
|
||||||
|
target_link_libraries(xmpp_client xmpp_client_lib)
|
||||||
|
|
||||||
|
target_sources(xmpp_client PUBLIC FILE_SET xmpp_client TYPE CXX_MODULES
|
||||||
|
FILES ${SOURCES})
|
||||||
|
|
||||||
|
|
||||||
|
install(TARGETS xmpp_client
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
write_basic_package_version_file("xmppClientLibVersionConfig.cmake"
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
|
configure_package_config_file(
|
||||||
|
"${PROJECT_SOURCE_DIR}/cmake/xmppClientLibConfig.cmake.in"
|
||||||
|
"${PROJECT_BINARY_DIR}/xmppClientLibConfig.cmake"
|
||||||
|
INSTALL_DESTINATION
|
||||||
|
${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
install(EXPORT xmppClientLibTargets
|
||||||
|
FILE xmppClientLibTargets.cmake
|
||||||
|
NAMESPACE xmpp_client::
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake)
|
||||||
|
|
||||||
|
install(FILES "${PROJECT_BINARY_DIR}/xmppClientLibConfig.cmake"
|
||||||
|
"${PROJECT_BINARY_DIR}/xmppClientLibVersionConfig.cmake"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(ENABLE_TESTS)
|
||||||
|
find_package(GTest REQUIRED)
|
||||||
|
enable_testing()
|
||||||
|
file(GLOB_RECURSE SOURCES "tests/*.cpp" )
|
||||||
|
add_executable(xmpp_client_tests)
|
||||||
|
target_sources(xmpp_client_tests PUBLIC FILE_SET tests TYPE CXX_MODULES
|
||||||
|
FILES ${SOURCES})
|
||||||
|
target_link_libraries(xmpp_client_tests GTest::gtest_main
|
||||||
|
xmpp_client_lib)
|
||||||
|
set_property(TARGET xmpp_client_tests PROPERTY CXX_STANDARD 23)
|
||||||
|
include(GoogleTest)
|
||||||
|
gtest_discover_tests(xmpp_client_tests)
|
||||||
|
endif()
|
4
cmake/xmppClientLibConfig.cmake.in
Normal file
4
cmake/xmppClientLibConfig.cmake.in
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
|
||||||
|
check_required_components("@PROJECT_NAME@")
|
1
lib/src/library.cpp
Normal file
1
lib/src/library.cpp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export module xmpp_client.library;
|
4
src/main.cpp
Normal file
4
src/main.cpp
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export module xmpp_client.main;
|
||||||
|
import xmpp_client.library;
|
||||||
|
|
||||||
|
auto main() -> int {};
|
2
tests/test.cpp
Normal file
2
tests/test.cpp
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
export module tests.test;
|
||||||
|
import xmpp_client.library;
|
Loading…
Reference in a new issue