38 lines
1.0 KiB
CMake
38 lines
1.0 KiB
CMake
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)
|
|
|
|
# Detectar la plataforma y ajustar configuraciones específicas
|
|
if(WIN32)
|
|
set(PLATFORM windows)
|
|
set(EXE_EXT ".exe")
|
|
set(EXTRA_LIBS mingw32 ws2_32)
|
|
elseif(UNIX AND NOT APPLE)
|
|
set(PLATFORM linux)
|
|
set(EXE_EXT ".out")
|
|
set(EXTRA_LIBS "")
|
|
elseif(APPLE)
|
|
set(PLATFORM macos)
|
|
set(EXE_EXT ".out")
|
|
set(EXTRA_LIBS "")
|
|
endif()
|
|
|
|
# Añadir el ejecutable
|
|
add_executable(${EXECUTABLE}${EXE_EXT} ${SOURCE})
|
|
|
|
# Enlazar las bibliotecas específicas y SDL3
|
|
target_link_libraries(${EXECUTABLE}${EXE_EXT} ${EXTRA_LIBS} SDL3::SDL3)
|
|
|
|
# Colocar el ejecutable en la raíz del proyecto
|
|
set_target_properties(${EXECUTABLE}${EXE_EXT} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
|