Skip to content

Commit

Permalink
Add defines for mips and loongarch64 architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Mar 16, 2024
1 parent d0791a5 commit 6fe14d9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 15 deletions.
15 changes: 12 additions & 3 deletions SamTFE/Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_
message(STATUS "Architecture RISCV64, -march=rv64gc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
add_compile_options(-mpowerpc64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
add_compile_options(-march=loongarch64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "mips|mips64|mipsel|mips64el")
add_compile_options(-march=mips32r2)
else()
if(LOCAL_INSTALL)
add_compile_options(-march=native)
Expand Down Expand Up @@ -434,6 +438,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_
add_compile_options(-ftree-vectorize)
add_compile_options(-fomit-frame-pointer)
message(STATUS "AARCH64, -march=armv8-a+crc+fp+simd")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
message(STATUS "Loongsoon 3 5000 series processor")
else()
message(FATAL_ERROR "Unknown ARM processor '${CMAKE_SYSTEM_PROCESSOR}'")
endif()
Expand Down Expand Up @@ -1512,6 +1518,9 @@ endif()
if(FREEBSD OR MACOSX)
set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,${RPATH_SETTINGS}")
else()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mips|mips64|mipsel|mips64el")
target_link_libraries(${ENGINELIB} atomic)
endif()
if(USE_SYSTEM_VULKAN)
target_link_libraries(${ENGINELIB} vulkan)
set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,-lvulkan,${RPATH_SETTINGS}")
Expand Down Expand Up @@ -1632,23 +1641,23 @@ if(LINUX)
target_link_libraries(DedicatedServer${MP} "m")
target_link_libraries(DedicatedServer${MP} "dl")
target_link_libraries(DedicatedServer${MP} "pthread")
target_link_libraries(DedicatedServer${MP} ${SDL2_LIBRARY})
target_link_libraries(DedicatedServer${MP} ${SDL2_LIBRARY})
target_link_libraries(DedicatedServer${MP} ${ZLIB_LIBRARIES})
endif()
if(BUILD_MAKEFONT)
set_target_properties(MakeFONT${MP} PROPERTIES LINK_FLAGS "-Wl,${RPATH_SETTINGS}")
target_link_libraries(MakeFONT${MP} "m")
target_link_libraries(MakeFONT${MP} "dl")
target_link_libraries(MakeFONT${MP} "pthread")
target_link_libraries(MakeFONT${MP} ${SDL2_LIBRARY})
target_link_libraries(MakeFONT${MP} ${SDL2_LIBRARY})
target_link_libraries(MakeFONT${MP} ${ZLIB_LIBRARIES})
endif()
if(BUILD_TEXConv)
set_target_properties(TEXConv${MP} PROPERTIES LINK_FLAGS "-Wl,${RPATH_SETTINGS}")
target_link_libraries(TEXConv${MP} "m")
target_link_libraries(TEXConv${MP} "dl")
target_link_libraries(TEXConv${MP} "pthread")
target_link_libraries(TEXConv${MP} ${SDL2_LIBRARY})
target_link_libraries(TEXConv${MP} ${SDL2_LIBRARY})
target_link_libraries(TEXConv${MP} ${ZLIB_LIBRARIES})
endif()
endif()
Expand Down
10 changes: 6 additions & 4 deletions SamTFE/Sources/Engine/Base/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,23 @@ typedef uint32_t UINT;
#define PLATFORM_RISCV64 0
#endif

#if defined(__aarch64__) || defined(__arm__) || PLATFORM_RISCV64 || defined(__mips__) || defined(__s390x__) || defined(__s390__) \
#if defined(__aarch64__) || defined(__arm__) || PLATFORM_RISCV64 || defined(mips) || defined(__mips__) || defined(__mips) || defined(__s390x__) || defined(__s390__) \
|| defined(_powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__POWERPC__) || defined(__ppc__) \
|| defined(__ppc64__) || defined(__PPC__) || defined(__PPC64__) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__)
|| defined(__ppc64__) || defined(__PPC__) || defined(__PPC64__) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) \
|| defined(__loongarch_lp64) || defined(__loongarch_double_float) || defined(__loongarch_single_float) || defined(__loongarch_soft_float)
#define PLATFORM_NOT_X86 1
#else
#define PLATFORM_NOT_X86 0
#endif

#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_ARCH_PPC64) \
|| defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) || PLATFORM_RISCV64 || defined(__powerpc64__) || defined(__s390x__) || defined(__ppc64__)
|| defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) || PLATFORM_RISCV64 || defined(__powerpc64__) || defined(__s390x__) || defined(__ppc64__) \
|| defined(__loongarch_lp64) || defined(__loongarch_double_float) || defined(__loongarch_single_float) || defined(__loongarch_soft_float)

#define PLATFORM_64BIT 1

#elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) || defined(__POWERPC__) \
|| defined(_M_PPC) || defined(_ARCH_PPC)
|| defined(_M_PPC) || defined(_ARCH_PPC) || (defined(mips) && !defined(__LP64__)) || (defined(mips__) && !defined(__LP64__)) || (defined(__mips__) && !defined(__LP64__))

#define PLATFORM_32BIT 1

