~tom-gall/libjpeg-turbo/upstream-1.2

1 by Tom Gall
initial import based on mandeeps git tree and my packaging
1
if(NOT DEFINED NASM)
50 by Tom Gall
r725: Expose NASM variable in ccmake
2
  set(NASM nasm CACHE PATH "Path to NASM/YASM executable")
1 by Tom Gall
initial import based on mandeeps git tree and my packaging
3
endif()
4
5
if(SIMD_X86_64)
6
  set(NAFLAGS -fwin64 -DWIN64 -D__x86_64__ -I${CMAKE_SOURCE_DIR}/win/
7
    -I${CMAKE_CURRENT_SOURCE_DIR}/)
8
else()
9
  set(NAFLAGS -fwin32 -DWIN32 -I${CMAKE_SOURCE_DIR}/win/
10
    -I${CMAKE_CURRENT_SOURCE_DIR}/)
11
endif()
12
13
# This only works if building from the command line.  There is currently no way
14
# to set a variable's value based on the build type when using the MSVC IDE.
15
if(CMAKE_BUILD_TYPE STREQUAL "Debug"
16
  OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
17
  set(NAFLAGS ${NAFLAGS} -g)
18
endif()
19
20
if(SIMD_X86_64)
6 by Tom Gall
merge in 1.1.90 from upstream
21
  set(SIMD_BASENAMES jfsseflt-64 jccolss2-64 jdcolss2-64 jcgrass2-64
22
    jcsamss2-64 jdsamss2-64 jdmerss2-64 jcqnts2i-64 jfss2fst-64 jfss2int-64
23
    jiss2red-64 jiss2int-64 jiss2fst-64 jcqnts2f-64 jiss2flt-64)
1 by Tom Gall
initial import based on mandeeps git tree and my packaging
24
  message(STATUS "Building x86_64 SIMD extensions")
25
else()
6 by Tom Gall
merge in 1.1.90 from upstream
26
  set(SIMD_BASENAMES jsimdcpu jccolmmx jcgrammx jdcolmmx jcsammmx jdsammmx
27
    jdmermmx jcqntmmx jfmmxfst jfmmxint jimmxred jimmxint jimmxfst jcqnt3dn
28
    jf3dnflt ji3dnflt jcqntsse jfsseflt jisseflt jccolss2 jcgrass2 jdcolss2
29
    jcsamss2 jdsamss2 jdmerss2 jcqnts2i jfss2fst jfss2int jiss2red jiss2int
30
    jiss2fst jcqnts2f jiss2flt)
1 by Tom Gall
initial import based on mandeeps git tree and my packaging
31
  message(STATUS "Building i386 SIMD extensions")
32
endif()
33
34
if(MSVC_IDE)
2 by Tom Gall
forward port Mandeeps changes to 1.1.1 and cross build enablement by Michael Edwards michaedw att cisco.com
35
  set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
1 by Tom Gall
initial import based on mandeeps git tree and my packaging
36
else()
37
  set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
38
endif()
39
40
foreach(file ${SIMD_BASENAMES})
41
  set(DEPFILE "")
42
  set(SIMD_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${file}.asm)
43
  if(${file} MATCHES col)
44
    set(DEPFILE ${SIMD_SRC})
45
    string(REGEX REPLACE "col" "clr" DEPFILE ${DEPFILE})
46
  endif()
47
  if(${file} MATCHES mer)
48
    set(DEPFILE ${SIMD_SRC})
49
    string(REGEX REPLACE "mer" "mrg" DEPFILE ${DEPFILE})
50
  endif()
6 by Tom Gall
merge in 1.1.90 from upstream
51
  if(${file} MATCHES gra)
52
    set(DEPFILE ${SIMD_SRC})
53
    string(REGEX REPLACE "gra" "gry" DEPFILE ${DEPFILE})
54
  endif()
1 by Tom Gall
initial import based on mandeeps git tree and my packaging
55
  set(SIMD_OBJ ${OBJDIR}/${file}.obj)
56
  add_custom_command(OUTPUT ${SIMD_OBJ} DEPENDS ${SIMD_SRC} ${DEPFILE} *.inc
57
    COMMAND ${NASM} ${NAFLAGS} ${SIMD_SRC} -o${SIMD_OBJ})
58
  set(SIMD_OBJS ${SIMD_OBJS} ${SIMD_OBJ})
59
endforeach()
60
61
set(SIMD_OBJS ${SIMD_OBJS} PARENT_SCOPE)
62
add_custom_target(simd DEPENDS ${SIMD_OBJS})