Skip to content

Instantly share code, notes, and snippets.

@ShaderManager
Created January 31, 2019 12:03
Show Gist options
  • Save ShaderManager/5f2eb9cbde9a98f8082e444d1a8bd4ee to your computer and use it in GitHub Desktop.
Save ShaderManager/5f2eb9cbde9a98f8082e444d1a8bd4ee to your computer and use it in GitHub Desktop.
fcontext cmake
enable_language(ASM)
if (WIN32)
if (MSVC)
enable_language(ASM_MASM)
if (MSVC_C_ARCHITECTURE_ID STREQUAL "x64")
set(ASM_SOURCES asm/jump_x86_64_ms_pe_masm.asm asm/make_x86_64_ms_pe_masm.asm asm/ontop_x86_64_ms_pe_masm.asm)
elseif (MSVC_C_ARCHITECTURE_ID STREQUAL "X86")
set(ASM_SOURCES asm/jump_i386_ms_pe_masm.asm asm/make_i386_ms_pe_masm.asm asm/ontop_i386_ms_pe_masm.asm)
elseif (MSVC_C_ARCHITECTURE_ID STREQUAL "ARM")
set(ASM_SOURCES asm/jump_arm_aapcs_pe_armasm.asm asm/make_arm_aapcs_pe_armasm.asm asm/ontop_arm_aapcs_pe_armasm.asm)
endif ()
else ()
if (CMAKE_SIZEOF_VOID_P EQUAL 8) # 64 bit
set(ASM_SOURCES asm/jump_x86_64_ms_pe_gas.asm asm/make_x86_64_ms_pe_gas.asm asm/ontop_x86_64_ms_pe_gas.asm)
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) # 32 bit
set(ASM_SOURCES asm/jump_i386_ms_pe_gas.asm asm/make_i386_ms_pe_gas.asm asm/ontop_i386_ms_pe_gas.asm)
endif ()
endif ()
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "(arm)")
set(ASM_SOURCES asm/jump_arm_aapcs_elf_gas.S asm/make_arm_aapcs_elf_gas.S asm/ontop_arm_aapcs_elf_gas.S)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64)")
set(ASM_SOURCES asm/jump_arm64_aapcs_elf_gas.S asm/make_arm64_aapcs_elf_gas.S asm/ontop_arm64_aapcs_elf_gas.S)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "(mips)|(MIPS)")
set(ASM_SOURCES asm/jump_mips32_o32_elf_gas.S asm/make_mips32_o32_elf_gas.S asm/ontop_mips32_o32_elf_gas.S)
elseif (UNIX)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
if (CMAKE_SIZEOF_VOID_P EQUAL 8) # 64 bit
set(ASM_SOURCES asm/jump_x86_64_sysv_elf_gas.S asm/make_x86_64_sysv_elf_gas.S asm/ontop_x86_64_sysv_elf_gas.S)
else () # 32 bit
set(ASM_SOURCES asm/jump_i386_sysv_elf_gas.S asm/make_i386_sysv_elf_gas.S asm/ontop_i386_sysv_elf_gas.S)
endif ()
endif ()
elseif (APPLE)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
if (CMAKE_SIZEOF_VOID_P EQUAL 8) # 64 bit
set(ASM_SOURCES asm/jump_x86_64_sysv_macho_gas.S asm/make_x86_64_sysv_macho_gas.S asm/ontop_x86_64_sysv_macho_gas.S)
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) # 32 bit
set(ASM_SOURCES asm/jump_i386_sysv_macho_gas.S asm/make_i386_sysv_macho_gas.S asm/ontop_i386_sysv_macho_gas.S)
endif ()
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "(arm)")
set(ASM_SOURCES asm/jump_arm_aapcs_macho_gas.S asm/make_arm_aapcs_macho_gas.S asm/ontop_arm_aapcs_macho_gas.S)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "(arm64)")
set(ASM_SOURCES asm/jump_arm64_aapcs_macho_gas.S asm/make_arm64_aapcs_macho_gas.S asm/ontop_arm64_aapcs_macho_gas.S)
endif ()
endif ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment