changeset 47:f60144ebce23

Fix build for mac
author Dennis C. M. <dennis@denniscm.com>
date Sun, 03 Mar 2024 16:05:07 +0000
parents 701dc4e9f2f6
children 10a7b0e258f4
files .gitignore CMakeLists.txt DOCS.md README.md src/utils.h
diffstat 5 files changed, 61 insertions(+), 129 deletions(-) [+]
line wrap: on
line diff
--- a/.gitignore	Tue Dec 12 09:05:12 2023 +0000
+++ b/.gitignore	Sun Mar 03 16:05:07 2024 +0000
@@ -1,62 +1,1 @@
-build
-.cache
-
-# Created by https://www.toptal.com/developers/gitignore/api/c
-# Edit at https://www.toptal.com/developers/gitignore?templates=c
-
-### C ###
-# Prerequisites
-*.d
-
-# Object files
-*.o
-*.ko
-*.obj
-*.elf
-
-# Linker output
-*.ilk
-*.map
-*.exp
-
-# Precompiled Headers
-*.gch
-*.pch
-
-# Libraries
-*.lib
-*.a
-*.la
-*.lo
-
-# Shared objects (inc. Windows DLLs)
-*.dll
-*.so
-*.so.*
-*.dylib
-
-# Executables
-*.exe
-*.out
-*.app
-*.i*86
-*.x86_64
-*.hex
-
-# Debug files
-*.dSYM/
-*.su
-*.idb
-*.pdb
-
-# Kernel Module Compile Results
-*.mod*
-*.cmd
-.tmp_versions/
-modules.order
-Module.symvers
-Mkfile.old
-dkms.conf
-
-# End of https://www.toptal.com/developers/gitignore/api/c
-
+out
\ No newline at end of file
--- a/CMakeLists.txt	Tue Dec 12 09:05:12 2023 +0000
+++ b/CMakeLists.txt	Sun Mar 03 16:05:07 2024 +0000
@@ -1,24 +1,35 @@
 cmake_minimum_required(VERSION 3.22)
 project(algo_animator)
 
-set(FREETYPE_DIR /usr/local/include/freetype2)
+# Set the path to the FreeType library
+set(FREETYPE_DIR /usr/local/Cellar/freetype/2.13.2)
+
+# Find OpenGL package
+find_package(OpenGL REQUIRED)
 
-include_directories(${FREETYPE_DIR})
+# Include directories for headers
+include_directories(${FREETYPE_DIR}/include/freetype2)
 
+# Link directories for libraries
+link_directories(${FREETYPE_DIR}/lib)
+
+# Add your source files
 add_executable(algo_animator 
-	src/main.c
-	src/algorithms.c
-	src/algorithms.h
-	src/utils.c
-	src/utils.h
+    src/main.c
+    src/algorithms.c
+    src/algorithms.h
+    src/utils.c
+    src/utils.h
 )
 
+# Link libraries
 target_link_libraries(algo_animator
-    glut
-    GL
-    GLU
-    m
+    ${OPENGL_LIBRARIES}
+    "-framework OpenGL"
+    "-framework GLUT"
+    "-framework Cocoa"
     freetype
 )
 
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/fonts DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/build)
+# Copy the 'fonts' directory to the build directory
+file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/fonts DESTINATION out/)
--- a/DOCS.md	Tue Dec 12 09:05:12 2023 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-
-# Table of Contents
-
-1.  [Compile](#org5155f5d)
-2.  [Run](#org4284749)
-3.  [Notes](#orgfd96d06)
-
-This project is inspired by the video of Timo Bingmann called [15 sorting algorithms in 6 minutes](https://www.youtube.com/watch?v=kPRA0W1kECg).
-
-![img](https://denniscm.com/static/algo-animator-1.png)
-
-![img](https://denniscm.com/static/algo-animator-2.png)
-
-
-<a id="org5155f5d"></a>
-
-# Compile
-
-    mkdir build
-    cd build
-    cmake ..
-    make
-
-Currently I've only tested this project on Linux. However, I would like to prepare it so that it can be used on Mac and Windows. However, my cross-platform experience is almost non-existent. Maybe in the future I'll check how to do it.
-
-
-<a id="org4284749"></a>
-
-# Run
-
-To customize the program you can pass the following arguments.
-
-    ./algo_animator WINDOW_WIDTH WINDOW_HEIGHT RECTANGLE_WIDTH SPACE_BETWEEN_RECTANGLES
-
-The default values are:
-
-    WINDOW_WIDTH = 1920
-    WINDOW_HEIGHT = 1080
-    RECTANGLE_WIDTH = 5
-    SPACE_BETWEEN_RECTANGLES = 1
-
-Run the program in a window with width of 1920 pixels and height of 1080 pixels, fit the screen with rectangles with width of 50 pixels, and add a space between rectangles of 3 pixels.
-
-    ./algo_animator 1920 1080 50 3
-
-![img](https://denniscm.com/static/algo-animator-3.png)
-
-
-<a id="orgfd96d06"></a>
-
-# Notes
-
-This project has not been designed to compare the speed of the algorithms side by side. The main objective is the visualization of the algorithms for educational purposes.
-
--- a/README.md	Tue Dec 12 09:05:12 2023 +0000
+++ b/README.md	Sun Mar 03 16:05:07 2024 +0000
@@ -2,3 +2,39 @@
 # algo-animator
 
 An interactive program to visualize sorting algorithms. Developed in C using OpenGL, GLUT and FreeType. I also made a video about this project -> [Youtube](https://youtu.be/KvOI88s-FsU).
+
+This project is inspired by the video of Timo Bingmann called [15 sorting algorithms in 6 minutes](https://www.youtube.com/watch?v=kPRA0W1kECg)
+
+## Usage
+
+### Compile
+
+    mkdir build
+    cd build
+    cmake ..
+    make
+
+Currently I've only tested this project on Linux. However, I would like to prepare it so that it can be used on Mac and Windows. However, my cross-platform experience is almost non-existent. Maybe in the future I'll check how to do it.
+
+### Run
+
+To customize the program you can pass the following arguments.
+
+    ./algo_animator WINDOW_WIDTH WINDOW_HEIGHT RECTANGLE_WIDTH SPACE_BETWEEN_RECTANGLES
+
+The default values are:
+
+    WINDOW_WIDTH = 1920
+    WINDOW_HEIGHT = 1080
+    RECTANGLE_WIDTH = 5
+    SPACE_BETWEEN_RECTANGLES = 1
+
+Run the program in a window with width of 1920 pixels and height of 1080 pixels, fit the screen with rectangles with width of 50 pixels, and add a space between rectangles of 3 pixels.
+
+    ./algo_animator 1920 1080 50 3
+
+# Notes
+
+This project has not been designed to compare the speed of the algorithms side by side. The main objective is the visualization of the algorithms for educational purposes.
+
+
--- a/src/utils.h	Tue Dec 12 09:05:12 2023 +0000
+++ b/src/utils.h	Sun Mar 03 16:05:07 2024 +0000
@@ -6,7 +6,7 @@
 #include <time.h>
 #include <stdbool.h>
 #include <unistd.h>
-#include <GL/glut.h>
+#include <GLUT/glut.h>
 #include <pthread.h>
 #include <ft2build.h>
 #include <signal.h>