From 01e6d432a4c5140900f27b673b8245954180458a Mon Sep 17 00:00:00 2001 From: Ritchie Cunningham Date: Sat, 20 Sep 2025 01:03:03 +0100 Subject: [PATCH] [Add] Initial project structure. --- .gitignore | 18 ++++++++++++++++++ CMakeLists.txt | 9 +++++++++ Makefile | 34 ++++++++++++++++++++++++++++++++++ client/CMakeLists.txt | 7 +++++++ client/src/main.cpp | 6 ++++++ common/CMakeLists.txt | 8 ++++++++ common/src/bettola.cpp | 6 ++++++ common/src/bettola.h | 3 +++ server/CMakeLists.txt | 8 ++++++++ server/src/main.cpp | 8 ++++++++ 10 files changed, 107 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 Makefile create mode 100644 client/CMakeLists.txt create mode 100644 client/src/main.cpp create mode 100644 common/CMakeLists.txt create mode 100644 common/src/bettola.cpp create mode 100644 common/src/bettola.h create mode 100644 server/CMakeLists.txt create mode 100644 server/src/main.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3fb4741 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6eb38a9 --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ac00009 --- /dev/null +++ b/Makefile @@ -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) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt new file mode 100644 index 0000000..7011d6b --- /dev/null +++ b/client/CMakeLists.txt @@ -0,0 +1,7 @@ +file(GLOB_RECURSE CLIENT_SOURCES "src/*.cpp") + +add_executable(bettolac + ${CLIENT_SOURCES} +) + +target_link_libraries(bettolac PRIVATE bettola) diff --git a/client/src/main.cpp b/client/src/main.cpp new file mode 100644 index 0000000..d7398ed --- /dev/null +++ b/client/src/main.cpp @@ -0,0 +1,6 @@ +#include "bettola.h" + +int main(int argc, char** argv) { + bettola_function(); + return 0; +} diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt new file mode 100644 index 0000000..38b6461 --- /dev/null +++ b/common/CMakeLists.txt @@ -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) + diff --git a/common/src/bettola.cpp b/common/src/bettola.cpp new file mode 100644 index 0000000..7b8e117 --- /dev/null +++ b/common/src/bettola.cpp @@ -0,0 +1,6 @@ +#include +#include "bettola.h" + +void bettola_function(void) { + printf("Hello from libbettola!\n"); +} diff --git a/common/src/bettola.h b/common/src/bettola.h new file mode 100644 index 0000000..7899ac1 --- /dev/null +++ b/common/src/bettola.h @@ -0,0 +1,3 @@ +#pragma once + +void bettola_function(void); diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt new file mode 100644 index 0000000..6e7c919 --- /dev/null +++ b/server/CMakeLists.txt @@ -0,0 +1,8 @@ +file(GLOB_RECURSE BETTOLAS_SOURCES "src/*.cpp") + +add_executable(bettolas + ${BETTOLAS_SOURCES} +) + +target_link_libraries(bettolas PRIVATE bettola) + diff --git a/server/src/main.cpp b/server/src/main.cpp new file mode 100644 index 0000000..df48ef9 --- /dev/null +++ b/server/src/main.cpp @@ -0,0 +1,8 @@ +#include +#include "bettola.h" + +int main(int argc, char** argv) { + printf("=== Server starting ===\n"); + bettola_function(); + return 0; +}