Skip to contentSkip to conversation

build: Pass extra cmake flags

PATCH In review Leon Romanovsky 2 participants 3 messages Feb 1, 2018 – Feb 5, 2018 2 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: Pass extra cmake flags

From: Alaa Hleihel <alaa-VPRAkNaXOzVWk0Htik3J/[email protected]>

Add ability to provide extra cmake flags when building library and when creating RPMs or DEBs using EXTRA_CMAKE_FLAGS.

Set an environment variable prior execution to provide this information to build scripts:
export EXTRA_CMAKE_FLAGS="<flags>"

---
 build.sh              | 4 ++--
 debian/rules          | 3 ++-
 redhat/rdma-core.spec | 5 ++++-
 suse/rdma-core.spec   | 5 ++++-
 4 files changed, 12 insertions(+), 5 deletions(-)
build.sh +2 -2
index 17dc4408..a6b1e8f0 100755
@@ -23,9 +23,9 @@ fi
 cd "$BUILDDIR"
 
 if [ "x$NINJA" == "x" ]; then
-    $CMAKE -DIN_PLACE=1 ..
+    $CMAKE -DIN_PLACE=1 ${EXTRA_CMAKE_FLAGS:-} ..
     make
 else
-    $CMAKE -DIN_PLACE=1 -GNinja ..
+    $CMAKE -DIN_PLACE=1 -GNinja ${EXTRA_CMAKE_FLAGS:-} ..
     $NINJA
 fi
debian/rules +2 -1
index 87d02104..46d9a2be 100755
@@ -32,7 +32,8 @@ override_dh_auto_configure:
 			-DCMAKE_INSTALL_LIBEXECDIR:PATH=/usr/lib \
 			-DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/var/lib \
 			-DCMAKE_INSTALL_RUNDIR:PATH=/run \
-			-DCMAKE_INSTALL_UDEV_RULESDIR:PATH=/lib/udev/rules.d
+			-DCMAKE_INSTALL_UDEV_RULESDIR:PATH=/lib/udev/rules.d \
+			$(EXTRA_CMAKE_FLAGS)
 
 override_dh_auto_build:
 	ninja -C build-deb -v
redhat/rdma-core.spec +4 -1
index 434d5679..fd9a95ee 100644
@@ -205,6 +205,8 @@ discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
 %define _rundir /var/run
 %endif
 
+%{!?EXTRA_CMAKE_FLAGS: %define EXTRA_CMAKE_FLAGS %{nil}}
+
 # Pass all of the rpm paths directly to GNUInstallDirs and our other defines.
 %cmake %{CMAKE_FLAGS} \
          -DCMAKE_BUILD_TYPE=Release \
@@ -222,7 +224,8 @@ discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
          -DCMAKE_INSTALL_INITDDIR:PATH=%{_initrddir} \
          -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
          -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
-         -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir}
+         -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
+         %{EXTRA_CMAKE_FLAGS}
 %make_jobs
 
 %install
suse/rdma-core.spec +4 -1
index cb6ffb36..698c1536 100644
@@ -319,6 +319,8 @@ on those changes.
 %define _rundir /var/run
 %endif
 
+%{!?EXTRA_CMAKE_FLAGS: %define EXTRA_CMAKE_FLAGS %{nil}}
+
 # Pass all of the rpm paths directly to GNUInstallDirs and our other defines.
 %cmake %{CMAKE_FLAGS} \
 	 -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -Wl,-z,now" \
@@ -338,7 +340,8 @@ on those changes.
          -DCMAKE_INSTALL_INITDDIR:PATH=%{_initddir} \
          -DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
          -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
-         -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir}
+         -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir} \
+         %{EXTRA_CMAKE_FLAGS}
 %make_jobs
 
 %install

--
2.16.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to a message not in the archive
Quoted 5 lines · Leon Romanovsky

From: Alaa Hleihel <alaa-VPRAkNaXOzVWk0Htik3J/[email protected]>

Add ability to provide extra cmake flags when building library and when creating RPMs or DEBs using EXTRA_CMAKE_FLAGS.

Quoted 8 lines

Set an environment variable prior execution to provide this information to build scripts:
export EXTRA_CMAKE_FLAGS="<flags>"

Tested as best I could locally then applied, thanks.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD
#4 lore raw
In reply to a message not in the archive
Quoted 10 lines · Doug Ledford
Quoted 9 lines · Leon Romanovsky

From: Alaa Hleihel <alaa-VPRAkNaXOzVWk0Htik3J/[email protected]>

Add ability to provide extra cmake flags when building library and when creating RPMs or DEBs using EXTRA_CMAKE_FLAGS.

Set an environment variable prior execution to provide this information to build scripts:
export EXTRA_CMAKE_FLAGS="<flags>"

Quoted 6 lines
Quoted 4 lines

Tested as best I could locally then applied, thanks.

Thanks,
We are running this option internally, so I'm pretty confident in it.

Quoted 5 lines

--
Doug Ledford <[email protected]>

    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD