Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
rask24 committed Jan 10, 2024
0 parents commit aef1200
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Continuous Integration
on:
push:
jobs:
norm:
name: norminette
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install norminette
- name: Run Norminette
run: make norm
69 changes: 69 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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

# Vscode
.vscode/

# Build Directory
build/

# Executable File
push_swap
checker_Mac
tester

# Subject File
en.subject.pdf

# Google Test Source
gtest/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "libft"]
path = libft
url = [email protected]:rask24/libft
73 changes: 73 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
NAME = push_swap
CFLAGS = -Werror -Wextra -Wall -O3
NORM = norminette

SRC_DIR = ./src
BUILD_DIR = ./build
INC_DIR = ./include
LIBFT_DIR = ./libft
SRC = $(SRC_DIR)/main.c
OBJ = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SRC))
DEP = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.d, $(SRC))
DEPFLAGS = -MMD -MP
INCLUDE = -I $(INC_DIR)

GTEST_VERSION = 1.8.0
GTEST_DIR = ./gtest
GTEST = $(GTEST_DIR)/gtest $(GTEST_DIR)/googletest-release-$(GTEST_VERSION)
TEST_DIR = ./test
TEST_SRC = $(TEST_DIR)/test.cpp
TEST_COMPILE = clang++ -std=c++11 \
$(TEST_SRC) \
$(GTEST_DIR)/googletest-release-$(GTEST_VERSION)/googletest/src/gtest_main.cc \
$(GTEST_DIR)/gtest/gtest-all.cc \
-I $(GTEST_DIR) $(INCLUDE) -L $(LIBFT_DIR) -l ft -lpthread -o tester

GREEN = \033[0;32m
BLUE = \033[0;34m
RED = \033[0;31m
RESET = \033[0m

all: title $(NAME)

$(NAME): $(OBJ)
@printf "\n"
@make -C $(LIBFT_DIR)
@$(CC) $^ -o $@

$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@mkdir -p $(@D)
@$(CC) $(CFLAGS) $(INCLUDE) $(DEPFLAGS) -c $< -o $@
@printf "$(GREEN).$(RESET)"

clean:
@make clean -C $(LIBFT_DIR)
@$(RM) $(OBJ)

fclean: clean
@make fclean -C $(LIBFT_DIR)
@$(RM) $(NAME)

re: fclean all

test: $(GTEST)
@echo "$(BLUE)test$(RESET)"
@$(TEST_COMPILE)
@./tester # --gtest_filter=Vector.other

$(GTEST):
@curl -OL https://github.com/google/googletest/archive/refs/tags/release-$(GTEST_VERSION).tar.gz
@tar -xvzf release-$(GTEST_VERSION).tar.gz googletest-release-$(GTEST_VERSION)
@$(RM) release-$(GTEST_VERSION).tar.gz
@python3 googletest-release-$(GTEST_VERSION)/googletest/scripts/fuse_gtest_files.py $(GTEST_DIR)
@mv googletest-release-$(GTEST_VERSION) $(GTEST_DIR)

norm:
$(NORM) $(INC_DIR) $(SRC_DIR) $(LIBFT_DIR)

title:
@echo "$(BLUE)push_swap$(RESET)"

.PHONY: all clean fclean re

-include $(DEP)
24 changes: 24 additions & 0 deletions include/push_swap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/10 12:37:54 by reasuke #+# #+# */
/* Updated: 2024/01/10 14:55:50 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef PUSH_SWAP_H
# define PUSH_SWAP_H

# include <unistd.h>
# include <stdlib.h>

// TODO: delete
# include <stdio.h>

# include "../libft/libft.h"

#endif
1 change: 1 addition & 0 deletions libft
Submodule libft added at ccce01
19 changes: 19 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: reasuke <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/10 12:37:36 by reasuke #+# #+# */
/* Updated: 2024/01/10 14:59:00 by reasuke ### ########.fr */
/* */
/* ************************************************************************** */

#include "push_swap.h"

int main(void)
{
printf("This is push_swap main file.\n");
return (0);
}
7 changes: 7 additions & 0 deletions test/test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "gtest/gtest.h"

extern "C" {
#include "push_swap.h"
}

TEST(FunctionTest, Case) {}

0 comments on commit aef1200

Please sign in to comment.