Skip to content

Commit 052e5ba

Browse files
Update UD44 OS Release (#15)
* code update ud44 os release * by bind * added missing files
1 parent 1a88f72 commit 052e5ba

File tree

4 files changed

+185
-0
lines changed

4 files changed

+185
-0
lines changed

cmake/BlasSetup.cmake

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright © 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache 2.0
3+
# LEGAL NOTICE: Your use of this software and any required dependent software (the “Software Package”)
4+
# is subject to the terms and conditions of the software license agreements for the Software Package,
5+
# which may also include notices, disclaimers, or license terms for third party or open source software
6+
# included in or with the Software Package, and your use indicates your acceptance of all such terms.
7+
# Please refer to the “third-party-programs.txt” or other similarly-named text file included with the
8+
# Software Package for additional details.
9+
10+
# This script will detect the blas library and set corresponding flags
11+
# to be used by other targets. It will search for mkl and openblas, and
12+
# if not found will fallback to internal implementation
13+
14+
# Needed variablea are CBLAS_LIB and BLAS_LIBRARIES
15+
16+
if(NOT BLAS_SETUP_DONE)
17+
find_package(BLAS)
18+
# make it default if not set
19+
if(NOT DEFINED CBLAS_LIB)
20+
set(CBLAS_LIB "internal")
21+
endif()
22+
23+
# CBLAS library selection with cache variable
24+
set(CBLAS_LIB ${CBLAS_LIB} CACHE STRING "CBLAS library selection")
25+
set_property(CACHE CBLAS_LIB PROPERTY STRINGS "auto" "mkl" "openblas" "internal")
26+
27+
# added auto for automatic detection
28+
# which means that it will search first for mkl, openblas
29+
# and if not found then will fallback to internal implementation
30+
# instead of auto, there can be specified any lib from (mkl, openblas, internal) that
31+
# will be used instead, without the fallback mechanism
32+
if(CBLAS_LIB STREQUAL "auto")
33+
message(STATUS "Auto-detecting CBLAS library")
34+
if(DEFINED ENV{EMSCRIPTEN})
35+
set(CBLAS_LIB "internal")
36+
message(STATUS "Emscripted detected - using internal CBLAS")
37+
elseif(EXISTS $ENV{MKLROOT})
38+
set(CBLAS_LIB "mkl")
39+
message(STATUS "MKL detected - using MKL CBLAS")
40+
else()
41+
if(BLAS_FOUND)
42+
string(JOIN " " BLAS_LIBRARIES_STR ${BLAS_LIBRARIES})
43+
if(BLAS_LIBRARIES_STR MATCHES ".*openblas.*")
44+
set(CBLAS_LIB "openblas")
45+
message(STATUS "Generic BLAS found - using OpenBLAS")
46+
else()
47+
set(CBLAS_LIB "internal")
48+
message(STATUS "BLAS found but not OpenBLAS - using internal implementation")
49+
endif()
50+
else()
51+
set(CBLAS_LIB "internal")
52+
message(STATUS "No optimized BLAS found - using internal implementation")
53+
endif()
54+
endif()
55+
else()
56+
message(STATUS "Using CBLAS library: ${CBLAS_LIB}")
57+
endif()
58+
59+
# Configure BLAS vendor based on selection
60+
if(CBLAS_LIB STREQUAL "mkl")
61+
set(BLA_VENDOR "Intel")
62+
message(STATUS "Using Intel MKL BLAS")
63+
elseif(CBLAS_LIB STREQUAL "openblas")
64+
set(BLA_VENDOR "OpenBLAS")
65+
message(STATUS "Using OpenBLAS")
66+
elseif(CBLAS_LIB STREQUAL "internal")
67+
message(STATUS "Using internal BLAS implementation")
68+
else()
69+
message(FATAL_ERROR "Unrecognised CBLAS_LIB: ${CBLAS_LIB} (valid: auto, mkl, openblas, internal)")
70+
endif()
71+
72+
set(CBLAS_LIB ${CBLAS_LIB} PARENT_SCOPE)
73+
set(BLAS_LIBRARIES ${BLAS_LIBRARIES} PARENT_SCOPE)
74+
set(BLAS_SETUP_DONE TRUE)
75+
76+
endif()

cmake/FlatbuffersSetup.cmake

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Copyright © 2024 Intel Corporation
2+
# SPDX-License-Identifier: Apache 2.0
3+
# LEGAL NOTICE: Your use of this software and any required dependent software (the “Software Package”)
4+
# is subject to the terms and conditions of the software license agreements for the Software Package,
5+
# which may also include notices, disclaimers, or license terms for third party or open source software
6+
# included in or with the Software Package, and your use indicates your acceptance of all such terms.
7+
# Please refer to the “third-party-programs.txt” or other similarly-named text file included with the
8+
# Software Package for additional details.
9+
10+
# It will automatically download and integrate the FlatBuffers library
11+
# set flags and target related to Flatbuffers that will be used
12+
# across different CMakeLists
13+
14+
if(TARGET flatbuffers AND TARGET flatc)
15+
message(STATUS "FLATBUFFERS: flatbuffers and flatc targets already available")
16+
set(FLATC_COMMAND $<TARGET_FILE:flatc>)
17+
set(FLATC_TARGET flatc)
18+
endif()
19+
20+
if(DEFINED FLATC_COMMAND AND DEFINED FLATC_TARGET)
21+
message(STATUS "FLATBUFFERS: Using flatc target from parent project")
22+
else()
23+
message(STATUS "FLATBUFFERS: Fetching FlatBuffers from source...")
24+
set(VPUNN_USING_INTERNAL_FLATBUFFERS TRUE)
25+
26+
include(FetchContent)
27+
FetchContent_Declare(
28+
flatbuffers
29+
GIT_REPOSITORY https://github.com/google/flatbuffers.git
30+
GIT_TAG v24.3.25
31+
)
32+
33+
set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "" FORCE)
34+
set(FLATBUFFERS_INSTALL OFF CACHE BOOL "" FORCE)
35+
set(FLATBUFFERS_BUILD_FLATC ON CACHE BOOL "" FORCE)
36+
37+
if(JS_BUILD)
38+
# Populate sources (no build yet)
39+
FetchContent_GetProperties(flatbuffers)
40+
41+
if(NOT flatbuffers_POPULATED)
42+
FetchContent_Populate(flatbuffers)
43+
endif()
44+
45+
# Build host flatc (native) with ExternalProject
46+
include(ExternalProject)
47+
set(_FLATC_HOST_BINARY_DIR ${CMAKE_BINARY_DIR}/flatbuffers-host)
48+
set(_FLATC_HOST_BIN ${_FLATC_HOST_BINARY_DIR}/flatc)
49+
50+
ExternalProject_Add(flatc_host_build
51+
SOURCE_DIR ${flatbuffers_SOURCE_DIR}
52+
BINARY_DIR ${_FLATC_HOST_BINARY_DIR}
53+
CMAKE_ARGS
54+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
55+
-DCMAKE_CXX_COMPILER=g++
56+
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target flatc --parallel 8
57+
INSTALL_COMMAND ""
58+
)
59+
add_executable(flatc_host IMPORTED GLOBAL)
60+
add_dependencies(flatc_host flatc_host_build)
61+
set_target_properties(flatc_host PROPERTIES IMPORTED_LOCATION ${_FLATC_HOST_BIN})
62+
63+
# Provide a flatbuffers interface target for headers
64+
if(NOT TARGET flatbuffers)
65+
add_library(flatbuffers INTERFACE)
66+
target_include_directories(flatbuffers INTERFACE ${flatbuffers_SOURCE_DIR}/include)
67+
# Avoid expecting generated sources from a built library
68+
target_compile_definitions(flatbuffers INTERFACE FLATBUFFERS_HEADER_ONLY)
69+
endif()
70+
71+
set(FLATC_COMMAND $<TARGET_FILE:flatc_host>)
72+
set(FLATC_TARGET flatc_host)
73+
message(STATUS "FLATBUFFERS: Host flatc will be built at ${_FLATC_HOST_BIN}")
74+
else()
75+
FetchContent_MakeAvailable(flatbuffers)
76+
77+
if(NOT MSVC)
78+
# only for clang 13+
79+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
80+
# if clang version < 13, do nothing
81+
if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13))
82+
target_compile_options(flatbuffers PRIVATE -Wno-unused-but-set-variable)
83+
target_compile_options(flatc PRIVATE -Wno-unused-but-set-variable)
84+
target_compile_options(flatbuffers PRIVATE -Wno-suggest-override)
85+
target_compile_options(flatc PRIVATE -Wno-suggest-override)
86+
endif()
87+
# For ther compilers that are not clang (GNU)
88+
else()
89+
target_compile_options(flatbuffers PRIVATE -Wno-suggest-override)
90+
target_compile_options(flatc PRIVATE -Wno-suggest-override)
91+
endif()
92+
endif()
93+
94+
set(FLATC_COMMAND $<TARGET_FILE:flatc>)
95+
set(FLATC_TARGET flatc)
96+
97+
message(STATUS "FLATBUFFERS: Fetched and configured")
98+
99+
endif()
100+
endif()
101+
102+
# Export variables to the parent scope
103+
set(FLATBUFFERS_SRC_DIR ${flatbuffers_SOURCE_DIR})
104+
set(FLATBUFFERS_INCLUDE_DIRECTORIES ${flatbuffers_SOURCE_DIR}/include)

docs/deps.png

305 KB
Loading

src/common_settings_dummy.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Dummy translation unit for vpunn_common_settings static library.
2+
// This file exists so that vpunn_common_settings can be a STATIC library
3+
// instead of an INTERFACE target, limiting transitive propagation of
4+
// compile options/definitions beyond direct dependents that link it.
5+
// (Intentionally left without code.)

0 commit comments

Comments
 (0)