Compare commits
2 Commits
424c243ffc
...
7c50cc00fa
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c50cc00fa | |||
| 8f5d56af7f |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.vscode
|
.vscode
|
||||||
|
build/
|
||||||
data/config/config.txt
|
data/config/config.txt
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
thumbs.db
|
thumbs.db
|
||||||
|
|||||||
85
CMakeLists.txt
Normal file
85
CMakeLists.txt
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# CMakeLists.txt
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
project(coffee_crisis)
|
||||||
|
|
||||||
|
# Configuración de compilador para MinGW en Windows, si es necesario
|
||||||
|
if(WIN32 AND NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
|
set(CMAKE_CXX_COMPILER "g++")
|
||||||
|
set(CMAKE_C_COMPILER "gcc")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Establecer estándar de C++
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
|
# Configuración global de flags de compilación
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -ffunction-sections -fdata-sections")
|
||||||
|
|
||||||
|
# Define el directorio de los archivos fuente
|
||||||
|
set(DIR_SOURCES "${CMAKE_SOURCE_DIR}/source")
|
||||||
|
|
||||||
|
# Cargar todos los archivos fuente en DIR_SOURCES de manera recursiva
|
||||||
|
file(GLOB_RECURSE SOURCES "${DIR_SOURCES}/*.cpp")
|
||||||
|
|
||||||
|
# Verificar si se encontraron archivos fuente
|
||||||
|
if(NOT SOURCES)
|
||||||
|
message(FATAL_ERROR "No se encontraron archivos fuente en ${DIR_SOURCES}. Verifica que el directorio existe y contiene archivos .cpp.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Configuración de SDL2
|
||||||
|
find_package(SDL2 REQUIRED)
|
||||||
|
if(SDL2_FOUND)
|
||||||
|
message(STATUS "SDL2 encontrado: ${SDL2_INCLUDE_DIRS}")
|
||||||
|
include_directories(${SDL2_INCLUDE_DIRS})
|
||||||
|
link_directories(${SDL2_LIBDIR})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "SDL2 no encontrado")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Incluye rutas de SDL2 obtenidas con pkg-config
|
||||||
|
include_directories(/usr/local/include /usr/local/include/SDL2)
|
||||||
|
link_directories(/usr/local/lib)
|
||||||
|
|
||||||
|
# Definir las bibliotecas comunes
|
||||||
|
set(LIBS SDL2)
|
||||||
|
|
||||||
|
# Configuración común de salida de ejecutables en el directorio raíz
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||||
|
|
||||||
|
# Añadir ejecutable principal
|
||||||
|
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||||
|
|
||||||
|
# Añadir definiciones de compilación dependiendo del tipo de build
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<CONFIG:DEBUG>:DEBUG VERBOSE>)
|
||||||
|
|
||||||
|
# Enlazar bibliotecas
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${LIBS})
|
||||||
|
|
||||||
|
# Configuración específica para cada plataforma
|
||||||
|
if(WIN32)
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE WINDOWS_BUILD)
|
||||||
|
target_link_libraries(${PROJECT_NAME} mingw32 opengl32 gdi32 winmm imm32 ole32 version)
|
||||||
|
elseif(APPLE)
|
||||||
|
set(LIBS ${LIBS} "-framework OpenGL")
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
|
||||||
|
# Configurar compilación para Apple Silicon
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
||||||
|
elseif(UNIX AND NOT APPLE)
|
||||||
|
set(LIBS ${LIBS} GL)
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD)
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${LIBS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Añadir OpenGL a las bibliotecas enlazadas
|
||||||
|
if(NOT WIN32)
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
if(OPENGL_FOUND)
|
||||||
|
message(STATUS "OpenGL encontrado: ${OPENGL_LIBRARIES}")
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${OPENGL_LIBRARIES})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "OpenGL no encontrado")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@ executable = coffee_crisis
|
|||||||
source = source/*.cpp source/common/*.cpp
|
source = source/*.cpp source/common/*.cpp
|
||||||
appName = Coffee Crisis
|
appName = Coffee Crisis
|
||||||
releaseFolder = cc_release
|
releaseFolder = cc_release
|
||||||
version = v2.3
|
version = v2.3.1
|
||||||
resource_file = release/coffee.res
|
resource_file = release/coffee.res
|
||||||
|
|
||||||
# Release names
|
# Release names
|
||||||
|
|||||||
Reference in New Issue
Block a user