retro-go/base.cmake
Alex Duchesne dcc2e17943 Updated build options to improve performance on esp-idf 4.4/5.x
Starting with esp-idf 4.4, build options `-fno-jump-tables -fno-tree-switch-conversion` are always used. [1]

This is very bad for us because most emulators rely on switches being converted to jump tables.

This patch brings performance back to parity with 4.3.

1. https://github.com/espressif/esp-idf/releases/tag/v4.4:

> Always compile with -fno-jump-tables -fno-tree-switch-conversion by default. This could results in performance regression for code that relies heavily on this optimization. See api-guides/memory-types.rst for how to enable it for specific source files if necessary.
2024-08-27 11:52:19 -04:00

23 lines
708 B
CMake

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
set(EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/components")
macro(rg_setup_compile_options)
component_compile_options(
-D${RG_BUILD_TARGET}=1
-DRETRO_GO=1
-fjump-tables -ftree-switch-conversion
${ARGV}
)
if(RG_ENABLE_NETPLAY)
component_compile_options(-DRG_ENABLE_NETWORKING -DRG_ENABLE_NETPLAY)
elseif(RG_ENABLE_NETWORKING)
component_compile_options(-DRG_ENABLE_NETWORKING)
endif()
if(RG_ENABLE_PROFILING)
# Still debating whether -fno-inline is necessary or not...
component_compile_options(-DRG_ENABLE_PROFILING -finstrument-functions)
endif()
endmacro()