2022-08-22 22:21:23 +02:00
|
|
|
project(cemuMain)
|
|
|
|
|
|
|
|
option(CEMU_CXX_FLAGS "Additional flags used for compiling Cemu source code")
|
|
|
|
if(CEMU_CXX_FLAGS)
|
2022-09-01 14:46:56 +02:00
|
|
|
add_compile_options(${CEMU_CXX_FLAGS})
|
2022-08-22 22:21:23 +02:00
|
|
|
endif()
|
|
|
|
|
2022-09-01 14:46:56 +02:00
|
|
|
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
message( FATAL_ERROR "Pointers are not 64bit" )
|
2022-08-22 22:21:23 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MSVC)
|
2022-09-01 14:46:56 +02:00
|
|
|
add_compile_definitions(WIN32_LEAN_AND_MEAN CURL_STATICLIB)
|
2022-08-22 22:21:23 +02:00
|
|
|
elseif(UNIX)
|
2022-09-01 14:46:56 +02:00
|
|
|
if(APPLE)
|
|
|
|
add_compile_definitions(
|
|
|
|
_XOPEN_SOURCE
|
|
|
|
VK_USE_PLATFORM_MACOS_MVK
|
|
|
|
VK_USE_PLATFORM_METAL_EXT
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
add_compile_definitions(
|
|
|
|
VK_USE_PLATFORM_XLIB_KHR # legacy. Do we need to support XLIB surfaces?
|
|
|
|
VK_USE_PLATFORM_XCB_KHR
|
|
|
|
)
|
2022-12-15 08:44:14 +01:00
|
|
|
if (ENABLE_WAYLAND)
|
|
|
|
add_compile_definitions(VK_USE_PLATFORM_WAYLAND_KHR)
|
|
|
|
endif()
|
2022-09-01 14:46:56 +02:00
|
|
|
endif()
|
|
|
|
# warnings
|
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
|
|
add_compile_options(-Wno-ambiguous-reversed-operator)
|
|
|
|
endif()
|
2022-08-28 15:29:15 +02:00
|
|
|
|
2022-09-01 20:46:20 +02:00
|
|
|
add_compile_options(-Wno-multichar -Wno-invalid-offsetof -Wno-switch -Wno-ignored-attributes -Wno-deprecated-enum-enum-conversion)
|
2022-08-22 22:21:23 +02:00
|
|
|
endif()
|
|
|
|
|
2022-09-01 14:46:56 +02:00
|
|
|
add_compile_definitions(VK_NO_PROTOTYPES)
|
2022-08-22 22:21:23 +02:00
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
add_subdirectory(Common)
|
|
|
|
add_subdirectory(gui)
|
|
|
|
add_subdirectory(Cafe)
|
|
|
|
add_subdirectory(Cemu)
|
|
|
|
add_subdirectory(config)
|
|
|
|
add_subdirectory(input)
|
|
|
|
add_subdirectory(audio)
|
|
|
|
add_subdirectory(util)
|
|
|
|
add_subdirectory(imgui)
|
|
|
|
add_subdirectory(resource)
|
|
|
|
add_subdirectory(asm)
|
|
|
|
|
2022-09-24 08:43:27 +02:00
|
|
|
add_executable(CemuBin
|
|
|
|
main.cpp
|
|
|
|
mainLLE.cpp
|
|
|
|
)
|
2022-08-22 22:21:23 +02:00
|
|
|
|
2024-07-07 08:55:26 +02:00
|
|
|
if(MSVC AND MSVC_VERSION EQUAL 1940)
|
|
|
|
# workaround for an msvc issue on VS 17.10 where generated ILK files are too large
|
|
|
|
# see https://developercommunity.visualstudio.com/t/After-updating-to-VS-1710-the-size-of-/10665511
|
|
|
|
set_target_properties(CemuBin PROPERTIES LINK_FLAGS "/INCREMENTAL:NO")
|
|
|
|
endif()
|
|
|
|
|
2022-08-22 22:21:23 +02:00
|
|
|
if(WIN32)
|
2022-09-01 14:46:56 +02:00
|
|
|
target_sources(CemuBin PRIVATE
|
|
|
|
resource/cemu.rc
|
2023-09-28 10:02:12 +02:00
|
|
|
../dist/windows/cemu.manifest
|
|
|
|
)
|
2022-08-22 22:21:23 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set_property(TARGET CemuBin PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
2022-09-24 08:43:27 +02:00
|
|
|
set_property(TARGET CemuBin PROPERTY WIN32_EXECUTABLE $<NOT:$<CONFIG:Debug>>)
|
2022-10-23 16:58:28 +02:00
|
|
|
set(OUTPUT_NAME "Cemu_$<LOWER_CASE:$<CONFIG>>")
|
|
|
|
|
|
|
|
if (MACOS_BUNDLE)
|
|
|
|
set_property(TARGET CemuBin PROPERTY MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resource/MacOSXBundleInfo.plist.in")
|
|
|
|
|
|
|
|
set(RESOURCE_FILES "${CMAKE_SOURCE_DIR}/src/resource/cemu.icns")
|
|
|
|
target_sources(CemuBin PRIVATE "${RESOURCE_FILES}")
|
|
|
|
|
2022-10-28 16:57:14 +02:00
|
|
|
set(MACOSX_BUNDLE_ICON_FILE "cemu.icns")
|
|
|
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER "info.cemu.Cemu")
|
|
|
|
set(MACOSX_BUNDLE_BUNDLE_NAME "Cemu")
|
|
|
|
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${CMAKE_PROJECT_VERSION})
|
|
|
|
set(MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION})
|
2024-01-15 16:31:59 +01:00
|
|
|
set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2024 Cemu Project")
|
2022-10-28 16:57:14 +02:00
|
|
|
|
2022-10-23 16:58:28 +02:00
|
|
|
set(MACOSX_BUNDLE_CATEGORY "public.app-category.games")
|
2023-11-27 12:24:26 +01:00
|
|
|
set(MACOSX_MINIMUM_SYSTEM_VERSION "12.0")
|
2023-12-10 08:30:08 +01:00
|
|
|
set(MACOSX_BUNDLE_TYPE_EXTENSION "wua")
|
2022-10-23 16:58:28 +02:00
|
|
|
|
|
|
|
set_target_properties(CemuBin PROPERTIES
|
|
|
|
MACOSX_BUNDLE true
|
|
|
|
RESOURCE "${RESOURCE_FILES}"
|
|
|
|
)
|
|
|
|
|
|
|
|
set(FOLDERS gameProfiles resources)
|
|
|
|
foreach(folder ${FOLDERS})
|
|
|
|
add_custom_command (TARGET CemuBin POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory "${CMAKE_SOURCE_DIR}/bin/${folder}" "${CMAKE_SOURCE_DIR}/bin/${OUTPUT_NAME}.app/Contents/SharedSupport/${folder}")
|
|
|
|
endforeach(folder)
|
|
|
|
|
|
|
|
add_custom_command (TARGET CemuBin POST_BUILD
|
2024-01-16 02:46:56 +01:00
|
|
|
COMMAND ${CMAKE_COMMAND} ARGS -E copy "/usr/local/lib/libMoltenVK.dylib" "${CMAKE_SOURCE_DIR}/bin/${OUTPUT_NAME}.app/Contents/Frameworks/libMoltenVK.dylib"
|
|
|
|
COMMAND ${CMAKE_COMMAND} ARGS -E copy "${CMAKE_BINARY_DIR}/vcpkg_installed/x64-osx/lib/libusb-1.0.0.dylib" "${CMAKE_SOURCE_DIR}/bin/${OUTPUT_NAME}.app/Contents/Frameworks/libusb-1.0.0.dylib"
|
2024-05-05 01:34:36 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} ARGS -E copy "${CMAKE_SOURCE_DIR}/src/resource/update.sh" "${CMAKE_SOURCE_DIR}/bin/${OUTPUT_NAME}.app/Contents/MacOS/update.sh"
|
2024-01-16 02:46:56 +01:00
|
|
|
COMMAND bash -c "install_name_tool -add_rpath @executable_path/../Frameworks ${CMAKE_SOURCE_DIR}/bin/${OUTPUT_NAME}.app/Contents/MacOS/${OUTPUT_NAME}"
|
2024-05-25 01:48:17 +02:00
|
|
|
COMMAND bash -c "install_name_tool -change /Users/runner/work/Cemu/Cemu/build/vcpkg_installed/x64-osx/lib/libusb-1.0.0.dylib @executable_path/../Frameworks/libusb-1.0.0.dylib ${CMAKE_SOURCE_DIR}/bin/${OUTPUT_NAME}.app/Contents/MacOS/${OUTPUT_NAME}")
|
2022-10-23 16:58:28 +02:00
|
|
|
endif()
|
2022-08-22 22:21:23 +02:00
|
|
|
|
|
|
|
set_target_properties(CemuBin PROPERTIES
|
2022-09-04 22:23:24 +02:00
|
|
|
# multi-configuration generators will add a config subdirectory to RUNTIME_OUTPUT_DIRECTORY if no generator expression is used
|
|
|
|
# to get the same behavior everywhere we append an empty generator expression
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/$<1:>"
|
2022-10-23 16:58:28 +02:00
|
|
|
OUTPUT_NAME "${OUTPUT_NAME}"
|
2022-09-01 14:46:56 +02:00
|
|
|
)
|
2022-08-22 22:21:23 +02:00
|
|
|
|
2022-08-29 07:19:48 +02:00
|
|
|
target_link_libraries(CemuBin PRIVATE
|
|
|
|
CemuAudio
|
|
|
|
CemuCafe
|
|
|
|
CemuCommon
|
|
|
|
CemuComponents
|
|
|
|
CemuConfig
|
|
|
|
CemuGui
|
|
|
|
CemuInput
|
|
|
|
CemuUtil
|
2022-09-01 14:46:56 +02:00
|
|
|
OpenGL::GL
|
|
|
|
SDL2::SDL2
|
2022-08-29 07:19:48 +02:00
|
|
|
)
|
2022-08-22 22:21:23 +02:00
|
|
|
|
2022-11-13 17:23:48 +01:00
|
|
|
if(UNIX AND NOT APPLE)
|
2022-11-17 15:31:34 +01:00
|
|
|
# due to nasm output some linkers will make stack executable
|
|
|
|
# cemu does not require this so we explicity disable it
|
2022-11-13 17:23:48 +01:00
|
|
|
target_link_options(CemuBin PRIVATE -z noexecstack)
|
2022-11-17 15:31:34 +01:00
|
|
|
# some residual debug info from boost/discord-rpc is normally included
|
|
|
|
# most likely not helpful in debugging problems with cemu code
|
|
|
|
target_link_options(CemuBin PRIVATE "$<$<CONFIG:Release>:-Xlinker;--strip-debug>")
|
2022-11-13 17:23:48 +01:00
|
|
|
endif()
|
|
|
|
|
2022-08-29 07:19:48 +02:00
|
|
|
if (ENABLE_WXWIDGETS)
|
|
|
|
target_link_libraries(CemuBin PRIVATE wx::base wx::core)
|
|
|
|
endif()
|