Skip to content

Commit

Permalink
Merge pull request #419 from anthony-linaro/fix-arm64-msvc
Browse files Browse the repository at this point in the history
Fix Windows ARM64 builds when using MSVC
  • Loading branch information
Jovasa authored Dec 2, 2024
2 parents 6b7f065 + 1db8fcd commit dd30dd2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,18 @@ if(BUILD_KVAZAAR_BINARY)
target_link_libraries(kvazaar-bin PUBLIC kvazaar)
endif()

list(APPEND ALLOW_AVX2 "x86_64" "AMD64")

if(MSVC)
target_include_directories(kvazaar PUBLIC src/threadwrapper/include)
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
if(${CMAKE_SYSTEM_PROCESSOR} IN_LIST ALLOW_AVX2)
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
endif()
else()
if(BUILD_KVAZAAR_BINARY)
set_target_properties(kvazaar-bin PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src)
endif()
set_target_properties(kvazaar PROPERTIES SOVERSION "7" VERSION "7.4.0")
list(APPEND ALLOW_AVX2 "x86_64" "AMD64")
if(${CMAKE_SYSTEM_PROCESSOR} IN_LIST ALLOW_AVX2)
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" )
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_SSE41} APPEND PROPERTY COMPILE_FLAGS "-msse4.1" )
Expand Down
2 changes: 1 addition & 1 deletion src/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ typedef enum { COLOR_Y = 0, COLOR_U, COLOR_V } color_t;
# define COMPILE_POWERPC 0
#endif

#if defined (_M_ARM) || defined(__arm__) || defined(__thumb__)
#if defined (_M_ARM) || defined(_M_ARM64) || defined(__arm__) || defined(__thumb__)
# define COMPILE_ARM 1
#else
# define COMPILE_ARM 0
Expand Down
7 changes: 5 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ if(BUILD_SHARED_LIBS)
add_definitions(-DPIC)
endif()

list(APPEND ALLOW_AVX2 "x86_64" "AMD64")

if(MSVC)
target_include_directories(kvazaar_tests PUBLIC ../src/threadwrapper/include)

set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
if(${CMAKE_SYSTEM_PROCESSOR} IN_LIST ALLOW_AVX2)
set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
endif()
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32 -DWIN32 -DWIN64)
else()
list(APPEND ALLOW_AVX2 "x86_64" "AMD64")
if(${CMAKE_SYSTEM_PROCESSOR} IN_LIST ALLOW_AVX2)
set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" )
endif()
Expand Down

0 comments on commit dd30dd2

Please sign in to comment.