diff --git a/mupen64plus-core/.gitignore b/mupen64plus-core/.gitignore index 0b892f7..567609b 100644 --- a/mupen64plus-core/.gitignore +++ b/mupen64plus-core/.gitignore @@ -1,2 +1 @@ -/projects/unix/_obj*/ -/projects/unix/libmupen64plus*.so* +build/ diff --git a/mupen64plus-core/CMakeLists.txt b/mupen64plus-core/CMakeLists.txt new file mode 100644 index 0000000..f6e7b7a --- /dev/null +++ b/mupen64plus-core/CMakeLists.txt @@ -0,0 +1,129 @@ +cmake_minimum_required(VERSION 3.20) + +project(mupen64plus LANGUAGES C) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include(CheckIPOSupported) +check_ipo_supported(RESULT ENABLE_IPO) +if(ENABLE_IPO) + message("Interprocedural optimizations enabled") +endif(ENABLE_IPO) + +if(ENABLE_IPO AND (CMAKE_BUILD_TYPE STREQUAL "Release")) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON) +endif() + +find_package(PNG REQUIRED) +find_package(ZLIB REQUIRED) +find_package(SDL2 REQUIRED) +find_package(PkgConfig REQUIRED) +pkg_check_modules(SDL_NET REQUIRED SDL2_net) + +include_directories( + src + subprojects/md5 + subprojects/xxhash + subprojects/minizip + subprojects/xdelta + ${SDL2_INCLUDE_DIRS} +) + +add_definitions(-DM64P_PARALLEL -DM64P_NETPLAY -DNO_ASM) + +add_library(mupen64plus SHARED + src/api/callbacks.c + src/api/common.c + src/api/config.c + src/api/debugger.c + src/api/frontend.c + src/api/vidext.c + src/backends/api/video_capture_backend.c + src/backends/plugins_compat/audio_plugin_compat.c + src/backends/plugins_compat/input_plugin_compat.c + src/backends/clock_ctime_plus_delta.c + src/backends/dummy_video_capture.c + src/backends/file_storage.c + src/device/cart/cart.c + src/device/cart/af_rtc.c + src/device/cart/cart_rom.c + src/device/cart/eeprom.c + src/device/cart/flashram.c + src/device/cart/is_viewer.c + src/device/cart/sram.c + src/device/controllers/game_controller.c + src/device/controllers/vru_controller.c + src/device/controllers/paks/biopak.c + src/device/controllers/paks/mempak.c + src/device/controllers/paks/rumblepak.c + src/device/controllers/paks/transferpak.c + src/device/dd/dd_controller.c + src/device/dd/disk.c + src/device/device.c + src/device/gb/gb_cart.c + src/device/gb/mbc3_rtc.c + src/device/gb/m64282fp.c + src/device/memory/memory.c + src/device/pif/bootrom_hle.c + src/device/pif/cic.c + src/device/pif/n64_cic_nus_6105.c + src/device/pif/pif.c + src/device/r4300/cached_interp.c + src/device/r4300/cp0.c + src/device/r4300/cp1.c + src/device/r4300/idec.c + src/device/r4300/interrupt.c + src/device/r4300/pure_interp.c + src/device/r4300/r4300_core.c + src/device/r4300/dcache.c + src/device/r4300/icache.c + src/device/r4300/tlb.c + src/device/rcp/ai/ai_controller.c + src/device/rcp/mi/mi_controller.c + src/device/rcp/pi/pi_controller.c + src/device/rcp/rdp/fb.c + src/device/rcp/rdp/rdp_core.c + src/device/rcp/ri/ri_controller.c + src/device/rcp/rsp/rsp_core.c + src/device/rcp/si/si_controller.c + src/device/rcp/vi/vi_controller.c + src/device/rdram/rdram.c + src/main/main.c + src/main/util.c + src/main/cheat.c + src/main/eventloop.c + src/main/rom.c + src/main/savestates.c + src/main/screenshot.c + src/main/sdl_key_converter.c + src/main/workqueue.c + src/plugin/plugin.c + src/plugin/dummy_video.c + src/plugin/dummy_audio.c + src/plugin/dummy_input.c + src/plugin/dummy_rsp.c + src/main/netplay.c + subprojects/md5/md5.c + subprojects/minizip/ioapi.c + subprojects/minizip/unzip.c + subprojects/minizip/zip.c +) + +if (WIN32) + target_sources(mupen64plus PRIVATE + src/osal/dynamiclib_win32.c + src/osal/files_win32.c + ) +endif (WIN32) + +if (UNIX) + target_sources(mupen64plus PRIVATE + src/osal/dynamiclib_unix.c + src/osal/files_unix.c + ) +endif (UNIX) + +target_compile_options(mupen64plus PRIVATE -march=x86-64-v3) +target_link_options(mupen64plus PRIVATE -march=x86-64-v3) +target_link_libraries(mupen64plus PRIVATE SDL2 ${SDL_NET_LIBRARIES} ZLIB::ZLIB PNG::PNG) diff --git a/mupen64plus-core/projects/msvc/mupen64plus-core.vcxproj b/mupen64plus-core/projects/msvc/mupen64plus-core.vcxproj index a2c9b5a..903ad7e 100644 --- a/mupen64plus-core/projects/msvc/mupen64plus-core.vcxproj +++ b/mupen64plus-core/projects/msvc/mupen64plus-core.vcxproj @@ -271,8 +271,6 @@ - - true true diff --git a/mupen64plus-core/projects/msvc/mupen64plus-core.vcxproj.filters b/mupen64plus-core/projects/msvc/mupen64plus-core.vcxproj.filters index 47f2c17..caf7af7 100644 --- a/mupen64plus-core/projects/msvc/mupen64plus-core.vcxproj.filters +++ b/mupen64plus-core/projects/msvc/mupen64plus-core.vcxproj.filters @@ -252,12 +252,6 @@ device\r4300 - - device\memory - - - device\memory - device\r4300 diff --git a/mupen64plus-core/projects/unix/Makefile b/mupen64plus-core/projects/unix/Makefile index 63a341f..2222fe7 100755 --- a/mupen64plus-core/projects/unix/Makefile +++ b/mupen64plus-core/projects/unix/Makefile @@ -236,9 +236,9 @@ ifeq ($(OS), OSX) CXXFLAGS += '-stdlib=libc++' ifeq ($(CPU), X86) ifeq ($(ARCH_DETECTED), 64BITS) - CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=11.0 -isysroot $(OSX_SDK_PATH) + CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.7 -isysroot $(OSX_SDK_PATH) else - CFLAGS += -pipe -mmmx -msse -arch i686 -mmacosx-version-min=11.0 -isysroot $(OSX_SDK_PATH) + CFLAGS += -pipe -mmmx -msse -arch i686 -mmacosx-version-min=10.7 -isysroot $(OSX_SDK_PATH) ifneq ($(PROFILE), 1) CFLAGS += -fomit-frame-pointer endif @@ -248,7 +248,7 @@ ifeq ($(OS), OSX) ifeq ($(CPU), ARM) # assembly compilation not yet supported on macOS with Apple Silicon NO_ASM = 1 - CFLAGS += -pipe -arch arm64 -mmacosx-version-min=11.0 -isysroot $(OSX_SDK_PATH) + CFLAGS += -pipe -arch arm64 -mmacosx-version-min=10.16 -isysroot $(OSX_SDK_PATH) endif endif ifeq ($(OS), MINGW) @@ -561,8 +561,6 @@ SOURCE = \ $(SRCDIR)/device/r4300/interrupt.c \ $(SRCDIR)/device/r4300/pure_interp.c \ $(SRCDIR)/device/r4300/r4300_core.c \ - $(SRCDIR)/device/r4300/dcache.c \ - $(SRCDIR)/device/r4300/icache.c \ $(SRCDIR)/device/r4300/tlb.c \ $(SRCDIR)/device/rcp/ai/ai_controller.c \ $(SRCDIR)/device/rcp/mi/mi_controller.c \ @@ -599,8 +597,6 @@ CFLAGS += -I$(SUBDIR)/md5 # xxhash CFLAGS += -I$(SUBDIR)/xxhash -# xdelta -CFLAGS += -I$(SUBDIR)/xdelta ifeq ("$(OS)","MINGW") SOURCE += \