7a7586ccaaa3d482c2ccd4170d12f819ab607d45
[deb_x265.git] / source / cmake / CMakeASM_YASMInformation.cmake
1 set(ASM_DIALECT "_YASM")
2 set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
3
4 if(X64)
5 list(APPEND ASM_FLAGS -DARCH_X86_64=1)
6 if(ENABLE_PIC)
7 list(APPEND ASM_FLAGS -DPIC)
8 endif()
9 if(APPLE)
10 set(ARGS -f macho64 -m amd64 -DPREFIX)
11 elseif(UNIX AND NOT CYGWIN)
12 set(ARGS -f elf64 -m amd64)
13 else()
14 set(ARGS -f win64 -m amd64)
15 endif()
16 else()
17 list(APPEND ASM_FLAGS -DARCH_X86_64=0)
18 if(APPLE)
19 set(ARGS -f macho -DPREFIX)
20 elseif(UNIX AND NOT CYGWIN)
21 set(ARGS -f elf32)
22 else()
23 set(ARGS -f win32 -DPREFIX)
24 endif()
25 endif()
26
27 if(GCC)
28 list(APPEND ASM_FLAGS -DHAVE_ALIGNED_STACK=1)
29 else()
30 list(APPEND ASM_FLAGS -DHAVE_ALIGNED_STACK=0)
31 endif()
32
33 if(HIGH_BIT_DEPTH)
34 list(APPEND ASM_FLAGS -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10)
35 else()
36 list(APPEND ASM_FLAGS -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8)
37 endif()
38 set(YASM_FLAGS ${ARGS} ${ASM_FLAGS} PARENT_SCOPE)
39 string(REPLACE ";" " " CMAKE_ASM_YASM_COMPILER_ARG1 "${ARGS}")
40
41 # This section exists to override the one in CMakeASMInformation.cmake
42 # (the default Information file). This removes the <FLAGS>
43 # thing so that your C compiler flags that have been set via
44 # set_target_properties don't get passed to yasm and confuse it.
45 if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
46 string(REPLACE ";" " " STR_ASM_FLAGS "${ASM_FLAGS}")
47 set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> ${STR_ASM_FLAGS} -o <OBJECT> <SOURCE>")
48 endif()
49
50 include(CMakeASMInformation)
51 set(ASM_DIALECT)