[Add] Initial project structure.

This commit is contained in:
Ritchie Cunningham 2025-09-20 01:03:03 +01:00
parent 53d067c0e0
commit 01e6d432a4
10 changed files with 107 additions and 0 deletions

18
.gitignore vendored Normal file
View File

@ -0,0 +1,18 @@
# Build output.
bin/
build/
# Editor/IDE, whatever people use.
.vscode/
.idea/
*.suo
*.user
*.clangd/
# For those messy OS'es that like to put files everywhere.
.DS_Store
# Misc.
assets/design_doc.org
.clangd
*.swp

9
CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.16)
project(bettola CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_subdirectory(common)
add_subdirectory(client)
add_subdirectory(server)

34
Makefile Normal file
View File

@ -0,0 +1,34 @@
# Wrapper Makefile.
# Build artifacts.
BUILD_DIR := bin
# Client path.
CLIENT_EXE := $(BUILD_DIR)/client/bettolac
# Server path.
SERVER_EXE := $(BUILD_DIR)/server/bettolas
.PHONY: all build config runc runs clean
# Default target when running 'make'.
all: build
build: config
@echo "=== Building Bettola. ==="
@$(MAKE) -C $(BUILD_DIR)
config:
@echo "=== Configuring Project. ==="
@cmake -B $(BUILD_DIR) -S .
runc: build
@echo "=== Running Bettola Client. ==="
@$(CLIENT_EXE)
runs: build
@echo "=== Running Bettola Server. ==="
@$(SERVER_EXE)
clean:
@echo "=== Cleaning Build Directory. ==="
@rm -rf $(BUILD_DIR)

7
client/CMakeLists.txt Normal file
View File

@ -0,0 +1,7 @@
file(GLOB_RECURSE CLIENT_SOURCES "src/*.cpp")
add_executable(bettolac
${CLIENT_SOURCES}
)
target_link_libraries(bettolac PRIVATE bettola)

6
client/src/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "bettola.h"
int main(int argc, char** argv) {
bettola_function();
return 0;
}

8
common/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
file(GLOB_RECURSE BETTOLA_SOURCES "src/*.cpp")
add_library(bettola
${BETTOLA_SOURCES}
)
target_include_directories(bettola PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)

6
common/src/bettola.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <cstdio>
#include "bettola.h"
void bettola_function(void) {
printf("Hello from libbettola!\n");
}

3
common/src/bettola.h Normal file
View File

@ -0,0 +1,3 @@
#pragma once
void bettola_function(void);

8
server/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
file(GLOB_RECURSE BETTOLAS_SOURCES "src/*.cpp")
add_executable(bettolas
${BETTOLAS_SOURCES}
)
target_link_libraries(bettolas PRIVATE bettola)

8
server/src/main.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <cstdio>
#include "bettola.h"
int main(int argc, char** argv) {
printf("=== Server starting ===\n");
bettola_function();
return 0;
}