melonDS/src/CMakeLists.txt

148 lines
3.1 KiB
CMake
Raw Normal View History

Allow for a more modular renderer backends (#990) * Draft GPU3D renderer modularization * Update sources C++ standard to C++17 The top-level `CMakeLists.txt` is already using the C++17 standard. * Move GLCompositor into class type Some other misc fixes to push towards better modularity * Make renderer-implementation types move-only These types are going to be holding onto handles of GPU-side resources and shouldn't ever be copied around. * Fix OSX: Remove 'register' storage class specifier `register` has been removed in C++17... But this keyword hasn't done anything in years anyways. OSX builds consider this "warning" an error and it stops the whole build. * Add RestartFrame to Renderer3D interface * Move Accelerated property to Renderer3D interface There are points in the code base where we do: `renderer != 0` to know if we are feeding an openGL renderer. Rather than that we can instead just have this be a property of the renderer itself. With this pattern a renderer can just say how it wants its data to come in rather than have everyone know that they're talking to an OpenGL renderer. * Remove Accelerated flag from GPU * Move 2D_Soft interface in separate header Also make the current 2D engine an "owned" unique_ptr. * Update alignment attribute to standard alignas Uses standardized `alignas` rather than compiler-specific attributes. https://en.cppreference.com/w/cpp/language/alignas * Fix Clang: alignas specifier Alignment must be specified before the array to align the entire array. https://en.cppreference.com/w/cpp/language/alignas * Converted Renderer3D Accelerated to variable This flag is checked a lot during scanline rasterization. So rather than having an expensive vtable-lookup call during mainline rendering code, it is now a public constant bool type that is written to only once during Renderer3D initialization.
2021-02-09 15:38:51 -07:00
set (CMAKE_CXX_STANDARD 17)
include(FixInterfaceIncludes)
2019-04-30 21:16:54 -06:00
add_library(core STATIC
ARCodeFile.cpp
AREngine.cpp
ARM.cpp
ARM_InstrTable.h
ARMInterpreter.cpp
ARMInterpreter_ALU.cpp
ARMInterpreter_Branch.cpp
ARMInterpreter_LoadStore.cpp
CP15.cpp
CRC32.cpp
DMA.cpp
DMA_Timings.h
DSi.cpp
DSi_AES.cpp
DSi_Camera.cpp
DSi_DSP.cpp
DSi_I2C.cpp
DSi_NAND.cpp
DSi_NDMA.cpp
DSi_NWifi.cpp
DSi_SD.cpp
DSi_SPI_TSC.cpp
FATStorage.cpp
FIFO.h
GBACart.cpp
GPU.cpp
GPU2D.cpp
GPU2D_Soft.cpp
GPU3D.cpp
GPU3D_Soft.cpp
melonDLDI.h
NDS.cpp
NDSCart.cpp
Platform.h
ROMList.h
FreeBIOS.h
RTC.cpp
Savestate.cpp
SPI.cpp
SPU.cpp
types.h
version.h
Wifi.cpp
WifiAP.cpp
fatfs/diskio.c
fatfs/ff.c
fatfs/ffsystem.c
fatfs/ffunicode.c
fatfs/ffconf.h
sha1/sha1.c
tiny-AES-c/aes.c
xxhash/xxhash.c)
if (ENABLE_OGLRENDERER)
target_sources(core PRIVATE
GPU_OpenGL.cpp
GPU_OpenGL_shaders.h
GPU3D_OpenGL.cpp
GPU3D_OpenGL_shaders.h
OpenGLSupport.cpp)
endif()
2019-07-14 11:24:00 -06:00
if (ENABLE_JIT)
enable_language(ASM)
target_sources(core PRIVATE
ARM_InstrInfo.cpp
ARMJIT.cpp
ARMJIT_Memory.cpp
dolphin/CommonFuncs.cpp)
if (ARCHITECTURE STREQUAL x86_64)
target_sources(core PRIVATE
dolphin/x64ABI.cpp
dolphin/x64CPUDetect.cpp
dolphin/x64Emitter.cpp
ARMJIT_x64/ARMJIT_Compiler.cpp
ARMJIT_x64/ARMJIT_ALU.cpp
ARMJIT_x64/ARMJIT_LoadStore.cpp
ARMJIT_x64/ARMJIT_Branch.cpp
ARMJIT_x64/ARMJIT_Linkage.S)
endif()
if (ARCHITECTURE STREQUAL ARM64)
target_sources(core PRIVATE
dolphin/Arm64Emitter.cpp
dolphin/MathUtil.cpp
ARMJIT_A64/ARMJIT_Compiler.cpp
ARMJIT_A64/ARMJIT_ALU.cpp
ARMJIT_A64/ARMJIT_LoadStore.cpp
ARMJIT_A64/ARMJIT_Branch.cpp
ARMJIT_A64/ARMJIT_Linkage.S)
endif()
2019-07-14 11:24:00 -06:00
endif()
2019-04-30 21:16:54 -06:00
add_subdirectory(teakra EXCLUDE_FROM_ALL)
# Workaround for building teakra with -O0 on Windows either failing or hanging forever
target_compile_options(teakra PRIVATE "$<$<CONFIG:DEBUG>:-Og>")
target_link_libraries(core PRIVATE teakra)
find_library(m MATH_LIBRARY)
if (MATH_LIBRARY)
target_link_libraries(core PRIVATE ${MATH_LIBRARY})
endif()
if (ENABLE_OGLRENDERER)
find_package(PkgConfig REQUIRED)
pkg_check_modules(Epoxy REQUIRED IMPORTED_TARGET epoxy)
fix_interface_includes(PkgConfig::Epoxy)
target_link_libraries(core PUBLIC PkgConfig::Epoxy)
target_compile_definitions(core PUBLIC OGLRENDERER_ENABLED)
endif()
if (ENABLE_JIT)
target_compile_definitions(core PUBLIC JIT_ENABLED)
if (ENABLE_JIT_PROFILING)
include(cmake/FindVTune.cmake)
add_definitions(-DJIT_PROFILING_ENABLED)
endif()
endif()
if (WIN32)
target_link_libraries(core PRIVATE ole32 comctl32 ws2_32)
elseif(NOT APPLE)
target_link_libraries(core PRIVATE rt)
endif()
if (ENABLE_JIT_PROFILING)
target_link_libraries(core PRIVATE jitprofiling)
endif()