Make JabyEngine compile to Linux

This commit is contained in:
jaby 2022-04-24 15:24:47 +02:00
parent 7dac721f10
commit c746fecf6e
2 changed files with 91 additions and 0 deletions

79
Code/NewMakefile Normal file
View File

@ -0,0 +1,79 @@
ARTIFACT = JabyEngine
#Build architecture/variant string, possible values: x86, armv7le, etc...
PLATFORM ?= x86_64
#Build profile, possible values: release, debug, profile, coverage
BUILD_PROFILE ?= debug
CONFIG_NAME ?= $(PLATFORM)-$(BUILD_PROFILE)
OUTPUT_DIR = build/$(CONFIG_NAME)
TARGET = $(OUTPUT_DIR)/$(ARTIFACT)
#Compiler definitions
CC = gcc
CXX = g++
LD = $(CXX)
#User defined include/preprocessor flags and libraries
INCLUDES += -I../../../INCLUDE/
INCLUDES += -I../../../LLVM/Include
INCLUDES += -I../../../../ExecutionEnvironment/EXTERNAL/INCLUDE
INCLUDES += -I../WindowsRuntime/Include
LIB_DEPS_NAMES = Qt_Obj
LIB_DEPS_PATHES = ../QtXTObj/build/$(CONFIG_NAME)-Qt_Obj
#LIBS += -lsocket
#LIBS += -liconv
#Compiler flags for build profiles
CCFLAGS_release += -g -O3
CCFLAGS_debug += -g -O0 -fno-builtin
#Generic compiler flags (which include build type flags) -fcompare-debug-second
# v for now v v
CCFLAGS_all += -DTCP_SERVER -Wall -Wno-unused-variable -Wno-unused-but-set-variable -fmessage-length=0 -std=gnu++2a -Wno-unused-function -fcompare-debug-second
CCFLAGS_all += -march=skylake
CCFLAGS_all += $(CCFLAGS_$(BUILD_PROFILE))
LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE))
LIBS_all += $(LIBS_$(BUILD_PROFILE))
DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@
#Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp
rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2))
#Source list
SRCS = $(call rwildcard, src, c cpp)
#Object files list
OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(basename $(SRCS))))
#Compiling rule
$(OUTPUT_DIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) -c $(DEPS) -o $@ $(INCLUDES) $(CCFLAGS_all) $(CCFLAGS) $<
$(OUTPUT_DIR)/%.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) -c $(DEPS) -o $@ $(INCLUDES) $(CCFLAGS_all) $(CCFLAGS) $<
#Linking rule
$(TARGET):$(OBJS) $(call pairmap,make-lib-dep,$(LIB_DEPS_PATHES),$(LIB_DEPS_NAMES))
$(LD) -o $(TARGET) $(LDFLAGS_all) $(LDFLAGS) $(OBJS) $(LIBS_all) $(LIBS)
#Rules section for default compilation and linking
all: $(TARGET)
clean:
rm -fr $(OUTPUT_DIR)
rebuild:
$(MAKE) clean
$(MAKE) all
#Inclusion of dependencies (object files to source and includes)
-include $(OBJS:%.o=%.d)

View File

@ -37,6 +37,18 @@
"isDefault": true "isDefault": true
} }
}, },
{
"label": "Blubb",
"type": "shell",
"command": "wsl make -f NewMakefile BUILD_PROFILE=release",
"options": {
"cwd": "Code"
},
"group": {
"kind": "build",
"isDefault": true
}
}
], ],
"inputs": [ "inputs": [
{ {