Skip to content

Commit

Permalink
Merge pull request #24 from mac-can/development
Browse files Browse the repository at this point in the history
Release candidate 1 for version 0.3.4
  • Loading branch information
mac-can authored Jun 11, 2024
2 parents b625b38 + c4ac73d commit e8fb32f
Show file tree
Hide file tree
Showing 110 changed files with 11,286 additions and 2,648 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Auto detect text files and perform LF normalization
* text=auto

# Never modify line endings of bash scripts
*.sh text eol=lf
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

30 changes: 12 additions & 18 deletions Deployment.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
### macOS® User-Space Driver for USB CAN Interfaces from Kvaser

_Copyright © 2020-2023 Uwe Vogt, UV Software, Berlin ([email protected])_ \
_Copyright © 2017-2024 Uwe Vogt, UV Software, Berlin ([email protected])_ \
_All rights reserved._

# Deployment
# Deployment Rules

## Create the Release Candidate

Expand All @@ -26,36 +26,30 @@ _All rights reserved._
- `Update CAN API V3 testing sources to rev. `_nnn_ \
`- `_list of major changes (optional)_
4. Check and update the version and date information in the following files:
- `$(PROJROOT)/Sources/KvaserCAN.h`
- `$(PROJROOT)/Sources/KvaserCAN.cpp`
- `$(PROJROOT)/Sources/Wrapper/can_api.c`
- `$(PROJROOT)/Sources/Version.h`
- `$(PROJROOT)/Sources/Swift/CANAPI.swift`
- `$(PROJROOT)/Libraries/CANAPI/Makefile`<sup>*</sup>
- `$(PROJROOT)/Libraries/KvaserCAN/Makefile`<sup>*</sup>
- `$(PROJROOT)/Utilities/can_moni/Driver.h`
- `$(PROJROOT)/Utilities/can_moni/Makefile`
- `$(PROJROOT)/Utilities/can_moni/README.md`
- `$(PROJROOT)/Utilities/can_test/Driver.h`
- `$(PROJROOT)/Utilities/can_test/Makefile`
- `$(PROJROOT)/Utilities/can_test/README.md`

<sup>*</sup>_) Set variable_ `CURRENT_VERSION` _and_ `COMPATIBILITY_VERSION` _accordingly._

### Procedure

1. Check the working directory for uncommitted changes.
1. Check the working folders for uncommitted changes.
- _**There should not be any uncommitted changes.**_
- _If there are uncommitted changes then commit or undo them._
2. Open the trial program with Xcode and run a code analysis.
- _**There should not be any serious finding.**_
- _If there are findings then fix them or create an issue in the repo._
3. Select the Xcode Testing target and run all test cases:
3. Select the Xcode Testing target and run all test cases (two device are required):
- _**There should be no failed test case.**_
- _If there are failed tests then fix the root cause or define a workaround._
4. Open the SPM configuration with Xcode and check for errors:
- _**There should be absolutelys no package manager error!**_
- _**There should be absolutely no package manager error!**_
- _If there are package manager warnings then think twice._
5. Run the `Makefile` in the project root directory with option `BINARY=UNIVERSAL`.
5. Run the `Makefile` in the project root folder with option `BINARY=UNIVERSAL`.
- _**There should be absolutely no compiler or linker error!**_
- _If there are compiler or linker warnings then really think twice._
6. Try out the trial program with different options.
Expand All @@ -82,15 +76,15 @@ _All rights reserved._

1. Pull or clone the default branch on all development systems.
2. Double check all version numbers again (see above).
3. Run the `Makefile` in the project root directory:
3. Run the `Makefile` in the project root folder:
- `uv-pc013mac:~ eris$ cd $(PROJROOT)`
- `uv-pc013mac:KvaserCAN eris$ make pristine`
- `uv-pc013mac:KvaserCAN eris$ make BINARY=UNIVERSAL`
- `uv-pc013mac:KvaserCAN eris$ make test`
- `uv-pc013mac:KvaserCAN eris$ sudo make install`
4. Build the CAN API V3 GoogleTest program:
- `uv-pc013mac:~ eris$ cd $(PROJROOT)/Tests/CANAPI`
- `uv-pc013mac:CANAPI eris$ make pristine`
- `uv-pc013mac:CANAPI eris$ make clean`
- `uv-pc013mac:CANAPI eris$ make all`
5. Run the CAN API V3 GoogleTest program with the CAN Leaf Pro device and another CAN FD device from Kvaser:
- `uv-pc013mac:CANAPI eris$ ./kvl_testing --can_dut1="Kvaser CAN Channel 0" --can_dut2="Kvaser CAN Channel 1" --gtest_output=xml:TestReport_LeafPro.xml --run_all=YES --smoketest_frames=100000 --can_mode=FDF+BRS --can_bitrate=DEFAULT` [...]
Expand All @@ -99,7 +93,7 @@ _All rights reserved._
6. Run the CAN API V3 GoogleTest program with the CAN Leaf Light device and another CAN device from Kvaser:
- `uv-pc013mac:CANAPI eris$ ./kvl_testing --can_dut1="Kvaser CAN Channel 1" --can_dut2="Kvaser CAN Channel 0" --gtest_output=xml:TestReport_LeafLight.xml --run_all=YES --smoketest_frames=100000` [...]
- _If there is any error then **stop** here or create an issue for each error in the repo._
- Copy the test report into the binary's directory `$(PROJROOT)/Binaries`.
- Copy the test report into the binary's folder `$(PROJROOT)/Binaries`.
7. Pack the artifacts into a .zip-archive, e.g. `artifacts.zip`:
- `$(PROJROOT)/Binaries/*.*`
- `$(PROJROOT)/Includes/*.*`
Expand All @@ -111,9 +105,9 @@ _All rights reserved._

