afegida carpeta "external" al source i moguts ahi els .cpp que no son meus
This commit is contained in:
110
CMakeLists.txt
110
CMakeLists.txt
@@ -1,30 +1,105 @@
|
||||
# CMakeLists.txt
|
||||
# CMakeLists.txt (Versión corregida y mejorada)
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(coffee_crisis_arcade_edition VERSION 2.00)
|
||||
|
||||
# Establece las políticas
|
||||
cmake_policy(SET CMP0072 NEW)
|
||||
|
||||
# Establecer estándar de C++
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# Cargar todos los archivos fuente directamente desde el directorio
|
||||
file(GLOB SOURCES "${CMAKE_SOURCE_DIR}/source/*.cpp")
|
||||
# --- 1. LISTA EXPLÍCITA DE FUENTES ---
|
||||
set(APP_SOURCES
|
||||
# --- Archivos Principales del Sistema ---
|
||||
source/main.cpp
|
||||
source/game.cpp
|
||||
source/director.cpp
|
||||
source/section.cpp
|
||||
source/screen.cpp
|
||||
source/resource.cpp
|
||||
source/asset.cpp
|
||||
source/audio.cpp
|
||||
source/input.cpp
|
||||
source/options.cpp
|
||||
source/lang.cpp
|
||||
source/param.cpp
|
||||
source/utils.cpp
|
||||
source/global_events.cpp
|
||||
source/global_inputs.cpp
|
||||
|
||||
# --- UI (User Interface) ---
|
||||
source/ui/service_menu.cpp
|
||||
source/ui/menu_renderer.cpp
|
||||
source/ui/ui_message.cpp
|
||||
|
||||
# Verificar si se encontraron archivos fuente
|
||||
if(NOT SOURCES)
|
||||
message(FATAL_ERROR "No se encontraron archivos fuente en ${CMAKE_SOURCE_DIR}/source. Verifica que el directorio existe y contiene archivos .cpp.")
|
||||
endif()
|
||||
# --- Lógica y Escenas del Juego ---
|
||||
source/player.cpp
|
||||
source/balloon.cpp
|
||||
source/balloon_formations.cpp
|
||||
source/balloon_manager.cpp
|
||||
source/bullet.cpp
|
||||
source/item.cpp
|
||||
source/explosions.cpp
|
||||
|
||||
# --- Escenas y Flujo ---
|
||||
source/title.cpp
|
||||
source/logo.cpp
|
||||
source/game_logo.cpp
|
||||
source/intro.cpp
|
||||
source/credits.cpp
|
||||
source/instructions.cpp
|
||||
source/hiscore_table.cpp
|
||||
source/enter_name.cpp
|
||||
source/manage_hiscore_table.cpp
|
||||
source/scoreboard.cpp
|
||||
|
||||
# --- Sprites y Gráficos ---
|
||||
source/sprite.cpp
|
||||
source/animated_sprite.cpp
|
||||
source/moving_sprite.cpp
|
||||
source/path_sprite.cpp
|
||||
source/smart_sprite.cpp
|
||||
source/background.cpp
|
||||
source/tiled_bg.cpp
|
||||
source/fade.cpp
|
||||
source/texture.cpp
|
||||
|
||||
# --- Otros ---
|
||||
source/define_buttons.cpp
|
||||
source/mouse.cpp
|
||||
source/notifier.cpp
|
||||
source/stage.cpp
|
||||
source/tabe.cpp
|
||||
source/text.cpp
|
||||
source/writer.cpp
|
||||
)
|
||||
|
||||
# Configuración de SDL3 (usando el método recomendado)
|
||||
# Fuentes de librerías de terceros
|
||||
set(EXTERNAL_SOURCES
|
||||
source/external/jail_audio.cpp
|
||||
source/external/jail_shader.cpp
|
||||
source/external/json.hpp
|
||||
source/external/gif.cpp
|
||||
)
|
||||
|
||||
|
||||
# Configuración de SDL3
|
||||
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
|
||||
message(STATUS "SDL3 encontrado: ${SDL3_INCLUDE_DIRS}")
|
||||
|
||||
# Añadir ejecutable principal
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
# --- 2. AÑADIR EJECUTABLE ---
|
||||
add_executable(${PROJECT_NAME} ${APP_SOURCES} ${EXTERNAL_SOURCES})
|
||||
|
||||
# --- 3. DIRECTORIOS DE INCLUSIÓN ---
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
"${CMAKE_SOURCE_DIR}/source"
|
||||
"${CMAKE_SOURCE_DIR}/source/external"
|
||||
)
|
||||
|
||||
# Enlazar la librería SDL3
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3)
|
||||
|
||||
|
||||
# --- 4. CONFIGURACIÓN PLATAFORMAS Y COMPILADOR ---
|
||||
# Configuración de flags de compilación
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:RELEASE>:-Os -ffunction-sections -fdata-sections>)
|
||||
@@ -32,9 +107,6 @@ target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:RELEASE>:-Os -ffunctio
|
||||
# Definir _DEBUG en modo Debug
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<CONFIG:DEBUG>:DEBUG>)
|
||||
|
||||
# Enlazar la librería SDL3
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3)
|
||||
|
||||
# Configuración específica para cada plataforma
|
||||
if(WIN32)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE WINDOWS_BUILD)
|
||||
@@ -47,7 +119,7 @@ elseif(UNIX AND NOT APPLE)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD)
|
||||
endif()
|
||||
|
||||
# Configuración común para OpenGL (excepto en Windows, ya configurado)
|
||||
# Configuración común para OpenGL
|
||||
if(NOT WIN32)
|
||||
find_package(OpenGL REQUIRED)
|
||||
if(OPENGL_FOUND)
|
||||
@@ -58,7 +130,5 @@ if(NOT WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Configuración común de salida de ejecutables en el directorio raíz
|
||||
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
# Especificar la ubicación del ejecutable (en la raíz del proyecto)
|
||||
# Especificar la ubicación del ejecutable
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
|
||||
Reference in New Issue
Block a user