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)
|
|
|
|
#add_compile_definitions(VK_USE_PLATFORM_WIN32_KHR)
|
|
|
|
# _CRT_SECURE_NO_WARNINGS
|
|
|
|
# _WINSOCK_DEPRECATED_NO_WARNINGS
|
|
|
|
# _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING
|
|
|
|
# _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
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
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
add_compile_options(-maes)
|
|
|
|
# warnings
|
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
|
|
add_compile_options(-Wno-ambiguous-reversed-operator)
|
|
|
|
endif()
|
2022-11-09 07:17:50 +01:00
|
|
|
# most linux environments should enable pie by default, but make sure just in case.
|
|
|
|
# the same cannot be said for no executable stack which some linkers
|
|
|
|
# and configurations thereof might enable due to the assembly in the project
|
|
|
|
if(NOT APPLE)
|
|
|
|
add_compile_options(-fpie)
|
|
|
|
add_link_options(-pie -z noexecstack)
|
|
|
|
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
|
|
|
|
|
|
|
if(WIN32)
|
2022-09-01 14:46:56 +02:00
|
|
|
target_sources(CemuBin PRIVATE
|
|
|
|
resource/cemu.rc
|
|
|
|
)
|
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})
|
|
|
|
set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2022 Cemu Project")
|
|
|
|
|
2022-10-23 16:58:28 +02:00
|
|
|
set(MACOSX_BUNDLE_CATEGORY "public.app-category.games")
|
|
|
|
|
|
|
|
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
|
|
|
|
COMMAND ${CMAKE_COMMAND} ARGS -E copy "/usr/local/lib/libMoltenVK.dylib" "${CMAKE_SOURCE_DIR}/bin/${OUTPUT_NAME}.app/Contents/Frameworks/libMoltenVK.dylib")
|
|
|
|
|
|
|
|
add_custom_command (TARGET CemuBin POST_BUILD
|
|
|
|
COMMAND bash -c "install_name_tool -add_rpath @executable_path/../Frameworks ${CMAKE_SOURCE_DIR}/bin/${OUTPUT_NAME}.app/Contents/MacOS/${OUTPUT_NAME}")
|
|
|
|
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-08-29 07:19:48 +02:00
|
|
|
if (ENABLE_WXWIDGETS)
|
|
|
|
target_link_libraries(CemuBin PRIVATE wx::base wx::core)
|
|
|
|
endif()
|