Skip to content

Commit

Permalink
Som devel (#73)
Browse files Browse the repository at this point in the history
* readme & make

* update

* cloc update
  • Loading branch information
sorgom authored Nov 20, 2024
1 parent 636f916 commit 026f2fb
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 123 deletions.
22 changes: 11 additions & 11 deletions CLOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C++ 14 145 25 1127
C/C++ Header 17 159 148 691
C++ 15 145 26 1146
C/C++ Header 20 187 182 840
-------------------------------------------------------------------------------
SUM: 31 304 173 1818
SUM: 35 332 208 1986
-------------------------------------------------------------------------------
```
**testenv**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C/C++ Header 24 218 175 1122
C++ 9 37 0 217
C/C++ Header 24 222 181 1134
C++ 9 35 0 228
-------------------------------------------------------------------------------
SUM: 33 255 175 1339
SUM: 33 257 181 1362
-------------------------------------------------------------------------------
```
**moduletests**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C++ 14 290 299 2376
C++ 15 297 314 2468
-------------------------------------------------------------------------------
SUM: 14 290 299 2376
SUM: 15 297 314 2468
-------------------------------------------------------------------------------
```
**systemtests**
Expand All @@ -46,8 +46,8 @@ SUM: 2 14 22 117
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C/C++ Header 14 85 142 346
C/C++ Header 14 92 140 365
-------------------------------------------------------------------------------
SUM: 14 85 142 346
SUM: 14 92 140 365
-------------------------------------------------------------------------------
```
```
34 changes: 17 additions & 17 deletions make/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ ifeq ($(config),ci)
dstw_runtime_config = ci
systemtests_config = ci
dstw_stop_config = ci
gcov_app_config = ci
gcov_tests_config = ci
gcovapp_config = ci
gcovtests_config = ci

else ifeq ($(config),debug)
cpputest_config = debug
Expand All @@ -27,14 +27,14 @@ else ifeq ($(config),debug)
dstw_runtime_config = debug
systemtests_config = debug
dstw_stop_config = debug
gcov_app_config = debug
gcov_tests_config = debug
gcovapp_config = debug
gcovtests_config = debug

else
$(error "invalid configuration $(config)")
endif

PROJECTS := cpputest moduletests devtests dstw_gen dstw_runtime systemtests dstw_stop gcov_app gcov_tests
PROJECTS := cpputest moduletests devtests dstw_gen dstw_runtime systemtests dstw_stop gcovapp gcovtests

.PHONY: all clean help $(PROJECTS)

Expand Down Expand Up @@ -82,16 +82,16 @@ ifneq (,$(dstw_stop_config))
@${MAKE} --no-print-directory -C . -f dstw_stop.make config=$(dstw_stop_config)
endif

gcov_app:
ifneq (,$(gcov_app_config))
@echo "==== Building gcov_app ($(gcov_app_config)) ===="
@${MAKE} --no-print-directory -C . -f gcov_app.make config=$(gcov_app_config)
gcovapp:
ifneq (,$(gcovapp_config))
@echo "==== Building gcovapp ($(gcovapp_config)) ===="
@${MAKE} --no-print-directory -C . -f gcovapp.make config=$(gcovapp_config)
endif

gcov_tests: gcov_app cpputest
ifneq (,$(gcov_tests_config))
@echo "==== Building gcov_tests ($(gcov_tests_config)) ===="
@${MAKE} --no-print-directory -C . -f gcov_tests.make config=$(gcov_tests_config)
gcovtests: gcovapp cpputest
ifneq (,$(gcovtests_config))
@echo "==== Building gcovtests ($(gcovtests_config)) ===="
@${MAKE} --no-print-directory -C . -f gcovtests.make config=$(gcovtests_config)
endif

clean:
Expand All @@ -102,8 +102,8 @@ clean:
@${MAKE} --no-print-directory -C . -f dstw_runtime.make clean
@${MAKE} --no-print-directory -C . -f systemtests.make clean
@${MAKE} --no-print-directory -C . -f dstw_stop.make clean
@${MAKE} --no-print-directory -C . -f gcov_app.make clean
@${MAKE} --no-print-directory -C . -f gcov_tests.make clean
@${MAKE} --no-print-directory -C . -f gcovapp.make clean
@${MAKE} --no-print-directory -C . -f gcovtests.make clean

help:
@echo "Usage: make [config=name] [target]"
Expand All @@ -122,7 +122,7 @@ help:
@echo " dstw_runtime"
@echo " systemtests"
@echo " dstw_stop"
@echo " gcov_app"
@echo " gcov_tests"
@echo " gcovapp"
@echo " gcovtests"
@echo ""
@echo "For more information, see https://github.com/premake/premake-core/wiki"
102 changes: 28 additions & 74 deletions make/README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,45 @@
# how to build and run
## gcc
### build.sh
**build & 1st run**

requires
- make
- gcc

call help
## linux make / gcc
### simple make
````shell
DSTW/make$> ./build.sh -h
DSTW/make$> make clean
DSTW/make$> make -j
````
then call to build and run, e.g.
- find binaries in build/linux/bin folder
````shell
DSTW/make$> ./build.sh -cr
DSTW/make$> cd ../build/linux/bin
DSTW/build/linux/bin$> ls
````
### runGcov.sh
**check coverage**

requires
- gcov
- (coverage binary has run)

call help
### buildAndRun.sh
````shell
DSTW/make$> ./runGcov.sh -h
DSTW/make$> ./buildAndRun.sh
````
then call to check coverage, e.g.
### run gcov
````shell
DSTW/make$> ./runGcov.sh -s
DSTW/make$> ./runGcov.sh
````

### runSystemTests.sh
**run system tests**

requires
- gcov
- binaries built

### buid & run system tests
````shell
DSTW/make$> ./runSystemTests.sh
````
## msbuild / visual studio
- requires [premake5](https://premake.github.io/)

## Visual Studio build
### preconditions
- [premake5](https://premake.github.io/) available
- Visual Studio

### 1) generate VS solution using premake5
#### 1.1) find out suitable VS version using premake5 --help

### create solution for your VS version
````shell
D:\git\DSTW\make> premake5 --help
Usage: premake5 [options] action [arguments]

OPTIONS - General
--file=FILE Read FILE as a Premake script; default is 'premake5.lua'

ACTIONS
vs2005 Generate Visual Studio 2005 project files
...
vs2022 Generate Visual Studio 2022 project files
DSTW\make> premake5 --help
DSTW\make> premake5 vsNNNN
````
#### 1.2) generate solution with your VS version
e.g. VS 2019
### just build
````shell
D:\git\DSTW\make> premake5 --file=premake5_vs.lua vs2019
Building configurations...
Running action 'vs2019'...
Generated tests.sln...
...
Done (143ms).
DSTW\make> msbuild -m dstw.sln
````
- find binaries in build/windows folder
````shell
DSTW\make> cd ../build/windows
DSTW\build\windows> dir /B *.exe
````
### build & run system tests
````shell
DSTW\make> ./runSystemTests.cmd
````
### 2) build executables in VS
#### 2.1) build and run module tests
- open _tests.sln_
- build and run

#### 2.2) build and run system tests
- open _dstw_system.sln_
- build
- run _runSystemTests.cmd_ e.g. from Powershell

```powershell
PS ...\DSTW\make> .\runSystemTests.cmd
```

### 3) VS keyboard shortcuts
- build: [CTRL] [shift] [B]
- (build and) run: [CTRL] [F5]
10 changes: 5 additions & 5 deletions make/gcov_app.make → make/gcovapp.make
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endif

RESCOMP = windres
TARGETDIR = ../build/linux/lib
TARGET = $(TARGETDIR)/libgcov_app.a
TARGET = $(TARGETDIR)/libgcovapp.a
INCLUDES += -I../testing/testenv -I../submodules/cpputest/include -I../submodules/CppUTestSteps/TestSteps/include -I../specification -I../application/components
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
Expand All @@ -36,14 +36,14 @@ define POSTBUILDCMDS
endef

ifeq ($(config),ci)
OBJDIR = ../build/linux/obj/ci/gcov_app
OBJDIR = ../build/linux/obj/ci/gcovapp
DEFINES += -DNDEBUG
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -std=c++17 -pedantic-errors -Werror -Wall -fprofile-arcs -ftest-coverage
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -std=c++17 -pedantic-errors -Werror -Wall -fprofile-arcs -ftest-coverage
ALL_LDFLAGS += $(LDFLAGS) -L../build/linux/lib -s -pthread

else ifeq ($(config),debug)
OBJDIR = ../build/linux/obj/debug/gcov_app
OBJDIR = ../build/linux/obj/debug/gcovapp
DEFINES += -DDEBUG
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -std=c++17 -pedantic-errors -Werror -Wall -fprofile-arcs -ftest-coverage
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -std=c++17 -pedantic-errors -Werror -Wall -fprofile-arcs -ftest-coverage
Expand Down Expand Up @@ -98,7 +98,7 @@ all: $(TARGET)

$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR)
$(PRELINKCMDS)
@echo Linking gcov_app
@echo Linking gcovapp
$(SILENT) $(LINKCMD)
$(POSTBUILDCMDS)

Expand All @@ -119,7 +119,7 @@ else
endif

clean:
@echo Cleaning gcov_app
@echo Cleaning gcovapp
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(GENERATED)
Expand Down
14 changes: 7 additions & 7 deletions make/gcov_tests.make → make/gcovtests.make
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ endif

RESCOMP = windres
TARGETDIR = ../build/linux/bin
TARGET = $(TARGETDIR)/gcov_tests
TARGET = $(TARGETDIR)/gcovtests
INCLUDES += -I../testing/testenv -I../submodules/cpputest/include -I../submodules/CppUTestSteps/TestSteps/include -I../specification -I../application/components
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS += ../build/linux/lib/libgcov_app.a ../build/linux/lib/libcpputest.a -lgcov
LDDEPS += ../build/linux/lib/libgcov_app.a ../build/linux/lib/libcpputest.a
LIBS += ../build/linux/lib/libgcovapp.a ../build/linux/lib/libcpputest.a -lgcov
LDDEPS += ../build/linux/lib/libgcovapp.a ../build/linux/lib/libcpputest.a
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
Expand All @@ -36,14 +36,14 @@ define POSTBUILDCMDS
endef

ifeq ($(config),ci)
OBJDIR = ../build/linux/obj/ci/gcov_tests
OBJDIR = ../build/linux/obj/ci/gcovtests
DEFINES += -DNDEBUG -DCPPUTEST_USE_LONG_LONG=0
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -std=c++17 -pedantic-errors -Werror -Wall
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -std=c++17 -pedantic-errors -Werror -Wall
ALL_LDFLAGS += $(LDFLAGS) -L../build/linux/lib -s -pthread --coverage

else ifeq ($(config),debug)
OBJDIR = ../build/linux/obj/debug/gcov_tests
OBJDIR = ../build/linux/obj/debug/gcovtests
DEFINES += -DDEBUG -DCPPUTEST_USE_LONG_LONG=0
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -std=c++17 -pedantic-errors -Werror -Wall
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -std=c++17 -pedantic-errors -Werror -Wall
Expand Down Expand Up @@ -122,7 +122,7 @@ all: $(TARGET)

$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR)
$(PRELINKCMDS)
@echo Linking gcov_tests
@echo Linking gcovtests
$(SILENT) $(LINKCMD)
$(POSTBUILDCMDS)

Expand All @@ -143,7 +143,7 @@ else
endif

clean:
@echo Cleaning gcov_tests
@echo Cleaning gcovtests
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(GENERATED)
Expand Down
10 changes: 6 additions & 4 deletions make/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ files_moduletest = { '../testing/tests/moduletests/**.cpp' }
workspace 'DSTW'
configurations { 'ci', 'debug' }
language 'C++'
targetdir '../build/%{_TARGET_OS}/bin'
targetdir '../build/%{_TARGET_OS}'
objdir '../build/%{_TARGET_OS}/obj'
kind 'ConsoleApp'
libdirs { '../build/%{_TARGET_OS}/lib' }

filter { 'action:vs*' }
targetdir '../build/%{_TARGET_OS}'
buildoptions { buildoptions_vs_test }
links { 'ws2_32' }
warnings 'high'

filter { 'action:gmake*' }
targetdir '../build/%{_TARGET_OS}/bin'
buildoptions { buildoptions_gcc }
linkoptions { '-pthread' }

Expand Down Expand Up @@ -143,7 +145,7 @@ workspace 'DSTW'
}
includedirs { includedirs_test }

project 'gcov_app'
project 'gcovapp'
filter { 'action:vs*' }

filter { 'action:gmake*' }
Expand All @@ -153,12 +155,12 @@ workspace 'DSTW'
files { files_app }
buildoptions {'-fprofile-arcs -ftest-coverage' }

project 'gcov_tests'
project 'gcovtests'
filter { 'action:vs*' }

filter { 'action:gmake*' }
files { files_testenv, files_moduletest }
includedirs { includedirs_test }
defines { defines_test }
links { 'gcov_app', 'gcov', 'cpputest' }
links { 'gcovapp', 'gcov', 'cpputest' }
linkoptions { '--coverage' }
Loading

0 comments on commit 026f2fb

Please sign in to comment.