Skip to content

Commit

Permalink
Som devel (#1)
Browse files Browse the repository at this point in the history
* interim

* interim

* interim

* interim

* docopts just work

* docopts just work

* docopts shells

* progress

* progress

* corrections @ covbr2html

* progress

* interim

* ready for dev
  • Loading branch information
sorgom authored Nov 6, 2024
1 parent 6c53922 commit fcff3ee
Show file tree
Hide file tree
Showing 17 changed files with 466 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .gitHooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ done

if [[ -n $txts ]]; then
echo cleaning text files
$py $sompy/cleanTxt.py -l $txts
$py $sompy/cleanTxt.py $txts
fi
for file in $txts; do git add $file; done
25 changes: 25 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ============================================================
# continuous integration setup
# ============================================================
# created by Manfred Sorgo
name: C/C++ CI

on:
push:
branches: [ "dev", "release" ]
pull_request:
branches: [ "dev", "release" ]

jobs:
buildApp:

runs-on: ubuntu-latest

steps:
- name: "Checkout repository"
uses: actions/checkout@v3
with:
submodules: 'true'

- name: build
run: cd make; make clean; make -j config=ci
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ build
*.vcxproj.*
.vscode
.vs
*.make
Makefile
# *.make
# Makefile
tmp.*
tmp

# Prerequisites
*.d
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# somcpp
commonly used c++ code

- commonly used c++ code
- build sources for
- docopts
- fglob
5 changes: 4 additions & 1 deletion include/SOM/docOpts.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define DOCOPTS_H

#include <SOM/BaseTypes.h>
#include <SOM/coding.h>
#include <map>
#include <set>
class DocOpts
Expand All @@ -19,7 +20,7 @@ class DocOpts
void reset();
CONST_C_STRING* args() const { return mArgs; }
INT32 argc() const { return mArgc; }
void toCmd() const;
void toShell() const;
const std::set<CHAR>& activeSwitches() const { return mSwitches; }
private:
std::map<CHAR, CONST_C_STRING> mValues;
Expand All @@ -30,5 +31,7 @@ class DocOpts
CONST_C_STRING* mArgs = nullptr;
INT32 mArgc = 0;
void rmArgs();

NOCOPY(DocOpts)
};
#endif // _H
7 changes: 6 additions & 1 deletion include/SOM/fio.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@

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

inline bool read(std::string& target, const std::string& file, bool err=true)
{
return read(target, file.c_str(), err);
}

bool checkos(const std::ofstream& os, CONST_C_STRING file);

inline bool checkos(const std::ofstream& os, std::string& file)
inline bool checkos(const std::ofstream& os, const std::string& file)
{
return checkos(os, file.c_str());
}
Expand Down
2 changes: 1 addition & 1 deletion include/SOM/pyregex.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ namespace py
};
}

#endif // _H
#endif // _H
63 changes: 63 additions & 0 deletions make/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Alternative GNU Make workspace makefile autogenerated by Premake

ifndef config
config=ci
endif

ifndef verbose
SILENT = @
endif

ifeq ($(config),ci)
docopts_config = ci
fglob_config = ci

else ifeq ($(config),trace_on)
docopts_config = trace_on
fglob_config = trace_on

else ifeq ($(config),trace_all)
docopts_config = trace_all
fglob_config = trace_all

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

PROJECTS := docopts fglob

.PHONY: all clean help $(PROJECTS)

all: $(PROJECTS)

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

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

clean:
@${MAKE} --no-print-directory -C . -f docopts.make clean
@${MAKE} --no-print-directory -C . -f fglob.make clean

help:
@echo "Usage: make [config=name] [target]"
@echo ""
@echo "CONFIGURATIONS:"
@echo " ci"
@echo " trace_on"
@echo " trace_all"
@echo ""
@echo "TARGETS:"
@echo " all (default)"
@echo " clean"
@echo " docopts"
@echo " fglob"
@echo ""
@echo "For more information, see https://github.com/premake/premake-core/wiki"
147 changes: 147 additions & 0 deletions make/docopts.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Alternative GNU Make project makefile autogenerated by Premake

ifndef config
config=ci
endif

ifndef verbose
SILENT = @
endif

.PHONY: clean prebuild

SHELLTYPE := posix
ifeq ($(shell echo "test"), "test")
SHELLTYPE := msdos
endif

# Configurations
# #############################################

RESCOMP = windres
TARGETDIR = ../build
TARGET = $(TARGETDIR)/docopts
INCLUDES += -I../include
FORCE_INCLUDE +=
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Os -std=c++17 -O3 -pedantic-errors -Wall
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Os -std=c++17 -O3 -pedantic-errors -Wall
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
LIBS +=
LDDEPS +=
ALL_LDFLAGS += $(LDFLAGS) -s
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
define PREBUILDCMDS
endef
define PRELINKCMDS
endef
define POSTBUILDCMDS
endef

ifeq ($(config),ci)
OBJDIR = ../build/linux/ci/ci/docopts
DEFINES += -DNDEBUG

else ifeq ($(config),trace_on)
OBJDIR = ../build/linux/trace_on/trace_on/docopts
DEFINES += -DNDEBUG -DTRACE_ON

else ifeq ($(config),trace_all)
OBJDIR = ../build/linux/trace_all/trace_all/docopts
DEFINES += -DNDEBUG -DTRACE_ALL

endif

# Per File Configurations
# #############################################


# File sets
# #############################################

GENERATED :=
OBJECTS :=

GENERATED += $(OBJDIR)/docOpts.o
GENERATED += $(OBJDIR)/docOptsMain.o
GENERATED += $(OBJDIR)/fio.o
OBJECTS += $(OBJDIR)/docOpts.o
OBJECTS += $(OBJDIR)/docOptsMain.o
OBJECTS += $(OBJDIR)/fio.o

# Rules
# #############################################

all: $(TARGET)
@:

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

$(TARGETDIR):
@echo Creating $(TARGETDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(TARGETDIR)
else
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
endif

$(OBJDIR):
@echo Creating $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) mkdir -p $(OBJDIR)
else
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
endif

clean:
@echo Cleaning docopts
ifeq (posix,$(SHELLTYPE))
$(SILENT) rm -f $(TARGET)
$(SILENT) rm -rf $(GENERATED)
$(SILENT) rm -rf $(OBJDIR)
else
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
$(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED))
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
endif

prebuild: | $(OBJDIR)
$(PREBUILDCMDS)

ifneq (,$(PCH))
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
$(GCH): $(PCH) | prebuild
@echo $(notdir $<)
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
ifeq (posix,$(SHELLTYPE))
$(SILENT) touch "$@"
else
$(SILENT) echo $null >> "$@"
endif
else
$(OBJECTS): | prebuild
endif


# File Rules
# #############################################

$(OBJDIR)/docOptsMain.o: ../runtime/docOptsMain.cpp
@echo "$(notdir $<)"
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/docOpts.o: ../src/docOpts.cpp
@echo "$(notdir $<)"
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
$(OBJDIR)/fio.o: ../src/fio.cpp
@echo "$(notdir $<)"
$(SILENT) $(CXX) $(ALL_CXXFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"

-include $(OBJECTS:%.o=%.d)
ifneq (,$(PCH))
-include $(PCH_PLACEHOLDER).d
endif
Loading

0 comments on commit fcff3ee

Please sign in to comment.