2021-06-14 14:22:15 -04:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
2018-04-26 13:10:03 -04:00
|
|
|
|
|
|
|
# macOS deployment target needs to be set before 'project' to work
|
|
|
|
if(APPLE AND NOT TARGET_IOS)
|
2021-04-27 23:40:01 +01:00
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14" CACHE STRING "Minimum OS X deployment version")
|
2018-04-26 13:10:03 -04:00
|
|
|
endif()
|
|
|
|
|
2018-04-25 20:45:06 -04:00
|
|
|
project(Play)
|
2018-01-10 22:14:14 +00:00
|
|
|
|
2021-11-29 12:29:21 -08:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2018-01-10 22:21:53 +00:00
|
|
|
set(CMAKE_MODULE_PATH
|
2019-07-01 13:16:58 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/deps/Dependencies/cmake-modules
|
2018-01-10 22:21:53 +00:00
|
|
|
${CMAKE_MODULE_PATH}
|
|
|
|
)
|
|
|
|
include(Header)
|
2018-01-10 22:14:14 +00:00
|
|
|
|
2018-01-11 04:37:19 +00:00
|
|
|
set(BUILD_PLAY ON CACHE BOOL "Build Play! Emulator")
|
2018-04-08 16:23:30 -04:00
|
|
|
set(BUILD_PSFPLAYER OFF CACHE BOOL "Build PsfPlayer")
|
2018-01-11 15:16:40 +00:00
|
|
|
set(BUILD_TESTS ON CACHE BOOL "Build Tests")
|
2018-04-08 16:23:30 -04:00
|
|
|
set(USE_AOT_CACHE OFF CACHE BOOL "Use AOT block cache")
|
2019-05-01 20:20:16 -04:00
|
|
|
set(BUILD_AOT_CACHE OFF CACHE BOOL "Build AOT block cache (for PsfPlayer only)")
|
2019-12-31 21:02:35 +01:00
|
|
|
set(BUILD_LIBRETRO_CORE OFF CACHE BOOL "Build Libretro Core")
|
2018-01-11 04:37:19 +00:00
|
|
|
|
2018-01-10 22:14:14 +00:00
|
|
|
set(PROJECT_NAME "Play!")
|
|
|
|
set(PROJECT_Version 0.30)
|
2019-03-27 19:15:46 -04:00
|
|
|
|
2020-03-11 09:37:43 -04:00
|
|
|
if(BUILD_TESTS)
|
|
|
|
enable_testing()
|
|
|
|
endif()
|
|
|
|
|
2021-11-29 11:00:50 -08:00
|
|
|
find_package(Git)
|
|
|
|
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/")
|
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
RESULT_VARIABLE GIT_DESCRIBE_RESULT
|
|
|
|
OUTPUT_VARIABLE GIT_TAG
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
if(GIT_DESCRIBE_RESULT EQUAL 0)
|
|
|
|
message("Building for ${GIT_TAG}.")
|
|
|
|
set(PROJECT_Version ${GIT_TAG})
|
|
|
|
else()
|
|
|
|
message("Warning: Failed to obtain Git tag.")
|
|
|
|
endif()
|
2019-03-27 19:15:46 -04:00
|
|
|
else()
|
2021-11-29 11:00:50 -08:00
|
|
|
message("Warning: Not a git repo or git not found.")
|
2019-03-27 19:15:46 -04:00
|
|
|
endif()
|
|
|
|
|
2018-01-10 22:14:14 +00:00
|
|
|
add_definitions(-DPLAY_VERSION="${PROJECT_Version}")
|
|
|
|
set(PROJECT_LIBS)
|
|
|
|
|
|
|
|
include(PrecompiledHeader)
|
|
|
|
|
2019-06-25 19:18:20 +01:00
|
|
|
if(BUILD_LIBRETRO_CORE)
|
|
|
|
if(NOT MSVC)
|
2021-06-12 19:55:39 -04:00
|
|
|
add_compile_options($<$<NOT:$<COMPILE_LANGUAGE:Swift>>:-fPIC>)
|
2019-06-25 19:18:20 +01:00
|
|
|
endif()
|
|
|
|
add_subdirectory(Source/ui_libretro)
|
|
|
|
endif()
|
|
|
|
|
2018-01-11 04:37:19 +00:00
|
|
|
if(BUILD_PLAY)
|
2019-06-05 19:22:40 -04:00
|
|
|
if(TARGET_PLATFORM_UNIX OR TARGET_PLATFORM_MACOS OR TARGET_PLATFORM_WIN32 OR USE_QT)
|
2018-12-04 17:35:29 -05:00
|
|
|
add_subdirectory(Source/ui_qt/)
|
2022-03-16 16:53:43 -04:00
|
|
|
add_subdirectory(tools/ElfView)
|
2019-06-05 19:22:40 -04:00
|
|
|
endif(TARGET_PLATFORM_UNIX OR TARGET_PLATFORM_MACOS OR TARGET_PLATFORM_WIN32 OR USE_QT)
|
2018-01-11 04:37:19 +00:00
|
|
|
|
2018-05-23 03:11:24 +03:00
|
|
|
if(NOT USE_QT)
|
|
|
|
if(TARGET_PLATFORM_IOS)
|
|
|
|
add_subdirectory(Source/ui_ios/)
|
|
|
|
endif(TARGET_PLATFORM_IOS)
|
2018-01-10 22:14:14 +00:00
|
|
|
|
2018-05-23 03:11:24 +03:00
|
|
|
if(TARGET_PLATFORM_ANDROID)
|
|
|
|
add_subdirectory(Source/ui_android/)
|
|
|
|
endif(TARGET_PLATFORM_ANDROID)
|
2021-11-27 10:18:48 -05:00
|
|
|
|
|
|
|
if(TARGET_PLATFORM_JS)
|
|
|
|
add_subdirectory(Source/ui_js)
|
|
|
|
endif(TARGET_PLATFORM_JS)
|
2018-05-23 03:11:24 +03:00
|
|
|
endif()
|
2018-01-11 04:37:19 +00:00
|
|
|
endif(BUILD_PLAY)
|
2018-01-10 22:14:14 +00:00
|
|
|
|
2018-01-11 15:16:40 +00:00
|
|
|
if(BUILD_TESTS)
|
|
|
|
add_subdirectory(tools/AutoTest/)
|
2020-04-29 13:30:00 -04:00
|
|
|
add_subdirectory(tools/GsAreaTest/)
|
2018-01-11 15:16:40 +00:00
|
|
|
add_subdirectory(tools/McServTest/)
|
2020-12-28 20:54:11 -05:00
|
|
|
add_subdirectory(tools/SpuTest/)
|
2018-01-11 15:16:40 +00:00
|
|
|
add_subdirectory(tools/VuTest/)
|
|
|
|
endif()
|
2018-01-12 02:12:00 +00:00
|
|
|
|
2018-01-11 04:37:19 +00:00
|
|
|
if(BUILD_PSFPLAYER)
|
|
|
|
add_subdirectory(tools/PsfPlayer)
|
|
|
|
endif(BUILD_PSFPLAYER)
|