primer commit

This commit is contained in:
2025-03-23 19:06:25 +01:00
commit ca305d70ea
5 changed files with 176 additions and 0 deletions

39
CMakeLists.txt Normal file
View File

@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.20)
project(demo2_pixels_noise)
# 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 demo2_pixels_noise.cpp)
set(EXECUTABLE demo2_pixels_noise)
# 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})