-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
47 lines (32 loc) · 1.04 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
BIN=main
BIN_DIR=bin
CMD_DIR=cmd
TST_DIR=tst
SRC_DIR=src
INC_DIR=inc
OBJ_DIR=obj
# change if needed
MUJOCO_PATH=/home/$$USER/.mujoco/mujoco
MJ_FLAGS=-I$(MUJOCO_PATH)/include -L$(MUJOCO_PATH)/lib
CC=clang++
CFLAGS=-I. -I$(INC_DIR)/ $(MJ_FLAGS) -std=c++17 -O3 -pthread -mavx -Wl,-rpath,'$$ORIGIN'
LIBS=-lpthread -fopenmp
LIBS_GL=-lmujoco -lGLEW -lGLU -lGL -lglfw
LIBS_NOGL=-lmujoco200nogl
SRCS=$(wildcard $(SRC_DIR)/*.c*) $(wildcard $(SRC_DIR)/*/*.c*)
OBJS=$(addprefix $(OBJ_DIR)/, $(patsubst $(SRC_DIR)/%.cpp, %.o, $(SRCS)))
OUT_DIRS=$(sort $(dir $(OBJS)))
.PHONY: prebuild clean
basic: prebuild $(OUT_DIRS) $(OBJS)
$(CC) $(CFLAGS) $(LIBS) $(LIBS_GL) -o $(BIN_DIR)/base $(SRCS) $(CMD_DIR)/basic.cpp
tests: prebuild $(OUT_DIRS) $(OBJS)
$(CC) $(CFLAGS) $(LIBS) $(LIBS_GL) -o $(BIN_DIR)/test_derivatives $(SRCS) $(TST_DIR)/test_derivatives.cpp
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CC) -c -g $(CFLAGS) -o $@ $<
$(OUT_DIRS):
mkdir -p $(OUT_DIRS)
clean:
rm -rf $(OBJ_DIR) $(BIN_DIR) mjkey.txt
prebuild:
mkdir -p bin
cp $(MUJOCO_PATH)/lib/libmujoco* ./bin/