Cemu/src/CMakeLists.txt

128 lines
3.8 KiB
CMake
Raw Normal View History

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)
add_compile_options(${CEMU_CXX_FLAGS})
2022-08-22 22:21:23 +02:00
endif()
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)
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)
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()
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()
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)
add_executable(CemuBin
main.cpp
mainLLE.cpp
)
2022-08-22 22:21:23 +02:00
if(WIN32)
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>")
set_property(TARGET CemuBin PROPERTY WIN32_EXECUTABLE $<NOT:$<CONFIG:Debug>>)
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}")
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")
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
# 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:>"
OUTPUT_NAME "${OUTPUT_NAME}"
)
2022-08-22 22:21:23 +02:00
target_link_libraries(CemuBin PRIVATE
CemuAudio
CemuCafe
CemuCommon
CemuComponents
CemuConfig
CemuGui
CemuInput
CemuUtil
OpenGL::GL
SDL2::SDL2
)
2022-08-22 22:21:23 +02:00
if (ENABLE_WXWIDGETS)
target_link_libraries(CemuBin PRIVATE wx::base wx::core)
endif()