Skip to content
Open
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
70 changes: 47 additions & 23 deletions backends/qualcomm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ if(${ANDROID})
find_library(android_log log)
endif()

add_compile_options("-Wall" "-Werror" "-fvisibility=hidden")
if(MSVC)
add_compile_options("/wd4996")
else()
add_compile_options("-Wall" "-Werror" "-fvisibility=hidden")
endif()
add_compile_definitions(C10_USING_CUSTOM_GENERATED_MACROS)

# GNU emits warning for ignored attributes Unfortunately, we use
Expand All @@ -89,21 +93,26 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()

if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
# strip symbols
add_link_options(LINKER:-s,--gc-sections)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES Hexagon)
add_compile_options(
"-Os"
"-ffunction-sections"
"-fdata-sections"
"-frtti"
"-fno-exceptions"
"-fomit-frame-pointer"
"-fno-asynchronous-unwind-tables"
)
if(MSVC)
add_compile_options("/O2")
else()

add_compile_options("-O3" "-ffunction-sections" "-fdata-sections" "-frtti")
# strip symbols
add_link_options(LINKER:-s,--gc-sections)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES Hexagon)
add_compile_options(
"-Os"
"-ffunction-sections"
"-fdata-sections"
"-frtti"
"-fno-exceptions"
"-fomit-frame-pointer"
"-fno-asynchronous-unwind-tables"
)
else()
add_compile_options(
"-O3" "-ffunction-sections" "-fdata-sections" "-frtti"
)
endif()
endif()
endif()

Expand Down Expand Up @@ -275,16 +284,27 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES Hexagon)
)
endif()

set_target_properties(
qnn_executorch_backend PROPERTIES LINK_FLAGS "-Wl,-rpath='$ORIGIN'"
)
if(MSVC)
target_compile_definitions(
qnn_executorch_backend PRIVATE QNN_EXECUTORCH_BUILDING_DLL
)
set_target_properties(
qnn_executorch_backend PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON
)
else()
set_target_properties(
qnn_executorch_backend PROPERTIES LINK_FLAGS "-Wl,-rpath='$ORIGIN'"
)
endif()
target_link_libraries(
shared_buffer PRIVATE qnn_executorch_logging ${CMAKE_DL_LIBS}
)
#
# add linker option
#
executorch_target_link_options_shared_lib(qnn_executorch_backend)
if(NOT MSVC)
executorch_target_link_options_shared_lib(qnn_executorch_backend)
endif()

#
# add sources
Expand Down Expand Up @@ -316,7 +336,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES Hexagon)
endif()

# QNN pybind
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64")
add_subdirectory(
${EXECUTORCH_SOURCE_DIR}/third-party/pybind11
${CMAKE_CURRENT_BINARY_DIR}/pybind11
Expand Down Expand Up @@ -350,9 +370,13 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")

if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
# need to allow exceptions in pybind
set(_pybind_compile_options -Wno-deprecated-declarations -fPIC -frtti
-fexceptions
)
if(MSVC)
set(_pybind_compile_options /wd4996 /EHsc)
else()
set(_pybind_compile_options -Wno-deprecated-declarations -fPIC -frtti
-fexceptions
)
endif()
target_compile_options(
PyQnnManagerAdaptor PUBLIC ${_pybind_compile_options}
)
Expand Down
6 changes: 3 additions & 3 deletions backends/qualcomm/aot/wrappers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
# wrappers
target_sources(
wrappers
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/TensorWrapper.cpp
${CMAKE_CURRENT_LIST_DIR}/TensorWrapper.h
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/QuantizeParamsWrapper.cpp
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/TensorWrapper.h
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/TensorWrapper.cpp
${CMAKE_CURRENT_LIST_DIR}/QuantizeParamsWrapper.cpp
${CMAKE_CURRENT_LIST_DIR}/QuantizeParamsWrapper.h
${CMAKE_CURRENT_LIST_DIR}/OpWrapper.cpp
${CMAKE_CURRENT_LIST_DIR}/OpWrapper.h
Expand Down
2 changes: 1 addition & 1 deletion backends/qualcomm/runtime/backends/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ target_sources(
)

set(platform target)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64")
set(platform host)
endif()

Expand Down
Loading
Loading