-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (60 loc) · 2.64 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# 3d_rigid_body is a hybrid C++ and Python project for simulating and predicting 3D rigid body dynamics.
# It combines a C++ physics engine for accurate simulation with a PyTorch-based deep residual network
# for learning and predicting complex 3D object interactions and movements
#
# Copyright (c) 2024 Finbarrs Oketunji
# Written by Finbarrs Oketunji <[email protected]>
#
# This file is part of 3d_rigid_body.
#
# 3d_rigid_body is an open-source software: you are free to redistribute
# and/or modify it under the terms specified in version 3 of the GNU
# General Public License, as published by the Free Software Foundation.
#
# 3d_rigid_body is is made available with the hope that it will be beneficial,
# but it comes with NO WARRANTY whatsoever. This includes, but is not limited
# to, any implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. For more detailed information, please refer to the
# GNU General Public License.
#
# You should have received a copy of the GNU General Public License
# along with 3d_rigid_body. If not, visit <http://www.gnu.org/licenses/>.
# Compiler and flags for C++
CXX = clang++
CXXFLAGS = -O3 -std=c++11 -Xpreprocessor -fopenmp -I/usr/local/include/eigen3
LDFLAGS = -lomp
# Directories
SRC_DIR = src
SCRIPT_DIR = scripts
# Target executable name
TARGET = 3d_rigid_body
# Source files
SRC = $(SRC_DIR)/main.cc $(SRC_DIR)/rigid_body.cc
# Header files
HEADERS = $(SRC_DIR)/rigid_body.h
# Python script
PYTHON_SCRIPT = $(SCRIPT_DIR)/residual_network.py
# Default target
all: install $(TARGET) run_python ## Build and run the entire project
# Install Eigen and Python packages
install: install_eigen install_python_packages ## Install Eigen and Python packages
install_eigen: ## Install Eigen on macOS
brew install eigen
install_python_packages: ## Install Python Packages
pip3 install -r requirements.txt
# Compile C++ program
$(TARGET): $(SRC) $(HEADERS) ## Compile the C++ program
$(CXX) $(CXXFLAGS) -o $(TARGET) $(SRC) $(LDFLAGS)
# Execute C++ Program
run_cpp: $(TARGET) ## Execute the C++ Program
./$(TARGET)
# Execute Python Script with default parameters
run_python: run_cpp ## Execute the Python script after the C++ Program
python3 $(PYTHON_SCRIPT)
# Execute Python Script with custom parameters
run_python_custom: run_cpp ## Execute the Python script with custom parameters
python3 $(PYTHON_SCRIPT) $(PYTHON_ARGS)
help: ## Display Help Message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: all install install_eigen install_python_packages run_cpp run_python run_python_custom clean help
.DEFAULT_GOAL := help