Skip to content

Enable building on Fedora41 #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cmake/compiler_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ add_compile_options(
if(NOT ${LINUX_SYSTEM_NAME} STREQUAL "cros_sdk")
add_compile_options(
# Enable macro security features
-D_FORTIFY_SOURCE=2
$<$<CONFIG:Release>:-D_FORTIFY_SOURCE=2>
# TODO: Adding O3 in release build help to overcome issue with FORTIFY_SOURCE
# issue needs further investigation
$<$<CONFIG:Release>:-O3>
)
endif()

Expand Down
45 changes: 45 additions & 0 deletions cmake/packaging/generators/rpm.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# Copyright (C) 2025 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

include(${CPACK_PROJECT_CONFIG_FILE})

set(CPACK_GENERATOR RPM)

# Exclude firmware directories to generate intel-fw-npu package without conflicts against filesystem package
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
/lib /lib/firmware /lib/firmware/updates /lib/firmware/updates/intel /lib/firmware/updates/intel/vpu)

# Create package per component
set(CPACK_RPM_COMPONENT_INSTALL ON)

# Component conflicts
set(CPACK_RPM_LEVEL_ZERO_PACKAGE_CONFLICTS "level-zero, level-zero-devel")

# Get system architecture
execute_process(
COMMAND uname -m
OUTPUT_VARIABLE OUT_RPM_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY)

set(PACKAGE_POSTFIX_NAME ${CPACK_PACKAGE_VERSION}_${LINUX_SYSTEM_NAME}${LINUX_SYSTEM_VERSION_ID}_${OUT_RPM_ARCH}.rpm)
foreach(COMPONENT ${CPACK_COMPONENTS_ALL})
string(TOUPPER ${COMPONENT} COMPONENT_UPPER)
set(CPACK_RPM_${COMPONENT_UPPER}_FILE_NAME ${CPACK_PACKAGE_NAME}-${COMPONENT}_${PACKAGE_POSTFIX_NAME})

if (${COMPONENT_UPPER}_POSTINST)
list(APPEND CPACK_RPM_${COMPONENT_UPPER}_PACKAGE_CONTROL_EXTRA ${${COMPONENT_UPPER}_POSTINST})
endif()
if (${COMPONENT_UPPER}_PRERM)
list(APPEND CPACK_RPM_${COMPONENT_UPPER}_PACKAGE_CONTROL_EXTRA ${${COMPONENT_UPPER}_PRERM})
endif()
if (${COMPONENT_UPPER}_POSTRM)
list(APPEND CPACK_RPM_${COMPONENT_UPPER}_PACKAGE_CONTROL_EXTRA ${${COMPONENT_UPPER}_POSTRM})
endif()
if (${COMPONENT_UPPER}_DEPENDS)
set(CPACK_RPM_${COMPONENT_UPPER}_PACKAGE_REQUIRES ${${COMPONENT_UPPER}_DEPENDS})
endif()
endforeach()
2 changes: 2 additions & 0 deletions cmake/packaging/setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ if (EXISTS "/etc/debian_version")
set(PACKAGE_TYPE "deb")
elseif(EXISTS "/etc/portage")
set(PACKAGE_TYPE "ebuild")
elseif(EXISTS "/etc/redhat-release")
set(PACKAGE_TYPE "rpm")
else()
message(WARNING "Unable to detect package type for this system")
return()
Expand Down
5 changes: 4 additions & 1 deletion compiler/compiler_source.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ ExternalProject_Add(
git -C ${NPU_COMPILER_SOURCE_DIR} lfs install &&
git -C ${NPU_COMPILER_SOURCE_DIR} lfs pull &&
git -C ${NPU_COMPILER_SOURCE_DIR}/thirdparty/vpucostmodel lfs install &&
git -C ${NPU_COMPILER_SOURCE_DIR}/thirdparty/vpucostmodel lfs pull
git -C ${NPU_COMPILER_SOURCE_DIR}/thirdparty/vpucostmodel lfs pull &&
git -C ${NPU_COMPILER_SOURCE_DIR} reset --hard HEAD &&
git -C ${NPU_COMPILER_SOURCE_DIR} apply
${CMAKE_CURRENT_SOURCE_DIR}/npu_compiler_patches/0001-Disable-compiler-warning-as-error-in-npu_compiler.patch
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 53f896f0f564b99eea591bc4cf6a8304c2f526f6 Mon Sep 17 00:00:00 2001
From: "Wludzik, Jozef" <[email protected]>
Date: Thu, 27 Feb 2025 17:19:06 +0100
Subject: [PATCH] Disable compiler warning as error in npu_compiler

---
cmake/compile_options.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmake/compile_options.cmake b/cmake/compile_options.cmake
index d9baa2c1..0963cbd0 100644
--- a/cmake/compile_options.cmake
+++ b/cmake/compile_options.cmake
@@ -91,7 +91,7 @@ function(enable_warnings_as_errors TARGET_NAME)
else()
target_compile_options(${TARGET_NAME}
PRIVATE
- -Wall -Wextra -Werror -Werror=suggest-override
+ -Wall -Wextra
)
endif()
endfunction()
--
2.34.1