OLD | NEW |
(Empty) | |
| 1 if(NOT DEFINED NASM) |
| 2 set(NASM nasm CACHE FILEPATH "Path to NASM/YASM executable") |
| 3 endif() |
| 4 |
| 5 if(SIMD_X86_64) |
| 6 set(NAFLAGS -fwin64 -DWIN64 -D__x86_64__) |
| 7 else() |
| 8 if(BORLAND) |
| 9 set(NAFLAGS -fobj -DOBJ32) |
| 10 else() |
| 11 set(NAFLAGS -fwin32 -DWIN32) |
| 12 endif() |
| 13 endif() |
| 14 set(NAFLAGS ${NAFLAGS} -I${CMAKE_SOURCE_DIR}/win/ -I${CMAKE_CURRENT_SOURCE_DIR}/
) |
| 15 |
| 16 # This only works if building from the command line. There is currently no way |
| 17 # to set a variable's value based on the build type when using the MSVC IDE. |
| 18 if(CMAKE_BUILD_TYPE STREQUAL "Debug" |
| 19 OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") |
| 20 set(NAFLAGS ${NAFLAGS} -g) |
| 21 endif() |
| 22 |
| 23 if(SIMD_X86_64) |
| 24 set(SIMD_BASENAMES jfdctflt-sse-64 jccolor-sse2-64 jcgray-sse2-64 |
| 25 jchuff-sse2-64 jcsample-sse2-64 jdcolor-sse2-64 jdmerge-sse2-64 |
| 26 jdsample-sse2-64 jfdctfst-sse2-64 jfdctint-sse2-64 jidctflt-sse2-64 |
| 27 jidctfst-sse2-64 jidctint-sse2-64 jidctred-sse2-64 jquantf-sse2-64 |
| 28 jquanti-sse2-64) |
| 29 message(STATUS "Building x86_64 SIMD extensions") |
| 30 else() |
| 31 set(SIMD_BASENAMES jsimdcpu jfdctflt-3dn jidctflt-3dn jquant-3dn jccolor-mmx |
| 32 jcgray-mmx jcsample-mmx jdcolor-mmx jdmerge-mmx jdsample-mmx jfdctfst-mmx |
| 33 jfdctint-mmx jidctfst-mmx jidctint-mmx jidctred-mmx jquant-mmx jfdctflt-sse |
| 34 jidctflt-sse jquant-sse jccolor-sse2 jcgray-sse2 jchuff-sse2 jcsample-sse2 |
| 35 jdcolor-sse2 jdmerge-sse2 jdsample-sse2 jfdctfst-sse2 jfdctint-sse2 |
| 36 jidctflt-sse2 jidctfst-sse2 jidctint-sse2 jidctred-sse2 jquantf-sse2 |
| 37 jquanti-sse2) |
| 38 message(STATUS "Building i386 SIMD extensions") |
| 39 endif() |
| 40 |
| 41 if(MSVC_IDE) |
| 42 set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}") |
| 43 else() |
| 44 set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR}) |
| 45 endif() |
| 46 |
| 47 file(GLOB INC_FILES *.inc) |
| 48 |
| 49 foreach(file ${SIMD_BASENAMES}) |
| 50 set(DEPFILE "") |
| 51 set(SIMD_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${file}.asm) |
| 52 if(${file} MATCHES jccolor) |
| 53 set(DEPFILE ${file}) |
| 54 string(REGEX REPLACE "jccolor" "jccolext" DEPFILE ${DEPFILE}) |
| 55 set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm) |
| 56 endif() |
| 57 if(${file} MATCHES jcgray) |
| 58 set(DEPFILE ${file}) |
| 59 string(REGEX REPLACE "jcgray" "jcgryext" DEPFILE ${DEPFILE}) |
| 60 set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm) |
| 61 endif() |
| 62 if(${file} MATCHES jdcolor) |
| 63 set(DEPFILE ${file}) |
| 64 string(REGEX REPLACE "jdcolor" "jdcolext" DEPFILE ${DEPFILE}) |
| 65 set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm) |
| 66 endif() |
| 67 if(${file} MATCHES jdmerge) |
| 68 set(DEPFILE ${file}) |
| 69 string(REGEX REPLACE "jdmerge" "jdmrgext" DEPFILE ${DEPFILE}) |
| 70 set(DEPFILE ${CMAKE_CURRENT_SOURCE_DIR}/${DEPFILE}.asm) |
| 71 endif() |
| 72 set(SIMD_OBJ ${OBJDIR}/${file}.obj) |
| 73 add_custom_command(OUTPUT ${SIMD_OBJ} |
| 74 DEPENDS ${SIMD_SRC} ${DEPFILE} ${INC_FILES} |
| 75 COMMAND ${NASM} ${NAFLAGS} ${SIMD_SRC} -o${SIMD_OBJ}) |
| 76 set(SIMD_OBJS ${SIMD_OBJS} ${SIMD_OBJ}) |
| 77 endforeach() |
| 78 |
| 79 set(SIMD_OBJS ${SIMD_OBJS} PARENT_SCOPE) |
| 80 add_custom_target(simd DEPENDS ${SIMD_OBJS}) |
OLD | NEW |