1. Click on `Draft a new release` in the [GitHub](https://github.com/mac-can/MacCAN-KvaserCAN) repo.
2. Fill out all required fields:
- Tag version: e.g `v0.3.3` (cf. semantic versioning)
- Tag version: e.g `v0.3.4` (cf. semantic versioning)
- Target: `main` (default branch)
- Release title: e.g. `Release of November 11, 2023`
- Release title: e.g. `Release of January 19, 2038`
- Change-log: list all major changes, e.g. from commit comments
- Assets: drag and drop the artifacts archive (see above)
3. Click on `Publish release`.
Expand Down
88 changes: 47 additions & 41 deletions Libraries/CANAPI/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# CAN Interface API, Version 3 (for Kvaser CAN Interfaces)
# KvaserCAN - macOS User-Space Driver for Kvaser USB CAN Interfaces
#
# Copyright (c) 2017-2023 Uwe Vogt, UV Software, Berlin ([email protected])
# Copyright (c) 2017-2024 Uwe Vogt, UV Software, Berlin ([email protected])
# All rights reserved.
#
# This file is part of MacCAN-KvaserCAN.
Expand Down Expand Up @@ -42,14 +42,25 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MacCAN-KvaserCAN. If not, see <http://www.gnu.org/licenses/>.
# along with MacCAN-KvaserCAN. If not, see <https://www.gnu.org/licenses/>.
#
current_OS := $(shell sh -c 'uname 2>/dev/null || echo Unknown OS')
current_OS := $(patsubst CYGWIN%,Cygwin,$(current_OS))
current_OS := $(patsubst MINGW%,MinGW,$(current_OS))
current_OS := $(patsubst MSYS%,MinGW,$(current_OS))

MAJOR = 0
MINOR = 3
PATCH = 4

ifeq ($(PATCH),0)
VERSION = $(MAJOR).$(MINOR)
else
VERSION = $(MAJOR).$(MINOR).$(PATCH)
endif

HOME_DIR = ../..
MAIN_DIR = .

SOURCE_DIR = $(HOME_DIR)/Sources
CANAPI_DIR = $(HOME_DIR)/Sources/CANAPI
Expand All @@ -64,29 +75,7 @@ OBJECTS = $(OUTDIR)/KvaserCAN_Driver.o \
$(OUTDIR)/MacCAN_MsgQueue.o $(OUTDIR)/MacCAN_MsgPipe.o \
$(OUTDIR)/can_api.o $(OUTDIR)/can_btr.o


ifeq ($(current_OS),Darwin) # macOS - libUVCANKVL.dylib

PROJECT = UVCANKVL
LIBRARY = lib$(PROJECT)

MAJOR = 0
MINOR = 3
PATCH = 3

VERSION = $(MAJOR).$(MINOR).$(PATCH)
TARGET = $(LIBRARY).$(VERSION).dylib
STATIC = $(LIBRARY).a

INSTALL_NAME = @rpath/$(TARGET)
CURRENT_VERSION = $(MAJOR).$(MINOR).$(PATCH)
COMPATIBILITY_VERSION = $(MAJOR).$(MINOR).0

INSTALL = /usr/local/lib

INCLUDE = /usr/local/include

DEFINES = -DOPTION_CANAPI_KVASERCAN_DYLIB=1 \
DEFINES = -DOPTION_CAN_2_0_ONLY=0 \
-DOPTION_CANAPI_DRIVER=1 \
-DOPTION_CANAPI_RETVALS=1 \
-DOPTION_CANAPI_COMPANIONS=1 \
Expand All @@ -105,23 +94,37 @@ HEADERS = -I$(SOURCE_DIR) \
-I$(DRIVER_DIR) \
-I$(WRAPPER_DIR)


ifeq ($(current_OS),Darwin) # macOS - libUVCANKVL.dylib

PROJECT = UVCANKVL
LIBRARY = lib$(PROJECT)

TARGET = $(LIBRARY).$(VERSION).dylib
STATIC = $(LIBRARY).a

INSTALL_NAME = $(TARGET)
CURRENT_VERSION = $(MAJOR).$(MINOR).$(PATCH)
COMPATIBILITY_VERSION = $(MAJOR).$(MINOR).0

INSTALL = /usr/local/lib

DEFINES += -DOPTION_CANAPI_KVASERCAN_DYLIB=1

CFLAGS += -O2 -Wall -Wextra -Wno-parentheses \
-fmessage-length=0 -fno-strict-aliasing \
-fno-strict-aliasing \
$(DEFINES) \
$(HEADERS)

CXXFLAGS += -O2 -g -Wall -Wextra -pthread \
$(DEFINES) \
$(HEADERS)

LIBRARIES =

LDFLAGS += -lpthread \
-nostartfiles -dynamiclib -fvisibility=hidden \
-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation \
-Wl,-install_name,$(INSTALL_NAME) \
LDFLAGS += -nostartfiles -dynamiclib -fvisibility=hidden \
-Wl,-install_name,@rpath/$(INSTALL_NAME) \
-Wl,-current_version,$(CURRENT_VERSION) \
-Wl,-compatibility_version,$(COMPATIBILITY_VERSION)
-Wl,-compatibility_version,$(COMPATIBILITY_VERSION) \
-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation

LTFLAGS += -static

Expand All @@ -131,6 +134,8 @@ CXXFLAGS += -arch arm64 -arch x86_64
LDFLAGS += -arch arm64 -arch x86_64
endif

LIBRARIES = -lpthread

CXX = clang++
CC = clang
LD = clang
Expand Down Expand Up @@ -166,6 +171,7 @@ incdir:
@cp $(SOURCE_DIR)/KvaserCAN_Defines.h $(INCDIR)
@cp $(SOURCE_DIR)/KvaserCAN_Defaults.h $(INCDIR)
@cp $(CANAPI_DIR)/can_api.h $(INCDIR)
@cp $(CANAPI_DIR)/can_btr.h $(INCDIR)
@cp $(CANAPI_DIR)/CANAPI_Types.h $(INCDIR)
@cp $(CANAPI_DIR)/CANAPI_Defines.h $(INCDIR)
@cp $(CANAPI_DIR)/CANBTR_Defaults.h $(INCDIR)
Expand All @@ -186,6 +192,12 @@ ifeq ($(current_OS),Darwin)
endif


$(OUTDIR)/can_api.o: $(WRAPPER_DIR)/can_api.c
$(CC) $(CFLAGS) -MMD -MF $*.d -o $@ -c $<

$(OUTDIR)/can_btr.o: $(CANAPI_DIR)/can_btr.c
$(CC) $(CFLAGS) -MMD -MF $*.d -o $@ -c $<

$(OUTDIR)/KvaserCAN_Driver.o: $(DRIVER_DIR)/KvaserCAN_Driver.c
$(CC) $(CFLAGS) -MMD -MF $*.d -o $@ -c $<

Expand Down Expand Up @@ -216,15 +228,9 @@ $(OUTDIR)/MacCAN_MsgPipe.o: $(MACCAN_DIR)/MacCAN_MsgPipe.c
$(OUTDIR)/MacCAN_Debug.o: $(MACCAN_DIR)/MacCAN_Debug.c
$(CC) $(CFLAGS) -MMD -MF $*.d -o $@ -c $<

$(OUTDIR)/can_api.o: $(WRAPPER_DIR)/can_api.c
$(CC) $(CFLAGS) -MMD -MF $*.d -o $@ -c $<

$(OUTDIR)/can_btr.o: $(CANAPI_DIR)/can_btr.c
$(CC) $(CFLAGS) -MMD -MF $*.d -o $@ -c $<


$(STATIC): $(OBJECTS)
$(LT) $(LTFLAGS) -o $@ $(OBJECTS) $(LIBRARIES)
$(LT) $(LTFLAGS) -o $@ $(OBJECTS)
$(CP) $@ $(BINDIR)
@lipo -archs $@
@echo "\033[1mTarget '"$@"' successfully build\033[0m"
Expand Down
Loading

0 comments on commit e8fb32f

Please sign in to comment.