Expand Down
17 changes: 13 additions & 4 deletions SamTSE/Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_
message(STATUS "Architecture RISCV64, -march=rv64gc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
add_compile_options(-mpowerpc64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
add_compile_options(-march=loongarch64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "mips|mips64|mipsel|mips64el")
add_compile_options(-march=mips32r2)
else()
if(LOCAL_INSTALL)
add_compile_options(-march=native)
Expand Down Expand Up @@ -434,6 +438,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_
add_compile_options(-ftree-vectorize)
add_compile_options(-fomit-frame-pointer)
message(STATUS "AARCH64, -march=armv8-a+crc+fp+simd")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
message(STATUS "Loongsoon 3 5000 series processor")
else()
message(FATAL_ERROR "Unknown ARM processor '${CMAKE_SYSTEM_PROCESSOR}'")
endif()
Expand Down Expand Up @@ -1512,6 +1518,9 @@ endif()
if(FREEBSD OR MACOSX)
set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,${RPATH_SETTINGS}")
else()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "mips|mips64|mipsel|mips64el")
target_link_libraries(${ENGINELIB} atomic)
endif()
if(USE_SYSTEM_VULKAN)
target_link_libraries(${ENGINELIB} vulkan)
set_target_properties(${ENGINELIB} PROPERTIES ENABLE_EXPORTS ON LINK_FLAGS "-Wl,-lvulkan,${RPATH_SETTINGS}")
Expand Down Expand Up @@ -1632,23 +1641,23 @@ if(LINUX)
target_link_libraries(DedicatedServer${MP} "m")
target_link_libraries(DedicatedServer${MP} "dl")
target_link_libraries(DedicatedServer${MP} "pthread")
target_link_libraries(DedicatedServer${MP} ${SDL2_LIBRARY})
target_link_libraries(DedicatedServer${MP} ${SDL2_LIBRARY})
target_link_libraries(DedicatedServer${MP} ${ZLIB_LIBRARIES})
endif()
if(BUILD_MAKEFONT)
set_target_properties(MakeFONT${MP} PROPERTIES LINK_FLAGS "-Wl,${RPATH_SETTINGS}")
target_link_libraries(MakeFONT${MP} "m")
target_link_libraries(MakeFONT${MP} "dl")
target_link_libraries(MakeFONT${MP} "pthread")
target_link_libraries(MakeFONT${MP} ${SDL2_LIBRARY})
target_link_libraries(MakeFONT${MP} "pthread")
target_link_libraries(MakeFONT${MP} ${SDL2_LIBRARY})
target_link_libraries(MakeFONT${MP} ${ZLIB_LIBRARIES})
endif()
if(BUILD_TEXConv)
set_target_properties(TEXConv${MP} PROPERTIES LINK_FLAGS "-Wl,${RPATH_SETTINGS}")
target_link_libraries(TEXConv${MP} "m")
target_link_libraries(TEXConv${MP} "dl")
target_link_libraries(TEXConv${MP} "pthread")
target_link_libraries(TEXConv${MP} ${SDL2_LIBRARY})
target_link_libraries(TEXConv${MP} ${SDL2_LIBRARY})
target_link_libraries(TEXConv${MP} ${ZLIB_LIBRARIES})
endif()
endif()
Expand Down
10 changes: 6 additions & 4 deletions SamTSE/Sources/Engine/Base/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,23 @@ typedef uint32_t UINT;
#define PLATFORM_RISCV64 0
#endif

#if defined(__aarch64__) || defined(__arm__) || PLATFORM_RISCV64 || defined(__mips__) || defined(__s390x__) || defined(__s390__) \
#if defined(__aarch64__) || defined(__arm__) || PLATFORM_RISCV64 || defined(mips) || defined(__mips__) || defined(__mips) || defined(__s390x__) || defined(__s390__) \
|| defined(_powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__POWERPC__) || defined(__ppc__) \
|| defined(__ppc64__) || defined(__PPC__) || defined(__PPC64__) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__)
|| defined(__ppc64__) || defined(__PPC__) || defined(__PPC64__) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) \
|| defined(__loongarch_lp64) || defined(__loongarch_double_float) || defined(__loongarch_single_float) || defined(__loongarch_soft_float)
#define PLATFORM_NOT_X86 1
#else
#define PLATFORM_NOT_X86 0
#endif

#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_ARCH_PPC64) \
|| defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) || PLATFORM_RISCV64 || defined(__powerpc64__) || defined(__s390x__) || defined(__ppc64__)
|| defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) || PLATFORM_RISCV64 || defined(__powerpc64__) || defined(__s390x__) || defined(__ppc64__) \
|| defined(__loongarch_lp64) || defined(__loongarch_double_float) || defined(__loongarch_single_float) || defined(__loongarch_soft_float)

#define PLATFORM_64BIT 1

#elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) || defined(__POWERPC__) \
|| defined(_M_PPC) || defined(_ARCH_PPC)
|| defined(_M_PPC) || defined(_ARCH_PPC) || (defined(mips) && !defined(__LP64__)) || (defined(mips__) && !defined(__LP64__)) || (defined(__mips__) && !defined(__LP64__))

#define PLATFORM_32BIT 1

Expand Down

0 comments on commit 6fe14d9

Please sign in to comment.