2023-09-03 16:47:33 +00:00
cmake_minimum_required ( VERSION 3.19 )
2023-03-06 19:19:45 +00:00
2023-09-03 16:47:33 +00:00
cmake_policy ( VERSION 3.19 )
2024-01-08 13:03:41 +00:00
message ( STATUS "Using CMake ${CMAKE_VERSION} from ${CMAKE_COMMAND}" )
2023-06-24 19:58:45 +00:00
if ( CMAKE_MESSAGE_LOG_LEVEL )
message ( STATUS "Message log level is set to ${CMAKE_MESSAGE_LOG_LEVEL}" )
endif ( )
2023-03-06 19:19:45 +00:00
2023-11-06 15:46:57 +00:00
# Parse the latest version from CHANGELOG.md, so we don't have to specify it in multiple places.
file ( STRINGS "CHANGELOG.md" CHANGELOG REGEX "^## \\[([0-9]+\\.[0-9]+\\.[0-9]+)\\].+" )
list ( TRANSFORM CHANGELOG REPLACE "^## \\[([0-9]+\\.[0-9]+\\.[0-9]+)\\].+" "\\1" )
list ( SORT CHANGELOG COMPARE NATURAL ORDER DESCENDING )
list ( GET CHANGELOG 0 VERSION )
2023-11-06 16:15:38 +00:00
message ( STATUS "Project version is ${VERSION}" )
2023-11-06 15:46:57 +00:00
2023-11-03 17:35:11 +00:00
project ( "melonDS DS"
2023-11-06 15:46:57 +00:00
V E R S I O N " $ { V E R S I O N } "
2023-11-03 17:35:11 +00:00
D E S C R I P T I O N " A r e m a k e o f t h e l i b r e t r o m e l o n D S c o r e t h a t p r i o r i t i z e s s t a n d a l o n e p a r i t y , r e l i a b i l i t y , a n d u s a b i l i t y . T h i s c o r e c l o s e l y f o l l o w s t h e f e a t u r e s e t o f s t a n d a l o n e m e l o n D S ; i t f e a t u r e s O p e n G L - a c c e l e r a t e d u p s c a l i n g , m u l t i p l e s c r e e n l a y o u t s , a n d W i - F i e m u l a t i o n . "
2023-03-06 19:19:45 +00:00
H O M E P A G E _ U R L " h t t p s : / / m e l o n d s . k u r i b o 6 4 . n e t "
L A N G U A G E S C C X X )
2024-01-12 18:25:26 +00:00
message ( STATUS "Configuring a ${CMAKE_BUILD_TYPE} build." )
2023-11-03 17:35:11 +00:00
2023-08-06 16:03:22 +00:00
set ( CMAKE_POSITION_INDEPENDENT_CODE TRUE )
2023-06-24 01:07:45 +00:00
include ( CheckSymbolExists )
2023-06-24 16:50:00 +00:00
include ( CheckIncludeFile )
include ( CheckIncludeFiles )
2023-08-06 19:30:17 +00:00
include ( CheckTypeSize )
2023-03-06 19:19:45 +00:00
include ( FetchContent )
2023-07-10 18:44:24 +00:00
set ( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}" )
2023-03-06 19:19:45 +00:00
2023-08-06 16:02:24 +00:00
find_package ( Git REQUIRED )
2023-09-03 16:47:23 +00:00
include ( GitInfo )
2024-01-12 18:05:01 +00:00
message ( STATUS "GIT_REVISION: ${GIT_REVISION}" )
message ( STATUS "GIT_STATE: ${GIT_STATE}" )
message ( STATUS "GIT_BRANCH: ${GIT_BRANCH}" )
2023-07-19 21:27:34 +00:00
option ( TRACY_ENABLE "Build with Tracy support." OFF )
2023-11-02 15:27:12 +00:00
if ( IOS )
message ( STATUS "JIT is disabled by default in iOS builds." )
set ( DEFAULT_ENABLE_JIT OFF )
else ( )
set ( DEFAULT_ENABLE_JIT ON )
endif ( )
option ( ENABLE_JIT "Enable JIT support. Not supported on all platforms." ${ DEFAULT_ENABLE_JIT } )
if ( ANDROID OR IOS OR APPLE )
message ( STATUS "OpenGL is disabled by default on this platform." )
set ( DEFAULT_ENABLE_OPENGL OFF )
else ( )
set ( DEFAULT_ENABLE_OPENGL ON )
endif ( )
if ( ANDROID )
set ( DEFAULT_OPENGL_PROFILE OpenGLES2 )
else ( )
set ( DEFAULT_OPENGL_PROFILE OpenGL )
endif ( )
option ( ENABLE_OPENGL "Enable OpenGL support. Not supported on all platforms; defaults to OFF in such case." ${ DEFAULT_ENABLE_OPENGL } )
set ( ENABLE_OGLRENDERER ${ ENABLE_OPENGL } )
set ( OPENGL_PROFILE ${ DEFAULT_OPENGL_PROFILE } CACHE STRING "OpenGL profile to use if OpenGL is enabled. Valid values are 'OpenGL', 'OpenGLES2', 'OpenGLES3', 'OpenGLES31', and 'OpenGLES32'." )
set_property ( CACHE OPENGL_PROFILE PROPERTY STRINGS OpenGL OpenGLES2 OpenGLES3 )
2024-01-30 19:46:03 +00:00
if ( ENABLE_OPENGL AND ( NOT OPENGL_PROFILE STREQUAL "OpenGL" ) )
message ( FATAL_ERROR "melonDS does not support OpenGL ES yet" )
2024-01-30 03:03:03 +00:00
endif ( )
2024-01-12 15:24:59 +00:00
if ( ANDROID )
if ( NOT ANDROID_PLATFORM )
set ( ANDROID_PLATFORM "android-24" )
endif ( )
message ( STATUS "Targeting Android platform ${ANDROID_PLATFORM}" )
endif ( )
2023-06-24 19:07:15 +00:00
include ( cmake/utils.cmake )
2023-07-10 18:44:24 +00:00
include ( cmake/FetchDependencies.cmake )
include ( cmake/ConfigureFeatures.cmake )
2023-07-10 17:24:08 +00:00
include ( cmake/ConfigureDependencies.cmake )
2023-03-06 22:45:53 +00:00
2024-01-12 18:25:26 +00:00
set ( MELONDSDS_NAME "${CMAKE_PROJECT_NAME}" )
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Release" )
set ( MELONDSDS_VERSION "${CMAKE_PROJECT_VERSION}" )
else ( )
if ( GIT_STATE )
set ( MELONDSDS_VERSION "${GIT_STATE}-${CMAKE_BUILD_TYPE}-upstream-${MELONDS_REPOSITORY_TAG}" )
else ( )
set ( MELONDSDS_VERSION "v${CMAKE_PROJECT_VERSION}-nogit-${CMAKE_BUILD_TYPE}-upstream-${MELONDS_REPOSITORY_TAG}" )
endif ( )
2023-12-13 14:35:00 +00:00
endif ( )
2023-11-02 13:41:34 +00:00
2024-01-12 18:25:26 +00:00
message ( STATUS "${MELONDSDS_NAME} version string: '${MELONDSDS_VERSION}'" )
configure_file ( "${CMAKE_SOURCE_DIR}/melondsds_libretro.info.in" "${CMAKE_CURRENT_BINARY_DIR}/melondsds_libretro.info" )
2023-11-01 13:29:52 +00:00
2024-01-08 00:24:59 +00:00
# Formerly off by default due to a bug that has since been fixed.
# This option may be removed in the future.
option ( ENABLE_THREADED_RENDERER "Enable the threaded software renderer." ON )
2023-09-03 16:40:36 +00:00
option ( BUILD_TESTING "Build test suite." OFF )
include ( CTest )
2023-06-24 19:07:15 +00:00
add_subdirectory ( src/libretro )
2023-10-13 18:27:33 +00:00
include ( cmake/GenerateAttributions.cmake )
2023-11-02 14:02:35 +00:00
2023-09-03 16:40:36 +00:00
if ( BUILD_TESTING )
message ( STATUS "Enabling test suite." )
enable_testing ( )
add_subdirectory ( test )
endif ( )
2023-06-24 19:07:15 +00:00
2024-01-30 03:03:03 +00:00
dump_cmake_variables ( )