Skip to content

Commit fcff3ee

Browse files
authored
Som devel (#1)
* interim * interim * interim * interim * docopts just work * docopts just work * docopts shells * progress * progress * corrections @ covbr2html * progress * interim * ready for dev
1 parent 6c53922 commit fcff3ee

File tree

17 files changed

+466
-133
lines changed

17 files changed

+466
-133
lines changed

.gitHooks/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ done
3131

3232
if [[ -n $txts ]]; then
3333
echo cleaning text files
34-
$py $sompy/cleanTxt.py -l $txts
34+
$py $sompy/cleanTxt.py $txts
3535
fi
3636
for file in $txts; do git add $file; done

.github/workflows/c-cpp.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# ============================================================
2+
# continuous integration setup
3+
# ============================================================
4+
# created by Manfred Sorgo
5+
name: C/C++ CI
6+
7+
on:
8+
push:
9+
branches: [ "dev", "release" ]
10+
pull_request:
11+
branches: [ "dev", "release" ]
12+
13+
jobs:
14+
buildApp:
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: "Checkout repository"
20+
uses: actions/checkout@v3
21+
with:
22+
submodules: 'true'
23+
24+
- name: build
25+
run: cd make; make clean; make -j config=ci

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ build
55
*.vcxproj.*
66
.vscode
77
.vs
8-
*.make
9-
Makefile
8+
# *.make
9+
# Makefile
10+
tmp.*
11+
tmp
1012

1113
# Prerequisites
1214
*.d

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# somcpp
2-
commonly used c++ code
2+
3+
- commonly used c++ code
4+
- build sources for
5+
- docopts
6+
- fglob

include/SOM/docOpts.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define DOCOPTS_H
44

55
#include <SOM/BaseTypes.h>
6+
#include <SOM/coding.h>
67
#include <map>
78
#include <set>
89
class DocOpts
@@ -19,7 +20,7 @@ class DocOpts
1920
void reset();
2021
CONST_C_STRING* args() const { return mArgs; }
2122
INT32 argc() const { return mArgc; }
22-
void toCmd() const;
23+
void toShell() const;
2324
const std::set<CHAR>& activeSwitches() const { return mSwitches; }
2425
private:
2526
std::map<CHAR, CONST_C_STRING> mValues;
@@ -30,5 +31,7 @@ class DocOpts
3031
CONST_C_STRING* mArgs = nullptr;
3132
INT32 mArgc = 0;
3233
void rmArgs();
34+
35+
NOCOPY(DocOpts)
3336
};
3437
#endif // _H

include/SOM/fio.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@
88

99
bool read(std::string& target, CONST_C_STRING file, bool err=true);
1010

11+
inline bool read(std::string& target, const std::string& file, bool err=true)
12+
{
13+
return read(target, file.c_str(), err);
14+
}
15+
1116
bool checkos(const std::ofstream& os, CONST_C_STRING file);
1217

13-
inline bool checkos(const std::ofstream& os, std::string& file)
18+
inline bool checkos(const std::ofstream& os, const std::string& file)
1419
{
1520
return checkos(os, file.c_str());
1621
}

include/SOM/pyregex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ namespace py
3838
};
3939
}
4040

41-
#endif // _H
41+
#endif // _H

make/Makefile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Alternative GNU Make workspace makefile autogenerated by Premake
2+
3+
ifndef config
4+
config=ci
5+
endif
6+
7+
ifndef verbose
8+
SILENT = @
9+
endif
10+
11+
ifeq ($(config),ci)
12+
docopts_config = ci
13+
fglob_config = ci
14+
15+
else ifeq ($(config),trace_on)
16+
docopts_config = trace_on
17+
fglob_config = trace_on
18+
19+
else ifeq ($(config),trace_all)
20+
docopts_config = trace_all
21+
fglob_config = trace_all
22+
23+
else
24+
$(error "invalid configuration $(config)")
25+
endif
26+
27+
PROJECTS := docopts fglob
28+
29+
.PHONY: all clean help $(PROJECTS)
30+
31+
all: $(PROJECTS)
32+
33+
docopts:
34+
ifneq (,$(docopts_config))
35+
@echo "==== Building docopts ($(docopts_config)) ===="
36+
@${MAKE} --no-print-directory -C . -f docopts.make config=$(docopts_config)
37+
endif
38+
39+
fglob:
40+
ifneq (,$(fglob_config))
41+
@echo "==== Building fglob ($(fglob_config)) ===="
42+
@${MAKE} --no-print-directory -C . -f fglob.make config=$(fglob_config)
43+
endif
44+
45+
clean:
46+
@${MAKE} --no-print-directory -C . -f docopts.make clean
47+
@${MAKE} --no-print-directory -C . -f fglob.make clean
48+
49+
help:
50+
@echo "Usage: make [config=name] [target]"
51+
@echo ""
52+
@echo "CONFIGURATIONS:"
53+
@echo " ci"
54+
@echo " trace_on"
55+
@echo " trace_all"
56+
@echo ""
57+
@echo "TARGETS:"
58+
@echo " all (default)"
59+
@echo " clean"
60+
@echo " docopts"
61+
@echo " fglob"
62+
@echo ""
63+
@echo "For more information, see https://github.com/premake/premake-core/wiki"

