aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--CMakeLists.txt17
-rw-r--r--src/Hello.c6
-rw-r--r--src/Hello.h14
-rw-r--r--src/Main.cpp8
5 files changed, 49 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..dec6bd0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+build/
+tmp/
+tmp
+.cache/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..526a749
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 3.24)
+project(chess)
+
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+set(CMAKE_C_STANDARD 23)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+
+set(CMAKE_CXX_STANDARD 23)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+file(GLOB_RECURSE SOURCE_FILES src/*.c src/*.cpp src/*.h src/*.hpp)
+
+add_executable(${PROJECT_NAME} ${SOURCE_FILES})
+
+# Ensures headers in src/ are easy to include from anywhere
+target_include_directories(${PROJECT_NAME} PRIVATE src)
diff --git a/src/Hello.c b/src/Hello.c
new file mode 100644
index 0000000..7cd1d70
--- /dev/null
+++ b/src/Hello.c
@@ -0,0 +1,6 @@
+#include "Hello.h"
+#include <stdio.h>
+
+void printMessage(const char* message) {
+ printf("%s", message);
+}
diff --git a/src/Hello.h b/src/Hello.h
new file mode 100644
index 0000000..1ec1f96
--- /dev/null
+++ b/src/Hello.h
@@ -0,0 +1,14 @@
+#ifndef SRC_HELLO_H_
+#define SRC_HELLO_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void printMessage(const char* message);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SRC_HELLO_H_ */
diff --git a/src/Main.cpp b/src/Main.cpp
new file mode 100644
index 0000000..3348d2a
--- /dev/null
+++ b/src/Main.cpp
@@ -0,0 +1,8 @@
+#include <cstdlib>
+
+#include "Hello.h"
+
+int main(){
+ printMessage("Hello world\n");
+ return EXIT_SUCCESS;
+}