Skip to content

Commit

Permalink
CMake USE_CPU_GFX support
Browse files Browse the repository at this point in the history
  • Loading branch information
TellowKrinkle committed Jun 10, 2021
1 parent 70e4cda commit 6021892
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(ponscripter)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2)

option(USE_STEAM "Enable Steam Support" OFF)
option(USE_CPU_GFX "Custom graphics using intrinsics" OFF)
option(USE_CPU_GFX "Custom graphics using intrinsics" ON)
option(ENABLE_GAME_CONTROLLERS "Enable support for game controllers" ON)

# Workaround for bug on macOS where if you have Mono installed, CMake will prefer the (old) versions of JPEG and PNG that ship with it, even though you'll be linking with the dylibs in /usr/local/
Expand Down
13 changes: 13 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,16 @@ elseif (UNIX AND NOT APPLE)
LINUX
USE_OGG_VORBIS)
endif ()

if (USE_CPU_GFX)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
target_compile_definitions(ponscr PRIVATE USE_X86_GFX)
set_source_files_properties(graphics_mmx.cpp PROPERTIES COMPILE_FLAGS "-mmmx")
set_source_files_properties(graphics_sse2.cpp PROPERTIES COMPILE_FLAGS "-msse2")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL ppc OR CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64)
target_compile_definitions(ponscr PRIVATE USE_PPC_GFX)
set_source_files_properties(graphics_altivec.cpp PROPERTIES COMPILE_FLAGS "-maltivec")
else()
message(FATAL_ERROR "Unrecognized architecture ${CMAKE_SYSTEM_PROCESSOR}. Disable USE_CPU_GFX to continue.")
endif()
endif()

0 comments on commit 6021892

Please sign in to comment.