make/docopts.make

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Alternative GNU Make project makefile autogenerated by Premake
2+
3+
ifndef config
4+
config=ci
5+
endif
6+
7+
ifndef verbose
8+
SILENT = @
9+
endif
10+
11+
.PHONY: clean prebuild
12+
13+
SHELLTYPE := posix
14+
ifeq ($(shell echo "test"), "test")
15+
SHELLTYPE := msdos
16+
endif
17+
18+
# Configurations
19+
# #############################################
20+
21+
RESCOMP = windres
22+
TARGETDIR = ../build
23+
TARGET = $(TARGETDIR)/docopts
24+
INCLUDES += -I../include
25+
FORCE_INCLUDE +=
26+
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
27+
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Os -std=c++17 -O3 -pedantic-errors -Wall
28+
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Os -std=c++17 -O3 -pedantic-errors -Wall
29+
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
30+
LIBS +=
31+
LDDEPS +=
32+
ALL_LDFLAGS += $(LDFLAGS) -s
33+
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
34+
define PREBUILDCMDS
35+
endef
36+
define PRELINKCMDS
37+
endef
38+
define POSTBUILDCMDS
39+
endef
40+
41+
ifeq ($(config),ci)
42+
OBJDIR = ../build/linux/ci/ci/docopts
43+
DEFINES += -DNDEBUG
44+
45+
else ifeq ($(config),trace_on)
46+
OBJDIR = ../build/linux/trace_on/trace_on/docopts
47+
DEFINES += -DNDEBUG -DTRACE_ON
48+
49+
else ifeq ($(config),trace_all)
50+
OBJDIR = ../build/linux/trace_all/trace_all/docopts
51+
DEFINES += -DNDEBUG -DTRACE_ALL
52+
53+
endif
54+
55+
# Per File Configurations
56+
# #############################################
57+
58+
59+
# File sets
60+
# #############################################
61+
62+
GENERATED :=
63+
OBJECTS :=
64+
65+
GENERATED += $(OBJDIR)/docOpts.o
66+
GENERATED += $(OBJDIR)/docOptsMain.o
67+
GENERATED += $(OBJDIR)/fio.o
68+
OBJECTS += $(OBJDIR)/docOpts.o
69+
OBJECTS += $(OBJDIR)/docOptsMain.o
70+
OBJECTS += $(OBJDIR)/fio.o
71+
72+
# Rules
73+
# #############################################
74+
75+
all: $(TARGET)
76+
@:
77+
78+
$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR)
79+
$(PRELINKCMDS)
80+
@echo Linking docopts
81+
$(SILENT) $(LINKCMD)
82+
$(POSTBUILDCMDS)
83+
84+
$(TARGETDIR):
85+
@echo Creating $(TARGETDIR)
86+
ifeq (posix,$(SHELLTYPE))
87+
$(SILENT) mkdir -p $(TARGETDIR)
88+
else
89+
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
90+
endif
91+
92+
$(OBJDIR):
93+
@echo Creating $(OBJDIR)
94+
ifeq (posix,$(SHELLTYPE))
95+
$(SILENT) mkdir -p $(OBJDIR)
96+
else
97+
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
98+
endif
99+
100+
clean:
101+
@echo Cleaning docopts
102+
ifeq (posix,$(SHELLTYPE))
103+
$(SILENT) rm -f $(TARGET)
104+
$(SILENT) rm -rf $(GENERATED)
105+
$(SILENT) rm -rf $(OBJDIR)
106+
else
107+
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
108+
$(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED))
109+
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
110+
endif
111+
112+
prebuild: | $(OBJDIR)
113+
$(PREBUILDCMDS)
114+
115+
ifneq (,$(PCH))
116+
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
117+
$(GCH): $(PCH) | prebuild
118+
@echo $(notdir $<)
119+
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
120+
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
121+
ifeq (posix,$(SHELLTYPE))
122+
$(SILENT) touch "$@"
123+
else
124+
$(SILENT) echo $null >> "$@"
125+
endif
126+
else
127+
$(OBJECTS): | prebuild
128+
endif
129+
130+
131+
# File Rules
132+
# #############################################
133+
134+
$(OBJDIR)/docOptsMain.o: ../runtime/docOptsMain.cpp
135+
@echo "$(notdir $<)"
136+
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
137+
$(OBJDIR)/docOpts.o: ../src/docOpts.cpp
138+
@echo "$(notdir $<)"
139+
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
140+
$(OBJDIR)/fio.o: ../src/fio.cpp
141+
@echo "$(notdir $<)"
142+
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
143+
144+
-include $(OBJECTS:%.o=%.d)
145+
ifneq (,$(PCH))
146+
-include $(PCH_PLACEHOLDER).d
147+
endif

0 commit comments

Comments
 (0)