This repository has been archived by the owner on Apr 25, 2023. It is now read-only.
/
Jamrules
208 lines (171 loc) · 5.82 KB
/
Jamrules
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
##
## Compilation
##
C = clang ;
C++ = clang++ ;
LINK = clang++ ;
# C++ = g++ ;
# LINK = g++ ;
# If I was building a library, these would be useful
# LINKFLAGS = -shared ;
# if $(UNIX) { SUFSHR = .so ; }
# else if $(NT) { SUFSHR = .dll ; }
## Compiler arguments
# Arguments used on all projects, regardless of any variables
# Note that Tracy 0.6.5 requires c++14 (normally C++11 would be fine)
C++FLAGS = -std=c++14 -stdlib=libstdc++
-Wall -Wextra -Wno-unused-parameter
-g
# Only for profiling, i.e. not release builds
-DTRACY_ENABLE
# BT_USE_DOUBLE_PRECISION solves the Dantzig LCP missing definition
# Disabled now that I'm compiling Bullet in single-precision
# -DBT_USE_DOUBLE_PRECISION
;
HDRS = src
Dependencies/bullet3/src Dependencies/bullet3/Extras/Serialize/BulletWorldImporter
Dependencies/base2.0
Dependencies/base2.0/dependencies/SFML/include
Dependencies/base2.0/dependencies/imgui
Dependencies/base2.0/dependencies/imgui-sfml
Dependencies/tinygltf Dependencies/tinyobjloader
Dependencies/glm
Dependencies/Horde3D/Horde3D/Bindings/C++
Dependencies/tracy
;
if $(DEBUG_BUILD)
{
BULLET3_BUILD_DIR = Dependencies/bullet3/build_cmake_debug ;
# TODO: Separate Horde debug and release build directories
HORDE3D_BUILD_DIR = Dependencies/Horde3D/build/Horde3D ;
}
else
{
BULLET3_BUILD_DIR = Dependencies/bullet3/build_cmake ;
HORDE3D_BUILD_DIR = Dependencies/Horde3D/build/Horde3D ;
}
# TODO: Make base hold all this weirdness?
if $(DEBUG_BUILD)
{
SFML_LINKLIBS = -lsfml-audio-d -lsfml-graphics-d -lsfml-window-d -lsfml-system-d ;
}
else
{
SFML_LINKLIBS = -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system ;
}
OPTIM = -O0 ;
##
## Linking
##
LINKLIBS =
# Standard (e.g. for Tracy)
-lpthread -ldl
# SFML
-LDependencies/base2.0/dependencies/SFML/lib
$(SFML_LINKLIBS)
# OpenGL
-lGL
-lGLU
-lGLEW
# Base
-LDependencies/base2.0 -lBase20
# Bullet libraries
-L$(BULLET3_BUILD_DIR)/src/BulletDynamics
-L$(BULLET3_BUILD_DIR)/src/BulletCollision
-L$(BULLET3_BUILD_DIR)/src/Bullet3Common
-L$(BULLET3_BUILD_DIR)/src/LinearMath
-L$(BULLET3_BUILD_DIR)/Extras/Serialize/BulletWorldImporter
-lBullet3Common
-lBulletDynamics
-lBulletCollision
-lLinearMath
-lBulletWorldImporter
# Stuff I'm not using, but could use
# -L$(BULLET3_BUILD_DIR)/src/BulletSoftBody
# -L$(BULLET3_BUILD_DIR)/src/BulletInverseDynamics
# -L$(BULLET3_BUILD_DIR)/src/Bullet3InverseDynamicsUtils
# -lBulletSoftBody
# -lBulletInverseDynamics
# -lBulletInverseDynamicsUtils
-LDependencies/Horde3D/build/Horde3D/Source/Horde3DEngine
-LDependencies/Horde3D/build/Horde3D/Source/Horde3DUtils
-lHorde3D
-lHorde3DUtils
;
# LINKFLAGS = -Wl,-rpath,. ;
# TODO: Copy libs to better directory, or static link?
LINKFLAGS = -g -stdlib=libstdc++
-Wl,-rpath,.:Dependencies/base2.0/dependencies/SFML/lib:$(BULLET3_BUILD_DIR)/src/BulletSoftBody:$(BULLET3_BUILD_DIR)/Extras/InverseDynamics:$(BULLET3_BUILD_DIR)/src/BulletInverseDynamics:$(BULLET3_BUILD_DIR)/examples/ThirdPartyLibs/BussIK:$(BULLET3_BUILD_DIR)/src/BulletDynamics:$(BULLET3_BUILD_DIR)/src/BulletCollision:$(BULLET3_BUILD_DIR)/src/LinearMath:$(BULLET3_BUILD_DIR)/src/Bullet3Common:$(BULLET3_BUILD_DIR)/src/Bullet3Collision:$(BULLET3_BUILD_DIR)/Extras/Serialize/BulletWorldImporter:$(HORDE3D_BUILD_DIR)/Source/Horde3DEngine:$(HORDE3D_BUILD_DIR)/Source/Horde3DUtils ;
##
## Jam stuff
##
# Fix for unnecessary rebuilding any Jam project
KEEPOBJS = true ; # This doesn't actually fix anything, though it seems like it should
NOARSCAN = true ; # This actually fixes the problem
#AR = ar rUu ; # I was thinking maybe the AR command was wrong (always outputting deterministically)
# It doesn't seem like this is the problem though
AR = ar cr ;
# Cross compilation
# E.g.
# jam -j4 -q -sCROSS_COMPILE_WINDOWS=true
# if $(CROSS_COMPILE_WINDOWS)
# {
# CC = x86_64-w64-mingw32-gcc ;
# LINK = x86_64-w64-mingw32-gcc ;
# AR = x86_64-w64-mingw32-ar ;
# SUFSHR = .dll ;
# }
# Some helpful Jam commands
# -q : stop on failed target
# -jN : use N cores
# -sVAR=VAL : Set VAR to VAL. Note that setting WINDOWS=false is the same as setting UNREAL=true,
# frustratingly
# -dx : print commands being used
# -n : don't actually run commands
#
# Custom actions
# Refer to http://david.freetype.org/jam/jam-language-3.html
# $(1:S=.c) : Take $(1), strip the extension, and append ".c"
# $(1:BS=.h) : Strip path and extension, then append ".h"
Depends all : dataAssets ;
NotFile dataAssets ;
if $(BLENDER)
{
BLENDER_EXE = $(BLENDER) ;
}
else
{
BLENDER_EXE = blender ;
}
# Usage:
# BuildAsset outputAssets/outputAsset : inputAssets/input.blend ;
# TODO: Make output actually respected; currently ExportBlenderAssets.py determines output internally
rule BuildAsset
{
# Add 1 to list of data assets that need built
Depends dataAssets : $(1) ;
# 1 is a collection of assets, so not a file
NotFile $(1) ;
# 1 requires both a .obj and .dae (collision and render respectively)
Depends $(1) : $(1:S=.obj) $(1:S=.dae) ;
# The obj and dae require a .blend
# This rule ensures if the .blend is updated, the .obj and .dae are dirty (causing BuildAsset to run)
Depends $(1:S=.obj) : $(2) ;
Depends $(1:S=.dae) : $(2) ;
# TODO: Add depenencies on collision
Depends Collision/$(1:S=.obj) : $(1:S=.obj) ;
# TODO: I don't normally want to reprocess assets on clean. Make a separate CleanAssets rule
# Clean clean : $(1:S=.obj) $(1:S=.dae) ;
}
actions BuildAsset
{
$(BLENDER_EXE) $(2) --background --python ExportBlenderAssets.py
# TODO: Add these to clean and dependencies, because otherwise it will think
# subsequent builds are successful even if ColladaConv failed
# TODO: Make this directory!
cp $(1:S=.obj) Collision/
# TODO: Use build dir instead
./Dependencies/Horde3D/build/Binaries/Linux/Debug/ColladaConv $(1:S=.dae) -type model -addModelName -dest Content
# TODO: Add textures
# Bulk Collision : $(1:S=.obj) ;
}