summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLevent Kaya <42411502+lvntky@users.noreply.github.com>2024-11-25 00:44:07 +0300
committerGitHub <noreply@github.com>2024-11-25 00:44:07 +0300
commit8aed83d2e77c006eebf21776487f788ef12216de (patch)
tree14d7dfd2b4c86dcb3b27912513439b4648145733 /CMakeLists.txt
parentff43c66c491b443b7522a3b3d716905ee9732b60 (diff)
parent8650f5e1d7bb72625ae5d6cda2974f6fafa6362d (diff)
Merge pull request #8 from dario-loi/bugfixes
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt32
1 files changed, 32 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..02aa36d
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.11)
+
+project(fbglExamples C)
+
+add_custom_target(run-examples)
+
+set(FBGL_HEADER "fbgl.h")
+set(EXAMPLES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/examples")
+
+# find freetype2
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(FREETYPE2 REQUIRED freetype2)
+include_directories(${FREETYPE2_INCLUDE_DIRS})
+
+function(add_example NAME)
+ add_executable("${NAME}" "${EXAMPLES_DIR}/${NAME}.c" "${FBGL_HEADER}")
+ target_compile_features("${NAME}" PRIVATE c_std_99)
+ target_compile_options("${NAME}" PRIVATE -Wall -Wextra -Wpedantic)
+ target_include_directories("${NAME}" PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
+ target_link_libraries("${NAME}" PRIVATE ${FREETYPE2_LIBRARIES})
+ add_custom_target("run_${NAME}" COMMAND "${NAME}" VERBATIM)
+ add_dependencies("run_${NAME}" "${NAME}")
+ add_dependencies(run-examples "run_${NAME}")
+endfunction()
+
+add_example(empty_example)
+add_example(line)
+add_example(rectangle)
+add_example(red)
+add_example(texture)
+add_example(raw_mode)
+add_example(framebuf_info) \ No newline at end of file