Skip to content

Commit

Permalink
Use MyMakefile v2-rc
Browse files Browse the repository at this point in the history
  • Loading branch information
Lecrapouille committed May 28, 2024
1 parent 710bd7b commit ef1d74b
Show file tree
Hide file tree
Showing 22 changed files with 336 additions and 396 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/non_regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
- name: Do non regression tests
run: |
cd tests
V=1 make -j`nproc --all`
./build/TimedPetriNetEditor-UnitTest
V=1 make check -j`nproc --all`
../build/TimedPetriNetEditor-UnitTest
- name: Check if the library can be linked against a project
run: |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
Expand All @@ -63,7 +63,7 @@ jobs:
run: |
make download-external-libs
make compile-external-libs
make -j`sysctl -n hw.logicalcpu`
V=1 make -j`sysctl -n hw.logicalcpu`
- name: Download, configure and install Google test
run: |
wget https://github.com/google/googletest/archive/release-1.11.0.tar.gz
Expand All @@ -74,8 +74,8 @@ jobs:
- name: Do non regression tests
run: |
cd tests
make -j`sysctl -n hw.logicalcpu`
./build/TimedPetriNetEditor-UnitTest
V=1 make check -j`sysctl -n hw.logicalcpu`
../build/TimedPetriNetEditor-UnitTest
- name: Create the DMG file
run: |
hdiutil create -format UDZO -srcfolder build/TimedPetriNetEditor.app build/TimedPetriNetEditor.dmg
Expand Down
2 changes: 1 addition & 1 deletion .makefile
Submodule .makefile updated 59 files
+0 −102 .github/workflows/ci.yml
+0 −10 .gitignore
+674 −21 LICENSE
+0 −72 Makefile.color
+0 −349 Makefile.flags
+0 −300 Makefile.footer
+0 −261 Makefile.header
+0 −24 Makefile.help
+0 −399 Makefile.macros
+0 −443 README.md
+19 −0 TODO
+1 −0 VERSION
+0 −1 VERSION.txt
+367 −202 assets/doxygen/Doxyfile
+0 −0 assets/doxygen/doxygen.css
+0 −0 assets/doxygen/footer.html
+1 −0 assets/doxygen/header.html
+ assets/icons/logo.png
+ assets/icons/macos.icns
+1 −1 assets/scripts/alib.sh
+13 −13 assets/scripts/compile-external-libs.sh
+17 −17 assets/scripts/config.sh
+4 −4 assets/scripts/download-external-libs.sh
+24 −21 assets/scripts/targz.sh
+91 −0 doc/API.md
+14 −0 doc/demos/00/Makefile
+1 −2 doc/demos/00/src/main.cpp
+16 −0 doc/demos/01/Makefile
+12 −0 doc/demos/01/src/foo.cpp
+1 −1 doc/demos/01/src/foo.hpp
+3 −2 doc/demos/01/src/main.cpp
+16 −0 doc/demos/01/tests/Makefile
+13 −0 doc/demos/01/tests/unit-tests.cpp
+21 −0 doc/demos/02/Makefile
+0 −0 doc/demos/02/include/bar.hpp
+0 −0 doc/demos/02/include/foo.hpp
+15 −0 doc/demos/02/src/bar/Makefile
+0 −0 doc/demos/02/src/bar/bar.cpp
+15 −0 doc/demos/02/src/foo/Makefile
+0 −0 doc/demos/02/src/foo/foo.cpp
+15 −0 doc/demos/02/src/main.cpp
+0 −18 examples/00/Makefile
+0 −1 examples/00/VERSION.txt
+0 −27 examples/01/Makefile
+0 −1 examples/01/VERSION.txt
+0 −8 examples/01/src/foo.cpp
+0 −22 examples/01/tests/Makefile
+0 −1 examples/01/tests/VERSION.txt
+0 −14 examples/01/tests/unit-tests.cpp
+0 −62 examples/02/Makefile
+0 −1 examples/02/VERSION.txt
+0 −40 examples/02/src/bar/Makefile
+0 −1 examples/02/src/bar/VERSION.txt
+0 −40 examples/02/src/foo/Makefile
+0 −1 examples/02/src/foo/VERSION.txt
+0 −8 examples/02/src/main.cpp
+0 −37 examples/README.md
+366 −0 project/Makefile
+1,156 −0 rules/Makefile
163 changes: 53 additions & 110 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
##=====================================================================
## TimedPetriNetEditor: A timed Petri net editor.
## Copyright 2021 -- 2023 Quentin Quadrat <lecrapouille@gmail.com>
##
## 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
#
Expand All @@ -8,93 +28,63 @@ M := $(P)/.makefile
# Project definition
#
include $(P)/Makefile.common
TARGET = $(PROJECT)
DESCRIPTION = Timed Petri Net Editor
TARGET_NAME := $(PROJECT_NAME)
TARGET_DESCRIPTION := Timed Petri Net Editor
include $(M)/project/Makefile

