actualitzat a SDL3

This commit is contained in:
2025-03-23 18:51:10 +01:00
parent ff807ea1e1
commit a7cce0af28
4 changed files with 159 additions and 0 deletions

39
CMakeLists.txt Normal file
View File

@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.20)
project(demo1_pixels_wave)
# Establecer el estándar de C++
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Definir las fuentes y el ejecutable
set(SOURCE demo1_pixels_wave.cpp)
set(EXECUTABLE demo1_pixels_wave)
# Buscar SDL3 automáticamente
find_package(SDL3 REQUIRED)
include_directories(${SDL3_INCLUDE_DIRS})
link_directories(${SDL3_LIBRARY_DIRS})
# Detectar la plataforma y ajustar configuraciones específicas
if(WIN32)
set(PLATFORM windows)
set(LDFLAGS "-lmingw32 -lws2_32 ${SDL3_LIBRARIES}")
set(EXE_EXT ".exe")
elseif(UNIX AND NOT APPLE)
set(PLATFORM linux)
set(EXE_EXT ".out")
set(LDFLAGS "${SDL3_LIBRARIES}")
elseif(APPLE)
set(PLATFORM macos)
set(EXE_EXT ".out")
set(LDFLAGS "${SDL3_LIBRARIES}")
endif()
# Añadir el ejecutable
add_executable(${EXECUTABLE}${EXE_EXT} ${SOURCE})
# Enlazar las bibliotecas
target_link_libraries(${EXECUTABLE}${EXE_EXT} ${LDFLAGS})
# Colocar el ejecutable en la raíz del proyecto
set_target_properties(${EXECUTABLE}${EXE_EXT} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})