CMakeLists.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
  2. function(create_resource file output filename)
  3. # Read hex data from file
  4. file(READ ${file} filedata HEX)
  5. # Convert hex data for C compatibility
  6. string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata})
  7. # Write data to output file
  8. set(RESOURCES_DIR "${PROJECT_BINARY_DIR}/dist" PARENT_SCOPE)
  9. file(WRITE "${PROJECT_BINARY_DIR}/dist/${output}" "const unsigned char ${filename}[] = {${filedata}};\nconst unsigned ${filename}_size = sizeof(${filename});\n")
  10. endfunction()
  11. add_executable(yuzu-cmd
  12. config.cpp
  13. config.h
  14. default_ini.h
  15. emu_window/emu_window_sdl2.cpp
  16. emu_window/emu_window_sdl2.h
  17. emu_window/emu_window_sdl2_gl.cpp
  18. emu_window/emu_window_sdl2_gl.h
  19. emu_window/emu_window_sdl2_vk.cpp
  20. emu_window/emu_window_sdl2_vk.h
  21. yuzu.cpp
  22. yuzu.rc
  23. )
  24. create_target_directory_groups(yuzu-cmd)
  25. target_link_libraries(yuzu-cmd PRIVATE common core input_common)
  26. target_link_libraries(yuzu-cmd PRIVATE inih glad)
  27. if (MSVC)
  28. target_link_libraries(yuzu-cmd PRIVATE getopt)
  29. endif()
  30. target_link_libraries(yuzu-cmd PRIVATE ${PLATFORM_LIBRARIES} SDL2 Threads::Threads)
  31. create_resource("../../dist/yuzu.bmp" "yuzu_cmd/yuzu_icon.h" "yuzu_icon")
  32. target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
  33. target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include)
  34. if(UNIX AND NOT APPLE)
  35. install(TARGETS yuzu-cmd RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
  36. endif()
  37. if (MSVC)
  38. include(CopyYuzuSDLDeps)
  39. copy_yuzu_SDL_deps(yuzu-cmd)
  40. endif()