add/fix: Added arena implementation and cmake rework
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,6 +9,7 @@ out/Release/
|
|||||||
|
|
||||||
# Cmake files
|
# Cmake files
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
|
cmake
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
CTestTestfile.cmake
|
CTestTestfile.cmake
|
||||||
|
|||||||
@@ -3,16 +3,8 @@ project(calculator VERSION 1.0 LANGUAGES C)
|
|||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
include(FetchContent)
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
# clangd
|
||||||
arena
|
|
||||||
GIT_REPOSITORY https://laentropia-homelab.tail7368da.ts.net/laentropia/Arena.git
|
|
||||||
GIT_TAG main
|
|
||||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/external/arena
|
|
||||||
)
|
|
||||||
|
|
||||||
# Export compile_commands.json (para clangd)
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
@@ -21,15 +13,18 @@ add_compile_options(
|
|||||||
-Wpedantic
|
-Wpedantic
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include(cmake/CPM.cmake)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(arena)
|
CPMAddPackage(
|
||||||
|
NAME arena
|
||||||
add_library(arena STATIC
|
GIT_REPOSITORY https://laentropia-homelab.tail7368da.ts.net/laentropia/Arena.git
|
||||||
external/arena/src/arena.c
|
GIT_TAG main
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(arena
|
CPMAddPackage(
|
||||||
PUBLIC ${CMAKE_SOURCE_DIR}/external/arena/include
|
NAME arraylist
|
||||||
|
GIT_REPOSITORY https://laentropia-homelab.tail7368da.ts.net/laentropia/ArrayList.git
|
||||||
|
GIT_TAG main
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(calculator_lib
|
add_library(calculator_lib
|
||||||
@@ -43,18 +38,13 @@ target_include_directories(calculator_lib
|
|||||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 🔥 aquí está la magia
|
||||||
target_link_libraries(calculator_lib
|
target_link_libraries(calculator_lib
|
||||||
PUBLIC arena
|
PUBLIC arena
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(calculator src/main.c)
|
add_executable(calculator src/main.c)
|
||||||
|
|
||||||
target_link_libraries(calculator calculator_lib)
|
target_link_libraries(calculator calculator_lib)
|
||||||
|
|
||||||
# ------------------------
|
|
||||||
# Testing
|
|
||||||
# ------------------------
|
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
||||||
|
|||||||
1
external/arena
vendored
1
external/arena
vendored
Submodule external/arena deleted from 3d3b8596cc
@@ -4,8 +4,6 @@
|
|||||||
#include <stdalign.h>
|
#include <stdalign.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t node_lbp(ASTNode node) {
|
uint8_t node_lbp(ASTNode node) {
|
||||||
if (node.type == NODE_INTEGER) {
|
if (node.type == NODE_INTEGER) {
|
||||||
|
|||||||
Reference in New Issue
Block a user