###################################################
# Sharable informations between all Makefiles
# Standalone application
#
include $(M)/Makefile.header
SRC_FILES := src/main.cpp
INCLUDES := $(P)/include
VPATH := $(P)/src
LINKER_FLAGS += -ldl -lpthread
# Internal libs to compile
LIB_TPNE_NET := TimedPetriNet
LIB_TPNE_EDITOR := TimedPetriEditor
LIB_TPNE_JULIA := TimedPetriJulia
INTERNAL_LIBS := $(LIB_TPNE_EDITOR) $(LIB_TPNE_NET) $(LIB_TPNE_JULIA)
DIRS_WITH_MAKEFILE := $(P)/src/Net $(P)/src/Editor $(P)/src/julia

###################################################
# OpenGL: glfw and glew libraries
# GUI
#
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
else ifeq ($(ARCHI),Linux)
LINKER_FLAGS += -lGL
PKG_LIBS += --static glfw3
else ifeq ($(ARCHI),Emscripten)
ifneq ($(EXAEQUOS),)
LINKER_FLAGS += -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sFULL_ES3
PKG_LIBS += exa-wayland --static glfw
endif
else
$(error Unknown architecture $(ARCHI) for OpenGL)
endif
include $(abspath $(P)/src/Editor/DearImGui/Backends/Makefile)
INCLUDES += $(P)/src/Editor/DearImGui
INCLUDES += $(P)/src

###################################################
# Embed assets for web version. Assets shall be
# present inside $(BUILD) folder.
#
ifeq ($(ARCHI),Emscripten)
ifeq ($(EXAEQUOS),)
LINKER_FLAGS += --preload-file examples
LINKER_FLAGS += --preload-file data
LINKER_FLAGS += -s FORCE_FILESYSTEM=1
endif
endif

###################################################
# Create a MacOS X bundle application.
#
ifeq ($(ARCHI),Darwin)
BUILD_MACOS_APP_BUNDLE = 1
APPLE_IDENTIFIER = lecrapouille
MACOS_BUNDLE_ICON = data/TimedPetriNetEditor.icns
LINKER_FLAGS += -framework CoreFoundation
ifeq ($(OS),Emscripten)
ifndef EXAEQUOS
LINKER_FLAGS += --preload-file $(PROJECT_DATA_DIR)
LINKER_FLAGS += -s FORCE_FILESYSTEM=1
endif
endif

###################################################
# Stand-alone application.
# Generic Makefile rules
#
include $(P)/src/Editor/DearImGui/Makefile.imgui
LINKER_FLAGS += -ldl -lpthread
VPATH += $(P)/include $(P)/src $(P)/src/Utils $(P)/src/Net
VPATH += $(P)/src/Net/Imports VPATH += $(P)/src/Net/Exports
INCLUDES += -I$(P)/include -I$(P)/src -I$(P)/external
OBJS += main.o
include $(M)/rules/Makefile

###################################################
# Compile the stand-alone application
.PHONY: all
all: $(TARGET) copy-emscripten-assets

###################################################
# Internal libraries
# Compile internal librairies in the correct order
#
LIB_TPNE_CORE = $(abspath $(P)/$(BUILD)/libtimedpetrinetcore.a)
LIB_TPNE_GUI = $(abspath $(P)/$(BUILD)/libtimedpetrinetgui.a)
LIB_TPNE_JULIA = $(abspath $(P)/$(BUILD)/libtimedpetrinetjulia.a)
THIRDPART_LIBS += $(LIB_TPNE_CORE) $(LIB_TPNE_GUI) $(LIB_TPNE_JULIA)
DIRS_WITH_MAKEFILE := src/Editor src/Net src/julia
$(LIB_TPNE_NET): $(P)/src/Net

$(LIB_TPNE_GUI): src/Editor
$(LIB_TPNE_EDITOR): $(P)/src/Editor

$(LIB_TPNE_CORE): src/Net
$(LIB_TPNE_JULIA): $(P)/src/julia

$(LIB_TPNE_JULIA): src/julia
$(P)/src/julia: $(P)/src/Editor

src/julia: src/Editor

