This commit is contained in:
sha512sum 2024-08-26 04:29:16 +00:00
parent 86bb9c9a7f
commit 002ffeed78
7 changed files with 51 additions and 45 deletions

14
.gitignore vendored
View file

@ -9,12 +9,12 @@ cmake/CPM.cmake
cmake_install.cmake cmake_install.cmake
compile_commands.json compile_commands.json
cpm-package-lock.cmake cpm-package-lock.cmake
xmppClientLibConfig.cmake larraXMPPConfig.cmake
xmppClientLibVersionConfig.cmake larraXMPPVersionConfig.cmake
xmpp_client larra
xmpp_client_tests larra_xmpp_tests
xmpp_client_tests\[1\]_include.cmake larra_xmpp_tests\[1\]_include.cmake
xmpp_client_tests\[1\]_tests.cmake larra_xmpp_tests\[1\]_tests.cmake
utemplConfigVersion.cmake utemplConfigVersion.cmake
install_manifest.txt install_manifest.txt
CPM_modules/ CPM_modules/
@ -22,4 +22,4 @@ Makefile
_deps/ _deps/
examples/output examples/output
lib__cmake_cxx23.a lib__cmake_cxx23.a
libxmpp_client_lib.so liblarra_xmpp.so

View file

@ -6,7 +6,7 @@ set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
# your CMake build for the exact value to use. # your CMake build for the exact value to use.
"0e5b6991-d74f-4b3d-a41c-cf096e0b2508") "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
project(xmpp_client project(larra
VERSION 0.1 VERSION 0.1
LANGUAGES CXX) LANGUAGES CXX)
@ -76,69 +76,71 @@ include(GNUInstallDirs)
add_library(xmpp_client_lib) add_library(larra_xmpp)
target_compile_features(xmpp_client_lib INTERFACE cxx_std_23) add_library(larra::larra_xmpp ALIAS larra_xmpp)
target_sources(xmpp_client_lib PUBLIC FILE_SET xmpp_client_lib_set TYPE CXX_MODULES target_compile_features(larra_xmpp INTERFACE cxx_std_23)
target_sources(larra_xmpp PUBLIC FILE_SET larraXMPPSet TYPE CXX_MODULES
FILES ${LIB_SOURCES}) FILES ${LIB_SOURCES})
install(TARGETS xmpp_client_lib install(TARGETS larra_xmpp
EXPORT xmppClientLibTargets EXPORT larraXMPPTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FILE_SET xmpp_client_lib_set DESTINATION ${CMAKE_INSTALL_LIBDIR} FILE_SET larraXMPPSet DESTINATION ${CMAKE_INSTALL_LIBDIR}
) )
if(TARGET Boost::pfr) if(TARGET Boost::pfr)
target_link_libraries(xmpp_client_lib INTERFACE fmt::fmt target_link_libraries(larra_xmpp INTERFACE fmt::fmt
Boost::pfr utempl::utempl ${GTKMM_LIBRARIES}) Boost::pfr utempl::utempl ${GTKMM_LIBRARIES})
else() else()
find_package(Boost 1.85.0 REQUIRED) find_package(Boost 1.85.0 REQUIRED)
target_link_libraries(xmpp_client_lib INTERFACE fmt::fmt target_link_libraries(larra_xmpp INTERFACE fmt::fmt
utempl::utempl ${Boost_LIBRARIES} ${GTKMM_LIBRARIES}) utempl::utempl ${Boost_LIBRARIES} ${GTKMM_LIBRARIES})
endif() endif()
add_executable(xmpp_client) add_executable(larra)
target_compile_features(xmpp_client INTERFACE cxx_std_23) target_compile_features(larra INTERFACE cxx_std_23)
target_link_libraries(xmpp_client xmpp_client_lib) target_link_libraries(larra larra_xmpp)
target_sources(xmpp_client PUBLIC FILE_SET xmpp_client TYPE CXX_MODULES target_sources(larra PUBLIC FILE_SET larraSet TYPE CXX_MODULES
FILES ${SOURCES}) FILES ${SOURCES})
install(TARGETS xmpp_client install(TARGETS larra
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
include(CMakePackageConfigHelpers) include(CMakePackageConfigHelpers)
write_basic_package_version_file("xmppClientLibVersionConfig.cmake" write_basic_package_version_file("larraXMPPVersionConfig.cmake"
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion) COMPATIBILITY SameMajorVersion)
configure_package_config_file( configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/xmppClientLibConfig.cmake.in" "${PROJECT_SOURCE_DIR}/cmake/larraXMPPConfig.cmake.in"
"${PROJECT_BINARY_DIR}/xmppClientLibConfig.cmake" "${PROJECT_BINARY_DIR}/larraXMPPConfig.cmake"
INSTALL_DESTINATION INSTALL_DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake) ${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake)
install(EXPORT xmppClientLibTargets install(EXPORT larraXMPPTargets
FILE xmppClientLibTargets.cmake FILE xmppClientLibTargets.cmake
NAMESPACE xmpp_client:: NAMESPACE larra::
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake)
install(FILES "${PROJECT_BINARY_DIR}/xmppClientLibConfig.cmake" install(FILES "${PROJECT_BINARY_DIR}/larraXMPPConfig.cmake"
"${PROJECT_BINARY_DIR}/xmppClientLibVersionConfig.cmake" "${PROJECT_BINARY_DIR}/larraXMPPVersionConfig.cmake"
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake) DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xmpp_client/cmake)
@ -149,12 +151,12 @@ if(ENABLE_TESTS)
find_package(GTest REQUIRED) find_package(GTest REQUIRED)
enable_testing() enable_testing()
file(GLOB_RECURSE SOURCES "tests/*.cpp" ) file(GLOB_RECURSE SOURCES "tests/*.cpp" )
add_executable(xmpp_client_tests) add_executable(larra_xmpp_tests)
target_sources(xmpp_client_tests PUBLIC FILE_SET tests TYPE CXX_MODULES target_sources(larra_xmpp_tests PUBLIC FILE_SET tests TYPE CXX_MODULES
FILES ${SOURCES}) FILES ${SOURCES})
target_link_libraries(xmpp_client_tests GTest::gtest_main target_link_libraries(larra_xmpp_tests GTest::gtest_main
xmpp_client_lib) xmpp_client_lib)
set_property(TARGET xmpp_client_tests PROPERTY CXX_STANDARD 23) set_property(TARGET larra_xmpp_tests PROPERTY CXX_STANDARD 23)
include(GoogleTest) include(GoogleTest)
gtest_discover_tests(xmpp_client_tests) gtest_discover_tests(larra_xmpp_tests)
endif() endif()

View file

@ -1,2 +1,2 @@
# xmpp_client # Larra
XMPP Client on C++ with GTK XMPP Client on C++ with GTK

View file

@ -1 +1 @@
export module xmpp_client.library; export module larra.library;

View file

@ -1,16 +1,10 @@
module; module;
#include <gtkmm.h> #include <gtkmm.h>
export module xmpp_client.main; export module larra.main;
import xmpp_client.library; import larra.library;
import larra.main_window;
struct MainWindow : public Gtk::Window {
MainWindow() {
this->set_title("XMPP Client");
this->set_default_size(200, 200);
};
};
auto main(int argc, char* argv[]) -> int { auto main(int argc, char* argv[]) -> int {
auto app = Gtk::Application::create("org.xmpp_client.xmpp_client"); auto app = Gtk::Application::create("org.larra.larra");
return app->make_window_and_run<MainWindow>(argc, argv); return app->make_window_and_run<MainWindow>(argc, argv);
}; };

10
src/main_window.cpp Normal file
View file

@ -0,0 +1,10 @@
module;
#include <gtkmm.h>
export module larra.main_window;
export struct MainWindow : public Gtk::Window {
MainWindow() {
this->set_title("XMPP Client");
this->set_default_size(200, 200);
};
};