Preparando la interfaz
This commit is contained in:
commit
66bedbb5f1
17 files changed
+876
No files matched your search
@@ -0,0 +1,98 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(Tahgibu VERSION 2.0.0 LANGUAGES C CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Tipo de compilación" FORCE)
|
||||
endif()
|
||||
|
||||
option(TAHGIBU_BUILD_APP "Compilar el editor (requiere raylib)" ON)
|
||||
option(TAHGIBU_BUILD_TESTS "Compilar las pruebas del núcleo" ON)
|
||||
option(TAHGIBU_FETCH_RAYLIB "Descargar y compilar raylib si no se encuentra (requiere red y git)" OFF)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Núcleo: modelo de datos del proyecto. NO depende de raylib.
|
||||
# ---------------------------------------------------------------------------
|
||||
add_library(tahgibu_core STATIC
|
||||
source/core/Frame.cpp
|
||||
source/core/Project.cpp
|
||||
)
|
||||
target_include_directories(tahgibu_core PUBLIC source)
|
||||
target_compile_definitions(tahgibu_core PUBLIC TAHGIBU_VERSION="${PROJECT_VERSION}")
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
target_compile_options(tahgibu_core PUBLIC -Wall -Wextra)
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Lua: solo se detecta. No se enlaza hasta la etapa 10.
|
||||
# ---------------------------------------------------------------------------
|
||||
find_package(Lua QUIET)
|
||||
if(LUA_FOUND)
|
||||
message(STATUS "Lua ${LUA_VERSION_STRING} encontrado (se usará a partir de la etapa 10)")
|
||||
else()
|
||||
message(STATUS "Lua no encontrado. No hace falta todavía; será necesario en la etapa 10.")
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Editor (raylib)
|
||||
# ---------------------------------------------------------------------------
|
||||
if(TAHGIBU_BUILD_APP)
|
||||
set(TAHGIBU_RAYLIB_TARGET "")
|
||||
|
||||
find_package(raylib QUIET)
|
||||
if(TARGET raylib)
|
||||
set(TAHGIBU_RAYLIB_TARGET raylib)
|
||||
else()
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(RAYLIB QUIET IMPORTED_TARGET raylib)
|
||||
if(RAYLIB_FOUND)
|
||||
set(TAHGIBU_RAYLIB_TARGET PkgConfig::RAYLIB)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT TAHGIBU_RAYLIB_TARGET AND TAHGIBU_FETCH_RAYLIB)
|
||||
include(FetchContent)
|
||||
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
FetchContent_Declare(raylib
|
||||
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
||||
GIT_TAG 5.0
|
||||
GIT_SHALLOW ON)
|
||||
FetchContent_MakeAvailable(raylib)
|
||||
set(TAHGIBU_RAYLIB_TARGET raylib)
|
||||
endif()
|
||||
|
||||
if(NOT TAHGIBU_RAYLIB_TARGET)
|
||||
message(FATAL_ERROR
|
||||
"No se encontró raylib.\n"
|
||||
"Opciones:\n"
|
||||
" 1) Instalarla con el gestor de paquetes de tu distribución (ver README.md).\n"
|
||||
" 2) Reconfigurar con -DTAHGIBU_FETCH_RAYLIB=ON (descarga y compila raylib).\n"
|
||||
" 3) Compilar solo el núcleo y las pruebas con -DTAHGIBU_BUILD_APP=OFF.")
|
||||
endif()
|
||||
message(STATUS "raylib: ${TAHGIBU_RAYLIB_TARGET}")
|
||||
|
||||
add_executable(tahgibu
|
||||
source/main.cpp
|
||||
source/ui/Application.cpp
|
||||
source/ui/Layout.cpp
|
||||
)
|
||||
target_link_libraries(tahgibu PRIVATE tahgibu_core ${TAHGIBU_RAYLIB_TARGET})
|
||||
endif()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Pruebas del núcleo (no necesitan raylib ni pantalla)
|
||||
# ---------------------------------------------------------------------------
|
||||
if(TAHGIBU_BUILD_TESTS)
|
||||
enable_testing()
|
||||
add_executable(tahgibu_core_tests tests/core_tests.cpp)
|
||||
target_link_libraries(tahgibu_core_tests PRIVATE tahgibu_core)
|
||||
add_test(NAME core COMMAND tahgibu_core_tests)
|
||||
endif()
|
||||
Reference in new issue
Block a user