src/Editor: src/Net
$(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)
Expand All @@ -104,51 +94,4 @@ ifeq ($(ARCHI),Emscripten)
@cp $(P)/data/examples/*.json $(BUILD)/examples
@cp $(P)/data/font.ttf $(BUILD)/data
@cp $(P)/data/imgui.ini $(BUILD)/data
endif

###################################################
# Compile and launch unit tests and generate the code coverage html report.
.PHONY: unit-tests
unit-tests:
@$(call print-simple,"Compiling unit tests")
@$(MAKE) -C tests coverage

###################################################
# Compile and launch unit tests and generate the code coverage html report.
.PHONY: check
check: unit-tests

###################################################
# Install project. You need to be root.
.PHONY: install
install: $(TARGET)
@$(call INSTALL_BINARY)
ifeq ($(EXAEQUOS),)
@$(MAKE) --no-print-directory -C src/Net install
@$(MAKE) --no-print-directory -C src/Editor install
@$(MAKE) --no-print-directory -C src/julia install
@$(call INSTALL_DOCUMENTATION)
@$(call INSTALL_PROJECT_HEADERS)
endif

###################################################
# Clean the whole project.
.PHONY: veryclean
veryclean: clean
@rm -fr cov-int $(PROJECT).tgz *.log foo 2> /dev/null
@(cd tests && $(MAKE) -s clean)
@$(call print-simple,"Cleaning","$(PWD)/doc/html")
@rm -fr $(THIRDPART)/*/ doc/html 2> /dev/null

###################################################
# Sharable informations between all Makefiles
#
include $(M)/Makefile.footer

###################################################
# Override clean the project
.PHONY: clean
clean::
@$(MAKE) --no-print-directory -C src/Net clean
@$(MAKE) --no-print-directory -C src/Editor clean
@$(MAKE) --no-print-directory -C src/julia clean
endif
21 changes: 5 additions & 16 deletions Makefile.common
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
###################################################
# Project definition
#
PROJECT = TimedPetriNetEditor
STANDARD = --std=c++14
BUILD_TYPE = release
PROJECT_NAME := TimedPetriNetEditor
PROJECT_VERSION := 0.4.0
COMPILATION_MODE := debug
CXX_STANDARD := --std=c++14

###################################################
# Select the Dear ImGui backend: RayLib or GLFW3.
#
DEAR_IMGUI_BACKEND ?= RayLib

###################################################
# Reduce warnings
#
CCFLAGS += -Wno-sign-conversion -Wno-float-equal
CXXFLAGS += -Wno-undef -Wno-switch-enum -Wno-enum-compare
CXXFLAGS += -Wshadow

###################################################
# Project defines
#
DEFINES += -DDATADIR=\"$(DATADIR):$(abspath $(P))/data/:data/\"
DEAR_IMGUI_BACKEND ?= GLFW3
1 change: 0 additions & 1 deletion VERSION.txt

This file was deleted.

10 changes: 5 additions & 5 deletions external/compile-external-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
### $CXX: C++ compiler
###############################################################################

source ../.makefile/compile-external-libs.sh
source $1

### Library raylib
print-compile raylib
Expand All @@ -39,11 +39,11 @@ print-compile raylib
# Note: Concerning .backup see https://www.themoderncoder.com/fix-sed-i-error-macos/
sed -i.backup 's/ExportImage(image, path)/ExportImage(image, fileName)/g' rcore.c

mkdir -p $ARCHI
mkdir -p $OS
call-make clean
if [ "$ARCHI" != "Emscripten" ]; then
call-make PLATFORM=PLATFORM_DESKTOP RAYLIB_RELEASE_PATH=$ARCHI RAYLIB_BUILD_MODE=DEBUG
if [ "$OS" != "Emscripten" ]; then
call-make PLATFORM=PLATFORM_DESKTOP RAYLIB_RELEASE_PATH=$OS RAYLIB_BUILD_MODE=DEBUG
else
call-make PLATFORM=PLATFORM_WEB RAYLIB_RELEASE_PATH=$ARCHI
call-make PLATFORM=PLATFORM_WEB RAYLIB_RELEASE_PATH=$OS
fi
)
2 changes: 1 addition & 1 deletion external/download-external-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### It replaces git submodules that I dislike.
###############################################################################

source ../.makefile/download-external-libs.sh
source $1

### Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
### License: MIT
Expand Down
6 changes: 3 additions & 3 deletions src/Editor/DearImGui/Backends/GLFW3/Application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
#ifndef APPLICATION_HPP
# define APPLICATION_HPP

#include "imgui.h"
#include "imgui/imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include "imgui/misc/cpp/imgui_stdlib.h"
#include "implot.h"
#include "ImGuiFileDialog.h"
#include "implot/implot.h"
#include "ImGuiFileDialog/ImGuiFileDialog.h"
#include <GLFW/glfw3.h>

//------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit ef1d74b

Please sign in to comment.