From 05a8bc79272565b6e2f18771ce07db1bd403c7b8 Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Sun, 2 Mar 2025 19:16:36 +0800 Subject: [PATCH] adopt to new cmake macro --- ...-missing-CMake-commands-in-CMakelist.patch | 132 ++++++++++++++++++ etmem.spec | 22 ++- 2 files changed, 142 insertions(+), 12 deletions(-) create mode 100644 0009-cmake-Add-missing-CMake-commands-in-CMakelist.patch diff --git a/0009-cmake-Add-missing-CMake-commands-in-CMakelist.patch b/0009-cmake-Add-missing-CMake-commands-in-CMakelist.patch new file mode 100644 index 0000000..6c08299 --- /dev/null +++ b/0009-cmake-Add-missing-CMake-commands-in-CMakelist.patch @@ -0,0 +1,132 @@ +From 0d7420772c6d08069449a0afaa44183033f4c068 Mon Sep 17 00:00:00 2001 +From: Enze Li +Date: Tue, 4 Jun 2024 09:37:13 +0800 +Subject: [PATCH 01/02] cmake: Add missing CMake commands in CMakelist + +This patch fixes the following warnings by adding the missing commands +in CMakelist. + +--------------------------------------------------------------------- +[root@loaclhost build]# cmake .. +CMake Warning (dev) in CMakeLists.txt: + No project() command is present. The top-level CMakeLists.txt file must + contain a literal, direct call to the project() command. Add a line of + code such as + + project(ProjectName) + + near the top of the file, but after cmake_minimum_required(). + + CMake is pretending there is a "project(Project)" command on the first + line. +This warning is for project developers. Use -Wno-dev to suppress it. + +-- The C compiler identification is GNU 7.3.0 +-- The CXX compiler identification is GNU 7.3.0 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Architecture: x86_64 +-- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3") +-- Checking for one of the modules 'glib-2.0' +CMake Warning (dev) in CMakeLists.txt: + No cmake_minimum_required command is present. A line of code such as + + cmake_minimum_required(VERSION 3.16) + + should be added at the top of the file. The version specified may be lower + if you wish to support older CMake versions for this project. For more + information run "cmake --help-policy CMP0000". +This warning is for project developers. Use -Wno-dev to suppress it. + +-- Configuring done +-- Generating done +-- Build files have been written to: /root/dev/etmem/build +--------------------------------------------------------------------- + +Tested on openEuler 20.03 and 22.03. + +Signed-off-by: Enze Li +--- + CMakeLists.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a5d6761..5655528 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -13,6 +13,8 @@ + # * Description:CMakeLists for three features of etmem to compile + # ******************************************************************************/ + ++project(etmem) ++cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) + add_subdirectory(etmem) + add_subdirectory(memRouter) + add_subdirectory(userswap) +\ No newline at end of file +-- +2.47.1 + +From df21cfbb4c92924018503d6420c74eb05ef7e90d Mon Sep 17 00:00:00 2001 +From: Enze Li +Date: Thu, 6 Jun 2024 17:18:01 +0800 +Subject: [PATCH 02/02] cmake: Pacify CMake with no functional changes + +While running cmake on the lastest openEuler 24.03, I ran into, + +--------------------------------------------------------------------- +[root@loaclhost build]# cmake .. +CMake Warning (dev) at CMakeLists.txt:16 (project): + cmake_minimum_required() should be called prior to this top-level project() + call. Please see the cmake-commands(7) manual for usage documentation of + both commands. +This warning is for project developers. Use -Wno-dev to suppress it. +--------------------------------------------------------------------- + +and I noticed that the documentation [1] online pointed out this in detail +as follows, + + Note: Call the cmake_minimum_required() command at the beginning of the + top-level CMakeLists.txt file even before calling the project() + command. + +Therefore, fix this by simply putting cmake_minimum_required() at the top of +the CMakeList file. + +Tested on x86_64 openEuler 20.03, 22.04, and 24.03. + +[1] https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html + +Signed-off-by: Enze Li +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5655528..8739bba 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -13,8 +13,8 @@ + # * Description:CMakeLists for three features of etmem to compile + # ******************************************************************************/ + +-project(etmem) + cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) ++project(etmem) + add_subdirectory(etmem) + add_subdirectory(memRouter) + add_subdirectory(userswap) +\ No newline at end of file +-- +2.47.1 + diff --git a/etmem.spec b/etmem.spec index 77146f6..d8034bc 100644 --- a/etmem.spec +++ b/etmem.spec @@ -1,6 +1,6 @@ Name: etmem Version: 1.1 -Release: 9 +Release: 10 Summary: etmem License: MulanPSL-2.0 URL: https://gitee.com/openeuler/etmem @@ -14,12 +14,11 @@ Patch0004: 0005-etmem-1.1-add-riscv64-support.patch Patch0005: 0006-etmem-fix-project-stop-cmd-timeout-problem.patch Patch0006: 0007-etmem-construct-etmem-debug-info-package.patch Patch0007: 0008-etmem-set-scan_type-optional-and-fix-sequence-of-head.patch +Patch0008: 0009-cmake-Add-missing-CMake-commands-in-CMakelist.patch #Dependency BuildRequires: cmake gcc gcc-c++ glib2-devel BuildRequires: libboundscheck numactl-devel libcap-devel json-c-devel -Requires: libboundscheck json-c libcap numactl-libs -Requires: glib2 %description etmem module @@ -29,13 +28,11 @@ etmem module %autosetup -n etmem-%{version} -p1 %build -mkdir -p build -cd build %if "%{?toolchain}" == "clang" CFLAGS="${CFLAGS:-%{?build_cflags}} -Wno-typedef-redefinition"; export CFLAGS; %endif -cmake .. -DCONFIG_DEBUG=y -make +%cmake -DCONFIG_DEBUG=y +%cmake_build %install mkdir -p $RPM_BUILD_ROOT%{_bindir} @@ -50,9 +47,10 @@ install -m 0600 etmem/conf/cslide_conf.yaml $RPM_BUILD_ROOT%{_sysconfdir}/etmem/ install -m 0600 etmem/conf/slide_conf.yaml $RPM_BUILD_ROOT%{_sysconfdir}/etmem/ install -m 0600 etmem/conf/thirdparty_conf.yaml $RPM_BUILD_ROOT%{_sysconfdir}/etmem/ -install -m 0750 build/memRouter/memdcd $RPM_BUILD_ROOT%{_bindir} -install -m 0750 build/userswap/libuswap.a $RPM_BUILD_ROOT%{_libdir} +install -m 0750 %{__cmake_builddir}/memRouter/memdcd $RPM_BUILD_ROOT%{_bindir} +install -m 0750 %{__cmake_builddir}/userswap/libuswap.a $RPM_BUILD_ROOT%{_libdir} install -m 0644 userswap/include/uswap_api.h $RPM_BUILD_ROOT%{_includedir} + %files %defattr(-,root,root,0750) %attr(0500, -, -) %{_bindir}/etmem @@ -66,10 +64,10 @@ install -m 0644 userswap/include/uswap_api.h $RPM_BUILD_ROOT%{_includedir} %attr(0550, -, -) %{_libdir}/libuswap.a %{_includedir}/uswap_api.h -%post -p /sbin/ldconfig -%postun -p /sbin/ldconfig - %changelog +* Thu Nov 21 2024 Funda Wang - 1.1-10 +- adopt to new cmake macro + * Mon Nov 4 2024 chenrenhui - 1.1-9 - Type: bugfix - CVE:NA -- Gitee