-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
127 lines (110 loc) · 3.89 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
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
##=====================================================================
## TimedPetriNetEditor: A timed Petri net editor.
## Copyright 2021 -- 2023 Quentin Quadrat <[email protected]>
##
## This file is part of PetriEditor.
##
## PetriEditor is free software: you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
##=====================================================================
###################################################
# Location of the project directory and Makefiles
#
P := .
M := $(P)/.makefile
###################################################
# Project definition
#
include $(P)/Makefile.common
TARGET_NAME := $(PROJECT_NAME)
TARGET_DESCRIPTION := Timed Petri Net Editor
include $(M)/project/Makefile
###################################################
# Standalone application
#
SRC_FILES := src/main.cpp
INCLUDES := $(P)/include
VPATH := $(P)/src
# Internal libs to compile
LIB_TPNE_NET := $(call internal-lib,TimedPetriNet)
LIB_TPNE_EDITOR := $(call internal-lib,TimedPetriGUI)
LIB_TPNE_JULIA := $(call internal-lib,TimedPetriJulia)
INTERNAL_LIBS := $(LIB_TPNE_EDITOR) $(LIB_TPNE_NET) $(LIB_TPNE_JULIA)
DIRS_WITH_MAKEFILE := $(P)/src/Net $(P)/src/Editor $(P)/src/julia
###################################################
# GUI
#
include $(abspath $(P)/src/Editor/DearImGui/Backends/Makefile)
###################################################
# Embed assets for web version. Assets shall be
# present inside $(BUILD) folder.
#
ifeq ($(OS),Emscripten)
ifndef EXAEQUOS
# Install the folder data in the Emscripten filesystem
LINKER_FLAGS += --preload-file $(PROJECT_DATA_DIR)
LINKER_FLAGS += -s FORCE_FILESYSTEM=1
# Add this flag ONLY in case we are using ASYNCIFY code
LINKER_FLAGS += -s ASYNCIFY
# For linking glfwGetProcAddress().
LINKER_FLAGS += -s GL_ENABLE_GET_PROC_ADDRESS
endif
endif
###################################################
# OpenGL: glfw and glew libraries
#
ifeq ($(ARCHI),Darwin)
INCLUDES += -I/usr/local/include -I/opt/local/include
LINKER_FLAGS += -framework OpenGL -framework Cocoa
LINKER_FLAGS += -framework IOKit -framework CoreVideo
LINKER_FLAGS += -L/usr/local/lib -L/opt/local/lib
LINKER_FLAGS += -lGLEW -lglfw
endif
###################################################
# Project linker
#
LINKER_FLAGS += -ldl -lpthread
###################################################
# MacOS X
#
ifeq ($(ARCHI),Darwin)
BUILD_MACOS_APP_BUNDLE = 1
APPLE_IDENTIFIER = lecrapouille
MACOS_BUNDLE_ICON = data/TimedPetriNetEditor.icns
LINKER_FLAGS += -framework CoreFoundation
endif
###################################################
# Generic Makefile rules
#
include $(M)/rules/Makefile
###################################################
# Compile internal librairies in the correct order
#
$(LIB_TPNE_NET): $(P)/src/Net
$(LIB_TPNE_EDITOR): $(P)/src/Editor
$(LIB_TPNE_JULIA): $(P)/src/julia
$(P)/src/julia: $(P)/src/Editor
$(P)/src/Editor: $(P)/src/Net
###################################################
#? Copy data inside BUILD to allow emscripten to embedded them
#
.PHONY: copy-assets
copy-emscripten-assets: | $(BUILD)
ifeq ($(ARCHI),Emscripten)
@$(call print-to,"Copying assets","$(TARGET)","$(BUILD)","")
@mkdir -p $(BUILD)/data
@mkdir -p $(BUILD)/examples
@cp $(P)/data/examples/*.json $(BUILD)/examples
@cp $(P)/data/font.ttf $(BUILD)/data
@cp $(P)/data/imgui.ini $(BUILD)/data
endif