|
1 | | -project("UnleashedRecomp") |
2 | | - |
3 | | -set(UNLEASHED_RECOMP_HOST_TOOLS_DIR "" CACHE PATH "Directory containing host-built recompilation tools.") |
4 | | - |
5 | | -function(unleashed_recomp_resolve_tool OUT_VAR TARGET_NAME RELATIVE_PATH) |
6 | | - if (UNLEASHED_RECOMP_HOST_TOOLS_DIR) |
7 | | - set(${OUT_VAR} "${UNLEASHED_RECOMP_HOST_TOOLS_DIR}/${RELATIVE_PATH}" PARENT_SCOPE) |
8 | | - elseif (TARGET ${TARGET_NAME}) |
9 | | - set(${OUT_VAR} "$<TARGET_FILE:${TARGET_NAME}>" PARENT_SCOPE) |
10 | | - else() |
11 | | - message(FATAL_ERROR "Tool ${TARGET_NAME} is not available. Set UNLEASHED_RECOMP_HOST_TOOLS_DIR.") |
12 | | - endif() |
13 | | -endfunction() |
14 | | - |
15 | | -unleashed_recomp_resolve_tool(UNLEASHED_RECOMP_FILE_TO_C_TOOL file_to_c "tools/file_to_c/file_to_c") |
| 1 | +project("UnleashedRecomp") |
| 2 | + |
| 3 | +set(UNLEASHED_RECOMP_HOST_TOOLS_DIR "" CACHE PATH "Directory containing host-built recompilation tools.") |
| 4 | + |
| 5 | +function(unleashed_recomp_resolve_tool OUT_VAR TARGET_NAME RELATIVE_PATH) |
| 6 | + if (UNLEASHED_RECOMP_HOST_TOOLS_DIR) |
| 7 | + set(${OUT_VAR} "${UNLEASHED_RECOMP_HOST_TOOLS_DIR}/${RELATIVE_PATH}" PARENT_SCOPE) |
| 8 | + elseif (TARGET ${TARGET_NAME}) |
| 9 | + set(${OUT_VAR} "$<TARGET_FILE:${TARGET_NAME}>" PARENT_SCOPE) |
| 10 | + else() |
| 11 | + message(FATAL_ERROR "Tool ${TARGET_NAME} is not available. Set UNLEASHED_RECOMP_HOST_TOOLS_DIR.") |
| 12 | + endif() |
| 13 | +endfunction() |
| 14 | + |
| 15 | +unleashed_recomp_resolve_tool(UNLEASHED_RECOMP_FILE_TO_C_TOOL file_to_c "tools/file_to_c/file_to_c") |
16 | 16 |
|
17 | 17 | if (WIN32) |
18 | 18 | option(UNLEASHED_RECOMP_D3D12 "Add D3D12 support for rendering" ON) |
@@ -41,8 +41,8 @@ function(BIN2C) |
41 | 41 | set(BIN2C_ARGS_COMPRESSION_TYPE "none") |
42 | 42 | endif() |
43 | 43 |
|
44 | | - add_custom_command(OUTPUT "${BIN2C_ARGS_DEST_FILE}.c" |
45 | | - COMMAND "${UNLEASHED_RECOMP_FILE_TO_C_TOOL}" "${BIN2C_ARGS_SOURCE_FILE}" "${BIN2C_ARGS_ARRAY_NAME}" "${BIN2C_ARGS_COMPRESSION_TYPE}" "${BIN2C_ARGS_DEST_FILE}.c" "${BIN2C_ARGS_DEST_FILE}.h" |
| 44 | + add_custom_command(OUTPUT "${BIN2C_ARGS_DEST_FILE}.c" |
| 45 | + COMMAND "${UNLEASHED_RECOMP_FILE_TO_C_TOOL}" "${BIN2C_ARGS_SOURCE_FILE}" "${BIN2C_ARGS_ARRAY_NAME}" "${BIN2C_ARGS_COMPRESSION_TYPE}" "${BIN2C_ARGS_DEST_FILE}.c" "${BIN2C_ARGS_DEST_FILE}.h" |
46 | 46 | DEPENDS "${BIN2C_ARGS_SOURCE_FILE}" |
47 | 47 | BYPRODUCTS "${BIN2C_ARGS_DEST_FILE}.h" |
48 | 48 | COMMENT "Generating binary header for ${BIN2C_ARGS_SOURCE_FILE}..." |
@@ -72,17 +72,17 @@ else() |
72 | 72 | add_compile_options(-ffp-model=strict) |
73 | 73 | endif() |
74 | 74 |
|
75 | | -set(UNLEASHED_RECOMP_COMPILE_DEFINITIONS |
76 | | - _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR # Microsoft wtf? |
77 | | - _CRT_SECURE_NO_WARNINGS) |
78 | | - |
79 | | -if (NOT CMAKE_SYSTEM_NAME STREQUAL "iOS") |
80 | | - list(APPEND UNLEASHED_RECOMP_COMPILE_DEFINITIONS SDL_MAIN_HANDLED) |
81 | | -else() |
82 | | - list(APPEND UNLEASHED_RECOMP_COMPILE_DEFINITIONS UNLEASHED_RECOMP_IOS) |
83 | | -endif() |
84 | | - |
85 | | -add_compile_definitions(${UNLEASHED_RECOMP_COMPILE_DEFINITIONS}) |
| 75 | +set(UNLEASHED_RECOMP_COMPILE_DEFINITIONS |
| 76 | + _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR # Microsoft wtf? |
| 77 | + _CRT_SECURE_NO_WARNINGS) |
| 78 | + |
| 79 | +if (NOT CMAKE_SYSTEM_NAME STREQUAL "iOS") |
| 80 | + list(APPEND UNLEASHED_RECOMP_COMPILE_DEFINITIONS SDL_MAIN_HANDLED) |
| 81 | +else() |
| 82 | + list(APPEND UNLEASHED_RECOMP_COMPILE_DEFINITIONS UNLEASHED_RECOMP_IOS) |
| 83 | +endif() |
| 84 | + |
| 85 | +add_compile_definitions(${UNLEASHED_RECOMP_COMPILE_DEFINITIONS}) |
86 | 86 |
|
87 | 87 | set(UNLEASHED_RECOMP_PRECOMPILED_HEADERS |
88 | 88 | "stdafx.h" |
@@ -118,18 +118,18 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Linux") |
118 | 118 | "os/linux/user_linux.cpp" |
119 | 119 | "os/linux/version_linux.cpp" |
120 | 120 | ) |
121 | | -elseif (CMAKE_SYSTEM_NAME STREQUAL "iOS") |
122 | | - set(UNLEASHED_RECOMP_OS_CXX_SOURCES |
123 | | - "os/ios/logger_ios.cpp" |
124 | | - "os/ios/media_ios.cpp" |
125 | | - "os/ios/process_ios.mm" |
126 | | - "os/ios/user_ios.mm" |
127 | | - "os/ios/version_ios.mm" |
128 | | - ) |
129 | | -elseif (APPLE) |
130 | | - set(UNLEASHED_RECOMP_OS_CXX_SOURCES |
131 | | - "os/macos/logger_macos.cpp" |
132 | | - "os/macos/media_macos.cpp" |
| 121 | +elseif (CMAKE_SYSTEM_NAME STREQUAL "iOS") |
| 122 | + set(UNLEASHED_RECOMP_OS_CXX_SOURCES |
| 123 | + "os/ios/logger_ios.cpp" |
| 124 | + "os/ios/media_ios.cpp" |
| 125 | + "os/ios/process_ios.mm" |
| 126 | + "os/ios/user_ios.mm" |
| 127 | + "os/ios/version_ios.mm" |
| 128 | + ) |
| 129 | +elseif (APPLE) |
| 130 | + set(UNLEASHED_RECOMP_OS_CXX_SOURCES |
| 131 | + "os/macos/logger_macos.cpp" |
| 132 | + "os/macos/media_macos.cpp" |
133 | 133 | "os/macos/process_macos.cpp" |
134 | 134 | "os/macos/user_macos.cpp" |
135 | 135 | "os/macos/version_macos.cpp" |
@@ -185,10 +185,12 @@ set(UNLEASHED_RECOMP_UI_CXX_SOURCES |
185 | 185 | "ui/fader.cpp" |
186 | 186 | "ui/game_window.cpp" |
187 | 187 | "ui/imgui_utils.cpp" |
| 188 | + "ui/input_coords.cpp" |
188 | 189 | "ui/installer_wizard.cpp" |
189 | 190 | "ui/message_window.cpp" |
190 | 191 | "ui/options_menu.cpp" |
191 | 192 | "ui/options_menu_thumbnails.cpp" |
| 193 | + "ui/touch_controls.cpp" |
192 | 194 | "ui/tv_static.cpp" |
193 | 195 | ) |
194 | 196 |
|
@@ -321,49 +323,49 @@ if (WIN32) |
321 | 323 | if (${CMAKE_BUILD_TYPE} MATCHES "Release") |
322 | 324 | target_link_options(UnleashedRecomp PRIVATE "/SUBSYSTEM:WINDOWS" "/ENTRY:mainCRTStartup") |
323 | 325 | endif() |
324 | | -elseif (CMAKE_SYSTEM_NAME STREQUAL "iOS") |
325 | | - CreateVersionString( |
326 | | - VERSION_TXT ${VERSION_TXT} |
327 | | - OUTPUT_VAR IOS_BUNDLE_VERSION |
328 | | - ) |
329 | | - string(REGEX REPLACE "^v" "" IOS_BUNDLE_VERSION "${IOS_BUNDLE_VERSION}") |
330 | | - |
331 | | - set(UNLEASHED_RECOMP_IOS_ICON_FILES |
332 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon20x20@2x.png" |
333 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon20x20@3x.png" |
334 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon29x29@2x.png" |
335 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon29x29@3x.png" |
336 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon40x40@2x.png" |
337 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon40x40@3x.png" |
338 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon60x60@2x.png" |
339 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon60x60@3x.png" |
340 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon76x76.png" |
341 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon76x76@2x.png" |
342 | | - "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon83.5x83.5@2x.png" |
343 | | - ) |
344 | | - |
345 | | - add_executable(UnleashedRecomp MACOSX_BUNDLE |
346 | | - ${UNLEASHED_RECOMP_CXX_SOURCES} |
347 | | - ) |
348 | | - set_target_properties(UnleashedRecomp PROPERTIES |
349 | | - OUTPUT_NAME "Unleashed Recompiled" |
350 | | - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/res/ios/Info.plist.in |
351 | | - MACOSX_BUNDLE_GUI_IDENTIFIER hedge-dev.UnleashedRecomp |
352 | | - MACOSX_BUNDLE_BUNDLE_NAME "Unleashed Recompiled" |
353 | | - MACOSX_BUNDLE_BUNDLE_VERSION ${IOS_BUNDLE_VERSION} |
354 | | - MACOSX_BUNDLE_SHORT_VERSION_STRING ${IOS_BUNDLE_VERSION} |
355 | | - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "hedge-dev.UnleashedRecomp" |
356 | | - XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" |
357 | | - XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" |
358 | | - ) |
359 | | - foreach(UNLEASHED_RECOMP_IOS_ICON_FILE IN LISTS UNLEASHED_RECOMP_IOS_ICON_FILES) |
360 | | - add_custom_command(TARGET UnleashedRecomp POST_BUILD |
361 | | - COMMAND ${CMAKE_COMMAND} -E copy_if_different |
362 | | - "${UNLEASHED_RECOMP_IOS_ICON_FILE}" |
363 | | - "$<TARGET_BUNDLE_DIR:UnleashedRecomp>" |
364 | | - ) |
365 | | - endforeach() |
366 | | -elseif (APPLE) |
| 326 | +elseif (CMAKE_SYSTEM_NAME STREQUAL "iOS") |
| 327 | + CreateVersionString( |
| 328 | + VERSION_TXT ${VERSION_TXT} |
| 329 | + OUTPUT_VAR IOS_BUNDLE_VERSION |
| 330 | + ) |
| 331 | + string(REGEX REPLACE "^v" "" IOS_BUNDLE_VERSION "${IOS_BUNDLE_VERSION}") |
| 332 | + |
| 333 | + set(UNLEASHED_RECOMP_IOS_ICON_FILES |
| 334 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon20x20@2x.png" |
| 335 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon20x20@3x.png" |
| 336 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon29x29@2x.png" |
| 337 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon29x29@3x.png" |
| 338 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon40x40@2x.png" |
| 339 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon40x40@3x.png" |
| 340 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon60x60@2x.png" |
| 341 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon60x60@3x.png" |
| 342 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon76x76.png" |
| 343 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon76x76@2x.png" |
| 344 | + "${CMAKE_CURRENT_SOURCE_DIR}/res/ios/icons/AppIcon83.5x83.5@2x.png" |
| 345 | + ) |
| 346 | + |
| 347 | + add_executable(UnleashedRecomp MACOSX_BUNDLE |
| 348 | + ${UNLEASHED_RECOMP_CXX_SOURCES} |
| 349 | + ) |
| 350 | + set_target_properties(UnleashedRecomp PROPERTIES |
| 351 | + OUTPUT_NAME "Unleashed Recompiled" |
| 352 | + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/res/ios/Info.plist.in |
| 353 | + MACOSX_BUNDLE_GUI_IDENTIFIER hedge-dev.UnleashedRecomp |
| 354 | + MACOSX_BUNDLE_BUNDLE_NAME "Unleashed Recompiled" |
| 355 | + MACOSX_BUNDLE_BUNDLE_VERSION ${IOS_BUNDLE_VERSION} |
| 356 | + MACOSX_BUNDLE_SHORT_VERSION_STRING ${IOS_BUNDLE_VERSION} |
| 357 | + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "hedge-dev.UnleashedRecomp" |
| 358 | + XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" |
| 359 | + XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" |
| 360 | + ) |
| 361 | + foreach(UNLEASHED_RECOMP_IOS_ICON_FILE IN LISTS UNLEASHED_RECOMP_IOS_ICON_FILES) |
| 362 | + add_custom_command(TARGET UnleashedRecomp POST_BUILD |
| 363 | + COMMAND ${CMAKE_COMMAND} -E copy_if_different |
| 364 | + "${UNLEASHED_RECOMP_IOS_ICON_FILE}" |
| 365 | + "$<TARGET_BUNDLE_DIR:UnleashedRecomp>" |
| 366 | + ) |
| 367 | + endforeach() |
| 368 | +elseif (APPLE) |
367 | 369 | # Create version number for app bundle. |
368 | 370 | CreateVersionString( |
369 | 371 | VERSION_TXT ${VERSION_TXT} |
@@ -458,33 +460,36 @@ if (WIN32) |
458 | 460 | ) |
459 | 461 | endif() |
460 | 462 |
|
461 | | -set(UNLEASHED_RECOMP_SDL_LIBS SDL2::SDL2-static) |
462 | | -if (CMAKE_SYSTEM_NAME STREQUAL "iOS" AND TARGET SDL2::SDL2main) |
463 | | - list(PREPEND UNLEASHED_RECOMP_SDL_LIBS SDL2::SDL2main) |
464 | | -endif() |
465 | | - |
466 | | -set(UNLEASHED_RECOMP_PLATFORM_LIBS) |
467 | | -if (CMAKE_SYSTEM_NAME STREQUAL "iOS") |
468 | | - list(APPEND UNLEASHED_RECOMP_PLATFORM_LIBS MoltenVK) |
469 | | - target_link_options(UnleashedRecomp PRIVATE "LINKER:-u,_vkGetInstanceProcAddr") |
470 | | -endif() |
471 | | - |
472 | | -target_link_libraries(UnleashedRecomp PRIVATE |
473 | | - fmt::fmt |
474 | | - libzstd_static |
475 | | - msdf-atlas-gen::msdf-atlas-gen |
| 463 | +set(UNLEASHED_RECOMP_SDL_LIBS SDL2::SDL2-static) |
| 464 | +if (CMAKE_SYSTEM_NAME STREQUAL "iOS" AND TARGET SDL2::SDL2main) |
| 465 | + list(PREPEND UNLEASHED_RECOMP_SDL_LIBS SDL2::SDL2main) |
| 466 | +endif() |
| 467 | + |
| 468 | +set(UNLEASHED_RECOMP_PLATFORM_LIBS) |
| 469 | +if (CMAKE_SYSTEM_NAME STREQUAL "iOS") |
| 470 | + list(APPEND UNLEASHED_RECOMP_PLATFORM_LIBS MoltenVK) |
| 471 | + target_link_options(UnleashedRecomp PRIVATE |
| 472 | + "LINKER:-u,_vkGetInstanceProcAddr" |
| 473 | + "LINKER:-ObjC" |
| 474 | + ) |
| 475 | +endif() |
| 476 | + |
| 477 | +target_link_libraries(UnleashedRecomp PRIVATE |
| 478 | + fmt::fmt |
| 479 | + libzstd_static |
| 480 | + msdf-atlas-gen::msdf-atlas-gen |
476 | 481 | nfd::nfd |
477 | | - o1heap |
478 | | - XenonUtils |
479 | | - ${UNLEASHED_RECOMP_SDL_LIBS} |
480 | | - SDL2_mixer |
| 482 | + o1heap |
| 483 | + XenonUtils |
| 484 | + ${UNLEASHED_RECOMP_SDL_LIBS} |
| 485 | + SDL2_mixer |
481 | 486 | tomlplusplus::tomlplusplus |
482 | | - UnleashedRecompLib |
483 | | - xxHash::xxhash |
484 | | - CURL::libcurl |
485 | | - plume |
486 | | - ${UNLEASHED_RECOMP_PLATFORM_LIBS} |
487 | | -) |
| 487 | + UnleashedRecompLib |
| 488 | + xxHash::xxhash |
| 489 | + CURL::libcurl |
| 490 | + plume |
| 491 | + ${UNLEASHED_RECOMP_PLATFORM_LIBS} |
| 492 | +) |
488 | 493 |
|
489 | 494 | target_include_directories(UnleashedRecomp PRIVATE |
490 | 495 | ${CMAKE_CURRENT_SOURCE_DIR} |
|
0 commit comments