melonDS/src/CMakeLists.txt

127 lines
2.3 KiB
CMake
Raw Normal View History

2019-05-01 03:16:54 +00:00
project(core)
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 22:38:51 +00:00
set (CMAKE_CXX_STANDARD 17)
2019-05-01 03:16:54 +00:00
add_library(core STATIC
2020-08-12 22:20:34 +00:00
ARCodeFile.cpp
2020-02-14 18:26:52 +00:00
AREngine.cpp
2019-05-01 03:16:54 +00:00
ARM.cpp
2020-05-02 18:25:39 +00:00
ARM_InstrTable.h
2019-05-01 03:16:54 +00:00
ARMInterpreter.cpp
ARMInterpreter_ALU.cpp
ARMInterpreter_Branch.cpp
ARMInterpreter_LoadStore.cpp
Config.cpp
CP15.cpp
CRC32.cpp
DMA.cpp
2019-10-15 23:37:44 +00:00
DSi.cpp
DSi_AES.cpp
DSi_Camera.cpp
DSi_I2C.cpp
DSi_NDMA.cpp
DSi_NWifi.cpp
DSi_SD.cpp
DSi_SPI_TSC.cpp
2020-05-02 18:25:39 +00:00
FIFO.h
GBACart.cpp
2019-05-01 03:16:54 +00:00
GPU.cpp
GPU2D.cpp
2020-12-07 17:36:14 +00:00
GPU2D_Soft.cpp
2019-05-01 03:16:54 +00:00
GPU3D.cpp
GPU3D_Soft.cpp
2020-09-03 18:28:07 +00:00
melonDLDI.h
2019-05-01 03:16:54 +00:00
NDS.cpp
NDSCart.cpp
NDSCart_SRAMManager.cpp
Platform.h
2020-05-29 22:28:21 +00:00
ROMList.h
2019-05-01 03:16:54 +00:00
RTC.cpp
Savestate.cpp
SPI.cpp
SPU.cpp
2020-04-27 20:02:45 +00:00
types.h
version.h
2019-05-01 03:16:54 +00:00
Wifi.cpp
WifiAP.cpp
2019-10-15 23:37:44 +00:00
tiny-AES-c/aes.c
xxhash/xxhash.c
2019-07-14 17:24:00 +00:00
)
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 17:24:00 +00:00
if (ENABLE_JIT)
enable_language(ASM)
2019-07-14 17:24:00 +00:00
target_sources(core PRIVATE
ARM_InstrInfo.cpp
ARMJIT.cpp
ARMJIT_Memory.cpp
2019-07-14 17:24:00 +00:00
dolphin/CommonFuncs.cpp
)
2020-02-04 17:29:52 +00:00
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
2020-02-04 17:29:52 +00:00
)
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
2020-02-04 17:29:52 +00:00
)
endif()
2019-07-14 17:24:00 +00:00
endif()
2019-05-01 03:16:54 +00:00
Add support for macOS (#771) * use shm_open() instead of memfd_create() on macOS malloc.h isn't a header on macOS * Change OpenGL headers + create ifdef for DO_PROCLIST macOS seems to already have the OpenGL functions defined, without the ifdef, it gives "ambiguous references" errors. * macOS doesn't have ->gregs in uc_mcontext and it doesn't have REG_RIP either https://github.com/gperftools/gperftools/blob/master/m4/pc_from_ucontext.m4 * use getpid() to make memory file name unique * #ifndef __APPLE__ for AF_PACKET and linux/if_packet.h * Add include and link directories for macOS and link the OpenGL framework * Add macOS CI * Use newly added libslirp package from Homebrew https://github.com/Homebrew/homebrew-core/pull/63412 * Use Apple's Clang instead of GNU GCC on macOS * Add macOS build instructions to README * Try to fix macOS undefined symbol * snprintf doesn't take null terminator into account * Map new memory on macOS for JIT * Only use gcc-ar if using GNU Compiler * re-add fastmem code - whoops! * Fix style issue - use camelCase not snake_case * Set Minimum macOS version * Switch Minimum OS X version to 10.9 * Add macOS libpcap library name * fix memory leak * Fix binding keys in macOS * Allow getting MAC address on macOS melonDS on Linux uses AF_PACKET, which doesn't exist on macOS. Instead, this commit uses AF_LINK on macOS to get the MAC address. * Remove unneeded macOS CI dependencies * Build melonDS app bundle on macOS Now it is no longer required to install the libraries on macOS, they come with the app bundle. * fix macOS CI not being able to find macdeployqt * copy melonDS.app with recursive because it's a folder * Disable fastmem checkbox on macOS * Disable fastmem by default in config * forgot a semicolon * Don't bundle libraries, causes issues on macOS <10.15 * Update README + allow finding version in Finder on macOS * Make sure fastmem checkbox stays uncheckable
2020-11-29 16:11:33 +00:00
if (APPLE)
target_include_directories(core PUBLIC /usr/local/include /opt/homebrew/include)
target_link_directories(core PUBLIC /usr/local/lib /opt/homebrew/lib)
Add support for macOS (#771) * use shm_open() instead of memfd_create() on macOS malloc.h isn't a header on macOS * Change OpenGL headers + create ifdef for DO_PROCLIST macOS seems to already have the OpenGL functions defined, without the ifdef, it gives "ambiguous references" errors. * macOS doesn't have ->gregs in uc_mcontext and it doesn't have REG_RIP either https://github.com/gperftools/gperftools/blob/master/m4/pc_from_ucontext.m4 * use getpid() to make memory file name unique * #ifndef __APPLE__ for AF_PACKET and linux/if_packet.h * Add include and link directories for macOS and link the OpenGL framework * Add macOS CI * Use newly added libslirp package from Homebrew https://github.com/Homebrew/homebrew-core/pull/63412 * Use Apple's Clang instead of GNU GCC on macOS * Add macOS build instructions to README * Try to fix macOS undefined symbol * snprintf doesn't take null terminator into account * Map new memory on macOS for JIT * Only use gcc-ar if using GNU Compiler * re-add fastmem code - whoops! * Fix style issue - use camelCase not snake_case * Set Minimum macOS version * Switch Minimum OS X version to 10.9 * Add macOS libpcap library name * fix memory leak * Fix binding keys in macOS * Allow getting MAC address on macOS melonDS on Linux uses AF_PACKET, which doesn't exist on macOS. Instead, this commit uses AF_LINK on macOS to get the MAC address. * Remove unneeded macOS CI dependencies * Build melonDS app bundle on macOS Now it is no longer required to install the libraries on macOS, they come with the app bundle. * fix macOS CI not being able to find macdeployqt * copy melonDS.app with recursive because it's a folder * Disable fastmem checkbox on macOS * Disable fastmem by default in config * forgot a semicolon * Don't bundle libraries, causes issues on macOS <10.15 * Update README + allow finding version in Finder on macOS * Make sure fastmem checkbox stays uncheckable
2020-11-29 16:11:33 +00:00
endif()
if (ENABLE_OGLRENDERER)
find_package(PkgConfig REQUIRED)
pkg_check_modules(EPOXY REQUIRED epoxy)
target_include_directories(core PRIVATE ${EPOXY_INCLUDE_DIRS})
if (WIN32)
target_link_libraries(core ole32 comctl32 ws2_32 ${EPOXY_LIBRARIES})
elseif (APPLE)
target_link_libraries(core ${EPOXY_LIBRARIES})
else()
target_link_libraries(core rt ${EPOXY_LIBRARIES})
endif()
else()
if (WIN32)
target_link_libraries(core ole32 comctl32 ws2_32)
else()
target_link_libraries(core rt)
endif()
endif()