Skip to content

Commit c79e5bc

Browse files
committed
Enable building on Fedora41
1 parent b4d5ffb commit c79e5bc

File tree

5 files changed

+80
-2
lines changed

5 files changed

+80
-2
lines changed

cmake/compiler_flags.cmake

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ add_compile_options(
2828
if(NOT ${LINUX_SYSTEM_NAME} STREQUAL "cros_sdk")
2929
add_compile_options(
3030
# Enable macro security features
31-
-D_FORTIFY_SOURCE=2
31+
$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>
32+
# TODO: Adding O3 in release build help to overcome issue with FORTIFY_SOURCE
33+
# issue needs further investigation
34+
$<$<CONFIG:Release>:-O3>
3235
)
3336
endif()
3437

cmake/packaging/generators/rpm.cmake

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Copyright (C) 2025 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
include(${CPACK_PROJECT_CONFIG_FILE})
8+
9+
set(CPACK_GENERATOR RPM)
10+
11+
# Exclude firmware directories to generate intel-fw-npu package without conflicts against filesystem package
12+
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
13+
/lib /lib/firmware /lib/firmware/updates /lib/firmware/updates/intel /lib/firmware/updates/intel/vpu)
14+
15+
# Create package per component
16+
set(CPACK_RPM_COMPONENT_INSTALL ON)
17+
18+
# Component conflicts
19+
set(CPACK_RPM_LEVEL_ZERO_PACKAGE_CONFLICTS "level-zero, level-zero-devel")
20+
21+
# Get system architecture
22+
execute_process(
23+
COMMAND uname -m
24+
OUTPUT_VARIABLE OUT_RPM_ARCH
25+
OUTPUT_STRIP_TRAILING_WHITESPACE
26+
COMMAND_ERROR_IS_FATAL ANY)
27+
28+
set(PACKAGE_POSTFIX_NAME ${CPACK_PACKAGE_VERSION}_${LINUX_SYSTEM_NAME}${LINUX_SYSTEM_VERSION_ID}_${OUT_RPM_ARCH}.rpm)
29+
foreach(COMPONENT ${CPACK_COMPONENTS_ALL})
30+
string(TOUPPER ${COMPONENT} COMPONENT_UPPER)
31+
set(CPACK_RPM_${COMPONENT_UPPER}_FILE_NAME ${CPACK_PACKAGE_NAME}-${COMPONENT}_${PACKAGE_POSTFIX_NAME})
32+
33+
if (${COMPONENT_UPPER}_POSTINST)
34+
list(APPEND CPACK_RPM_${COMPONENT_UPPER}_PACKAGE_CONTROL_EXTRA ${${COMPONENT_UPPER}_POSTINST})
35+
endif()
36+
if (${COMPONENT_UPPER}_PRERM)
37+
list(APPEND CPACK_RPM_${COMPONENT_UPPER}_PACKAGE_CONTROL_EXTRA ${${COMPONENT_UPPER}_PRERM})
38+
endif()
39+
if (${COMPONENT_UPPER}_POSTRM)
40+
list(APPEND CPACK_RPM_${COMPONENT_UPPER}_PACKAGE_CONTROL_EXTRA ${${COMPONENT_UPPER}_POSTRM})
41+
endif()
42+
if (${COMPONENT_UPPER}_DEPENDS)
43+
set(CPACK_RPM_${COMPONENT_UPPER}_PACKAGE_REQUIRES ${${COMPONENT_UPPER}_DEPENDS})
44+
endif()
45+
endforeach()

cmake/packaging/setup.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ if (EXISTS "/etc/debian_version")
4242
set(PACKAGE_TYPE "deb")
4343
elseif(EXISTS "/etc/portage")
4444
set(PACKAGE_TYPE "ebuild")
45+
elseif(EXISTS "/etc/redhat-release")
46+
set(PACKAGE_TYPE "rpm")
4547
else()
4648
message(WARNING "Unable to detect package type for this system")
4749
return()

compiler/compiler_source.cmake

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ ExternalProject_Add(
8989
git -C ${NPU_COMPILER_SOURCE_DIR} lfs install &&
9090
git -C ${NPU_COMPILER_SOURCE_DIR} lfs pull &&
9191
git -C ${NPU_COMPILER_SOURCE_DIR}/thirdparty/vpucostmodel lfs install &&
92-
git -C ${NPU_COMPILER_SOURCE_DIR}/thirdparty/vpucostmodel lfs pull
92+
git -C ${NPU_COMPILER_SOURCE_DIR}/thirdparty/vpucostmodel lfs pull &&
93+
git -C ${NPU_COMPILER_SOURCE_DIR} reset --hard HEAD &&
94+
git -C ${NPU_COMPILER_SOURCE_DIR} apply
95+
${CMAKE_CURRENT_SOURCE_DIR}/npu_compiler_patches/0001-Disable-compiler-warning-as-error-in-npu_compiler.patch
9396
CONFIGURE_COMMAND ""
9497
BUILD_COMMAND ""
9598
INSTALL_COMMAND ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 53f896f0f564b99eea591bc4cf6a8304c2f526f6 Mon Sep 17 00:00:00 2001
2+
From: "Wludzik, Jozef" <[email protected]>
3+
Date: Thu, 27 Feb 2025 17:19:06 +0100
4+
Subject: [PATCH] Disable compiler warning as error in npu_compiler
5+
6+
---
7+
cmake/compile_options.cmake | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/cmake/compile_options.cmake b/cmake/compile_options.cmake
11+
index d9baa2c1..0963cbd0 100644
12+
--- a/cmake/compile_options.cmake
13+
+++ b/cmake/compile_options.cmake
14+
@@ -91,7 +91,7 @@ function(enable_warnings_as_errors TARGET_NAME)
15+
else()
16+
target_compile_options(${TARGET_NAME}
17+
PRIVATE
18+
- -Wall -Wextra -Werror -Werror=suggest-override
19+
+ -Wall -Wextra
20+
)
21+
endif()
22+
endfunction()
23+
--
24+
2.34.1
25+

0 commit comments

Comments
 (0)