Commit e6b382c4 authored by Simon Morlat's avatar Simon Morlat
Browse files

Fix compilation error because of cmake 3.19 bug.

parent ebe1dda7
......@@ -31,6 +31,9 @@ project(libjpeg-turbo LANGUAGES C)
set(VERSION 2.0.5)
set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
# Cmake's nasm support is almost crappy.
set(USE_OWN_NASM_INVOCATION 1)
string(REPLACE "." ";" VERSION_TRIPLET ${VERSION})
list(GET VERSION_TRIPLET 0 VERSION_MAJOR)
list(GET VERSION_TRIPLET 1 VERSION_MINOR)
......@@ -584,8 +587,9 @@ elseif(NOT WITH_12BIT)
endif()
if(WITH_SIMD)
message(STATUS "SIMD extensions: ${CPU_TYPE} (WITH_SIMD = ${WITH_SIMD})")
if(MSVC_IDE OR XCODE)
if(USE_OWN_NASM_INVOCATION)
set_source_files_properties(${SIMD_OBJS} PROPERTIES GENERATED 1)
message(STATUS "Using own nasm invocation method because cmake's one sucks.")
endif()
else()
add_library(simd OBJECT jsimd_none.c)
......
......@@ -49,6 +49,7 @@ endif()
enable_language(ASM_NASM)
message(STATUS "CMAKE_ASM_NASM_COMPILER = ${CMAKE_ASM_NASM_COMPILER}")
if(CMAKE_ASM_NASM_OBJECT_FORMAT MATCHES "macho*")
set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DMACHO")
elseif(CMAKE_ASM_NASM_OBJECT_FORMAT MATCHES "elf*")
......@@ -70,11 +71,6 @@ endif()
message(STATUS "CMAKE_ASM_NASM_OBJECT_FORMAT = ${CMAKE_ASM_NASM_OBJECT_FORMAT}")
if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
simd_fail("SIMD extensions disabled: could not determine NASM object format")
return()
endif()
get_filename_component(CMAKE_ASM_NASM_COMPILER_TYPE
"${CMAKE_ASM_NASM_COMPILER}" NAME_WE)
if(CMAKE_ASM_NASM_COMPILER_TYPE MATCHES "yasm")
......@@ -143,7 +139,8 @@ endif()
if(MSVC_IDE)
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
string(REGEX REPLACE " " ";" CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS}")
elseif(XCODE)
#elseif(XCODE)
else()
set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}")
string(REGEX REPLACE " " ";" CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS}")
endif()
......@@ -173,7 +170,7 @@ foreach(file ${SIMD_SOURCES})
${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE})
endif()
set(OBJECT_DEPENDS ${OBJECT_DEPENDS} ${INC_FILES})
if(MSVC_IDE OR XCODE)
if(USE_OWN_NASM_INVOCATION)
# The CMake Visual Studio generators do not work properly with the ASM_NASM
# language, so we have to go rogue here and use a custom command like we
# did in prior versions of libjpeg-turbo. (This is why we can't have nice
......@@ -183,7 +180,7 @@ foreach(file ${SIMD_SOURCES})
add_custom_command(OUTPUT ${SIMD_OBJ} DEPENDS ${file} ${OBJECT_DEPENDS}
COMMAND ${CMAKE_ASM_NASM_COMPILER} -f${CMAKE_ASM_NASM_OBJECT_FORMAT}
${CMAKE_ASM_NASM_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${file}
-o${SIMD_OBJ})
-o ${SIMD_OBJ})
set(SIMD_OBJS ${SIMD_OBJS} ${SIMD_OBJ})
else()
set_source_files_properties(${file} PROPERTIES OBJECT_DEPENDS
......@@ -191,7 +188,7 @@ foreach(file ${SIMD_SOURCES})
endif()
endforeach()
if(MSVC_IDE OR XCODE)
if(USE_OWN_NASM_INVOCATION)
set(SIMD_OBJS ${SIMD_OBJS} PARENT_SCOPE)
add_library(simd OBJECT ${CPU_TYPE}/jsimd.c)
add_custom_target(simd-objs DEPENDS ${SIMD_OBJS})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment