Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version: 2.1

orbs:
win: circleci/windows@5.0 # The Windows orb gives you everything you need to start using the

jobs:
build-linux-gcc:
machine:
Expand Down Expand Up @@ -39,7 +42,16 @@ jobs:
- run: chmod u+x run_tests.sh && ./run_tests.sh clang
- store_artifacts:
path: ./Release/Darwin/erpcgen/erpcgen

build-windows-mingw:
executor:
name: win/default
size: large
steps:
- checkout
- run: powershell.exe .\install_dependencies.ps1
- run: powershell.exe .\mingw64\bin\mingw32-make erpcgen
- store_artifacts:
path: ./Release/MINGW64/erpcgen/erpcgen.exe

workflows:
build-workflow:
Expand All @@ -48,3 +60,4 @@ workflows:
- build-linux-clang
- build-mac-gcc
- build-mac-clang
- build-windows-mingw
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,7 @@ format-files-to-commit.rb
language\.settings\.xml
*.vsix
null.d
boost.7z
boost*/
mingw.7z
mingw64/
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,21 @@ test-serial: $(TESTDIR)
.PHONY: fresh
fresh: clean all

# define clean_fun
# $(warning "$(at)$(POWERSHELL) "if (Test-Path $(1)) { $(rmc) $(1) }"")
# $(at)$(POWERSHELL) 'if (Test-Path $(1)) { $(rmc) $(1) }'
# endef

# Target to clean everything.
.PHONY: clean
clean::
@echo "Deleting output directories..."
@rm -rf Debug Release
@rm -rf out*.*
@rm -rf erpc_outputs
@$(rmc) Debug Release
@$(rmc) out*.*
@$(rmc) erpc_outputs
# @$(call clean_fun,Debug,)
# @$(call clean_fun,Release,)
# @$(call clean_fun,erpc_outputs,)
@echo "done."

# Process subdirs
Expand Down
10 changes: 5 additions & 5 deletions erpc_c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ endif

$(TARGET_LIB)(%): %
@$(call printmessage,ar,Archiving, $(?F) in $(@F))
$(at)mkdir -p $(dir $(@))
$(at)$(mkdirc) -p $(dir $(@))
$(AR) $(ARFLAGS) $@ $?

.PHONY: install
Expand All @@ -130,17 +130,17 @@ install: install_headers install_lib
.PHONY: install_headers
install_headers: $(HEADERS) | $(INC_INSTALL_DIR)
@$(call printmessage,c,Installing, headers in $(INC_INSTALL_DIR))
$(at)mkdir -p $(INC_INSTALL_DIR)
$(at)$(mkdirc) -p $(INC_INSTALL_DIR)
$(at)install $(?) $(INC_INSTALL_DIR)

$(INC_INSTALL_DIR):
$(at)mkdir -p $(INC_INSTALL_DIR)
$(at)$(mkdirc) -p $(INC_INSTALL_DIR)

.PHONY: install_lib
install_lib: $(TARGET_LIB)
@$(call printmessage,c,Installing, $(subst $(LIBS_ROOT)/,,$<) in $(LIB_INSTALL_DIR))
$(at)mkdir -p $(LIB_INSTALL_DIR)
$(at)$(mkdirc) -p $(LIB_INSTALL_DIR)
$(at)install $(TARGET_LIB) $(LIB_INSTALL_DIR)

clean::
$(at)rm -rf $(OBJS_ROOT)/*.cpp $(OBJS_ROOT)/*.hpp $(OBJS_ROOT)/*.c
$(at)$(rmc) $(OBJS_ROOT)/*.cpp $(OBJS_ROOT)/*.hpp $(OBJS_ROOT)/*.c
20 changes: 7 additions & 13 deletions erpcgen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ INCLUDES += $(ERPC_ROOT) \
$(OBJS_ROOT)

ifeq "$(is_mingw)" "1"
INCLUDES += $(ERPC_ROOT)/windows
INCLUDES += $(VISUAL_STUDIO_ROOT)
endif

SOURCES += $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
Expand Down Expand Up @@ -85,15 +85,6 @@ SOURCES += $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
$(OBJS_ROOT)/erpcgen/src/templates/py_coders.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_global_init.c

ifeq "$(is_mingw)" "1"
SOURCES += $(ERPC_ROOT)/erpcgen/VisualStudio_v14/c_common_header.cpp \
$(ERPC_ROOT)/erpcgen/VisualStudio_v14/c_client_source.cpp \
$(ERPC_ROOT)/erpcgen/VisualStudio_v14/c_server_header.cpp \
$(ERPC_ROOT)/erpcgen/VisualStudio_v14/c_server_source.cpp \
$(ERPC_ROOT)/erpcgen/VisualStudio_v14/c_coders.cpp \
$(ERPC_ROOT)/erpcgen/VisualStudio_v14/c_common_functions.cpp \
$(OBJS_ROOT)/erpcgen/src/templates/c_crc.cpp
else
SOURCES += $(OBJS_ROOT)/erpcgen/src/templates/c_common_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_client_source.c \
$(OBJS_ROOT)/erpcgen/src/templates/c_server_header.c \
Expand All @@ -108,7 +99,6 @@ SOURCES += $(OBJS_ROOT)/erpcgen/src/templates/c_common_header.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_interface.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_coders.c \
$(OBJS_ROOT)/erpcgen/src/templates/py_global_init.c
endif

OBJECT_DEP := $(OBJS_ROOT)/erpcgen_lexer.cpp

Expand All @@ -122,6 +112,10 @@ ifeq "$(build)" "release"
endif
endif

ifeq "$(is_mingw)" "1"
CXXFLAGS += -DBOOST_FILESYSTEM_VERSION=4
endif

# Run flex
$(OBJS_ROOT)/erpcgen_lexer.cpp: $(ERPC_ROOT)/erpcgen/src/erpcgen_lexer.l $(OBJS_ROOT)/erpcgen_parser.tab.hpp | $(OBJECTS_DIRS)
@$(call printmessage,orange,Generating, $(subst $(ERPC_ROOT)/,,$<))
Expand All @@ -142,8 +136,8 @@ $(OBJS_ROOT)/%.c: $(ERPC_ROOT)/%.template
.PHONY: install
install: $(MAKE_TARGET)
@$(call printmessage,c,Installing, erpcgen in $(BIN_INSTALL_DIR))
$(at)mkdir -p $(BIN_INSTALL_DIR)
$(at)$(mkdirc) -p $(BIN_INSTALL_DIR)
$(at)install $(MAKE_TARGET) $(BIN_INSTALL_DIR)

clean::
$(at)rm -rf $(OBJS_ROOT)/*.cpp $(OBJS_ROOT)/*.hpp $(OBJS_ROOT)/*.c
$(at)$(rmc) $(OBJS_ROOT)/*.cpp $(OBJS_ROOT)/*.hpp $(OBJS_ROOT)/*.c
2 changes: 2 additions & 0 deletions erpcgen/VisualStudio_v14/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ win_bison.exe
win_flex.exe
README.txt
.vs
changelog.md
README.md

#boost libraries
boost_*
2 changes: 1 addition & 1 deletion erpcgen/VisualStudio_v14/erpcgen.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down
3 changes: 2 additions & 1 deletion erpcgen/VisualStudio_v14/readme_erpcgen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Requirements
2. Win flex-bison

Direct link to the latests win flex-bison release download:
[https://sourceforge.net/projects/winflexbison]
[https://sourceforge.net/projects/winflexbison/files/win_flex_bison3-latest.zip/download]


Extract win flex-bison zip contents directly into the erpc/erpcgen/VisualStudio_v14 directory
(not into a subdirectory).
Expand Down
4 changes: 2 additions & 2 deletions erpcgen/src/cpptemplate/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ all: cpptempl_test
.PHONY: clean
clean:
@echo "Cleaning output..."
@rm -rf *.o
@rm -rf *.d
@$(rmc) *.o
@$(rmc) *.d
@rm -f $(TARGET)

.PHONY: test testv
Expand Down
6 changes: 3 additions & 3 deletions erpcsniffer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ INCLUDES += $(ERPC_ROOT) \
$(OBJS_ROOT)

ifeq "$(is_mingw)" "1"
INCLUDES += $(ERPC_ROOT)/windows
INCLUDES += $(VISUAL_STUDIO_ROOT)
endif

SOURCES += $(OBJS_ROOT)/erpcgen_parser.tab.cpp \
Expand Down Expand Up @@ -103,8 +103,8 @@ $(OBJS_ROOT)/erpcgen_parser.tab.hpp: $(ERPC_ROOT)/erpcgen/src/erpcgen_parser.y |
.PHONY: install
install: $(MAKE_TARGET)
@$(call printmessage,c,Installing, erpcsniffer in $(BIN_INSTALL_DIR))
$(at)mkdir -p $(BIN_INSTALL_DIR)
$(at)$(mkdirc) -p $(BIN_INSTALL_DIR)
$(at)install $(MAKE_TARGET) $(BIN_INSTALL_DIR)

clean::
$(at)rm -rf $(OBJS_ROOT)/*.cpp $(OBJS_ROOT)/*.hpp $(OBJS_ROOT)/*.c
$(at)$(rmc) $(OBJS_ROOT)/*.cpp $(OBJS_ROOT)/*.hpp $(OBJS_ROOT)/*.c
49 changes: 49 additions & 0 deletions install_dependencies.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Binson/flex
Set-Location ".\erpcgen\VisualStudio_v14"
$PatHBisonFlex7Zip=".\win_flex_bison.zip"
$PatHBisonFlex="win_flex_bison"
Remove-Item -ErrorAction Ignore $PatHBisonFlex7Zip
Remove-Item -ErrorAction Ignore -Recurse $PatHBisonFlex
Remove-Item -ErrorAction Ignore -Recurse ".\custom_build_rules"
Remove-Item -ErrorAction Ignore -Recurse ".\data"
Remove-Item -ErrorAction Ignore -Recurse ".\changelog.md"
Remove-Item -ErrorAction Ignore -Recurse ".\FlexLexer.h"
Remove-Item -ErrorAction Ignore -Recurse ".\README.md"
Remove-Item -ErrorAction Ignore -Recurse ".\win_bison.exe"
Remove-Item -ErrorAction Ignore -Recurse ".\win_flex.exe"
$URLBisonFlex = "https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip"
Invoke-WebRequest -URI $URLBisonFlex -OutFile $PatHBisonFlex7Zip
Expand-Archive -Path $PatHBisonFlex7Zip
$PatHBisonFlexFull= ".\"+$PatHBisonFlex+"\*"
Move-Item -Path $PatHBisonFlexFull -Destination .\ -force
Remove-Item -ErrorAction Ignore $PatHBisonFlex7Zip
# Remove-Item -ErrorAction Ignore -Recurse $PatHBisonFlex
Set-Location "..\..\"

if ($args[0] -eq "VS")
{
# winget install --id=Microsoft.VisualStudio.2019.BuildTools -e
# & 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe' .\erpcgen\VisualStudio_v14\erpcgen.sln /property:Configuration=Release
}
else
{
# Install 7zip
$URL7Zip = "https://gist.githubusercontent.com/dansmith65/7dd950f183af5f5deaf9650f2ad3226c/raw/8b8f6e96de7469cea73c9fe63a5da4d44a7c1ba7/Install-7zip.ps1"
$Path7Zip = ".\Install-7zip.ps1"
Remove-Item -ErrorAction Ignore $Path7Zip
Invoke-WebRequest -URI $URL7Zip -OutFile $Path7Zip
powershell $Path7Zip
Remove-Item -ErrorAction Ignore $Path7Zip
$Path7zipApp="C:\Program Files\7-Zip\7z.exe"

# Install mingw
$URLMingw = "https://github.com/niXman/mingw-builds-binaries/releases/download/12.2.0-rt_v10-rev2/x86_64-12.2.0-release-win32-seh-ucrt-rt_v10-rev2.7z"
$PathMingw7Zip = "mingw.7z"
$PathMingw = "mingw64"
$UnzipMingw = 'x',$PathMingw7Zip,'-y'
Remove-Item -ErrorAction Ignore $PathMingw7Zip
Remove-Item -ErrorAction Ignore -Recurse $PathMingw
Invoke-WebRequest -URI $URLMingw -OutFile $PathMingw7Zip
& $Path7zipApp $UnzipMingw
Remove-Item -ErrorAction Ignore $PathMingw7Zip
}
35 changes: 20 additions & 15 deletions mk/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,31 @@ space := $(empty) $(empty)
# Get the OS name. Known values are "Linux", "CYGWIN_NT-5.1", and "Darwin".
os_name := $(shell uname -s)

# Set to 1 if running on Darwin.
is_darwin := $(and $(findstring Darwin,$(os_name)),1)

# Set to 1 if running on cygwin.
is_cygwin := $(and $(findstring CYGWIN,$(os_name)),1)

# Set to 1 if running on mingw.
ifeq "$(os_name)" ""
is_mingw := 1
os_name = MINGW
MAKE := mingw32-make
os_name := $(shell powershell [System.Environment]::OSVersion.Version)
ifneq "$(os_name)" ""
is_mingw := 1
endif
else
is_mingw := 0
endif
# Set to 1 if running on Darwin.
is_darwin := $(and $(findstring Darwin,$(os_name)),1)

# Set to 1 if running on cygwin.
is_cygwin := $(and $(findstring CYGWIN,$(os_name)),1)

# Set to 1 if running on redhat.
is_redhat := $(shell if [ -f /etc/redhat-release ]; then echo 1 ; fi)
# Set to 1 if running on redhat.
is_redhat := $(shell if [ -f /etc/redhat-release ]; then echo 1 ; fi)

# Set to 1 if running on Linux.
is_linux := $(and $(findstring Linux,$(os_name)),1)
# Set to 1 if running on Linux.
is_linux := $(and $(findstring Linux,$(os_name)),1)

is_mingw := $(and $(findstring MSYS_NT,$(os_name)),1)
endif

ifeq "$(is_mingw)" "1"
os_name = MINGW64
endif

#-------------------------------------------------------------------------------
# Logging options
Expand Down
25 changes: 19 additions & 6 deletions mk/paths.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ CUR_DIR := $(notdir $(CURDIR))
OUTPUT_ROOT := $(ERPC_ROOT)
TEST_ROOT := $(ERPC_ROOT)/test

ifeq "$(is_mingw)" "1"
VISUAL_STUDIO_ROOT ?= $(ERPC_ROOT)/erpcgen/VisualStudio_v14
MINGW64 ?= $(ERPC_ROOT)/mingw64
export PATH := $(MINGW64):$(MINGW64)/bin:$(PATH)
CC = gcc
CXX = g++
endif

TARGET_OUTPUT_ROOT = $(OUTPUT_ROOT)/$(DEBUG_OR_RELEASE)/$(os_name)/$(APP_NAME)
MAKE_TARGET = $(TARGET_OUTPUT_ROOT)/$(APP_NAME)

Expand All @@ -45,9 +53,11 @@ INC_INSTALL_DIR = $(PREFIX)/include/erpc
# ----------------------------------------------

ERPCGEN ?= $(OUTPUT_ROOT)/$(DEBUG_OR_RELEASE)/$(os_name)/erpcgen/erpcgen
LD := $(CXX)
LD = $(CXX)
PYTHON ?= python
ifeq (, $(shell which $(PYTHON)))
ifeq "$(is_mingw)" "1"
PYTHON=$(MINGW64)/opt/bin/python3
else ifeq (, $(shell which $(PYTHON)))
PYTHON=python3
ifeq (, $(shell which $(PYTHON)))
$(error "No python found. Please install python3.")
Expand Down Expand Up @@ -80,14 +90,17 @@ else ifeq "$(is_cygwin)" "1"
FLEX ?= /bin/flex
BISON ?= /bin/bison
else ifeq "$(is_mingw)" "1"
FLEX ?= $(ERPC_ROOT)/erpcgen/VisualStudio_v14/win_flex.exe
BISON ?= $(ERPC_ROOT)/erpcgen/VisualStudio_v14/win_bison.exe
FLEX ?= $(VISUAL_STUDIO_ROOT)/win_flex.exe
BISON ?= $(VISUAL_STUDIO_ROOT)/win_bison.exe
endif

ifeq "$(is_mingw)" "1"
mkdirc = C:\MinGW\msys\1.0\bin\mkdir.exe
CC+=gcc
MAKE := $(MINGW64)/bin/mingw32-make
POWERSHELL ?= powershell
mkdirc = $(POWERSHELL) mkdir -Force
rmc = $(POWERSHELL) rm -Recurse -Force -ErrorAction Ignore
else
rmc = rm -rf
mkdirc = mkdir
endif

Expand Down
2 changes: 1 addition & 1 deletion mk/targets.mk
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ endif
.PHONY: clean
clean::
@echo "Cleaning $(APP_NAME)"
$(at)rm -rf $(OBJECTS_ALL) $(OBJECTS_DIRS) $(MAKE_TARGET)
$(at)$(rmc) $(OBJECTS_ALL) $(OBJECTS_DIRS) $(MAKE_TARGET)

# Include dependency files.
-include $(OBJECTS_ALL:.o=.d)
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ test-serial: all

clean::
@echo "Cleaning test results..."
@rm -rf results
@$(rmc) results

include $(ERPC_ROOT)/mk/subdirs.mk
2 changes: 1 addition & 1 deletion test/mk/test_lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ include $(ERPC_ROOT)/mk/targets.mk

$(TARGET_LIB)(%): %
@$(call printmessage,ar,Archiving, $(?F) in $(@F))
$(at)mkdir -p $(dir $(@))
$(at)$(mkdirc) -p $(dir $(@))
$(AR) $(ARFLAGS) $@ $?
4 changes: 2 additions & 2 deletions test/mk/unit_test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ clean: clean_serial clean_tcp

clean_tcp:
@echo Cleaning $(TEST_NAME)_tcp...
@rm -rf $(UT_OUTPUT_DIR)/$(os_name)/tcp
@$(rmc) $(UT_OUTPUT_DIR)/$(os_name)/tcp

clean_serial:
@echo Cleaning $(TEST_NAME)_serial...
@rm -rf $(UT_OUTPUT_DIR)/$(os_name)/serial
@$(rmc) $(UT_OUTPUT_DIR)/$(os_name)/serial