diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 40af0dd..93a0d6f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -45,8 +45,8 @@ jobs: # run: wget -h # WELL: NOT installed! (So much about lots of download actions on the marketplace...) - - name: Install prerequisites (wget...) - run: choco install wget +# - name: Install prerequisites (wget...) +# run: choco install wget - name: Setup SFML... shell: cmd diff --git a/.gitignore b/.gitignore index e063df8..98bf37e 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,7 @@ import/ cache/ *.sav + +extern/* +!extern/sfw/ +extern/sfw/lib/msvc/*-d.lib diff --git a/Makefile b/Makefile deleted file mode 100644 index 5bcae32..0000000 --- a/Makefile +++ /dev/null @@ -1,305 +0,0 @@ -.SUFFIXES: .cpp .obj .ixx .ifc .exe - -#!!?? Adding these actually botched the build by always processing clean, too, -#!!?? after building everything! :D -#!!??.PHONY: MAIN clean - -## Order matters! Inference rules first! Also, as NMAKE only processes the first -## root-level tartet if none was named on the command line: higher-level targets -## must be described before dependent target rules! - -# Cfg. macros, can be overridden from the make (build) cmdline: -# -# LINKMODE=static -# LINKMODE=dll -# -# DEBUG=1 -# DEBUG=0 (-> release) -# -# Macros set on the MAKE cmdline will override these defaults: -CRTMODE=MD -LINKMODE=static -DEBUG=0 - -# Support my "legacy" env. var names: -prjdir=$(SZ_PRJDIR) -src_dir=$(SZ_SRC_DIR) -out_dir=$(SZ_OUT_DIR) -appname=$(SZ_APPNAME) - - -!if "$(src_dir)" == "" || "$(out_dir)" == "" -!error - Build env. not properly initialized. Use `build.cmd`! -!endif - -EXE=$(out_dir)/$(appname).exe - -# Changing the Makefile ($(MAKEFILE)) should trigger a full rebuild. -#!! I'm sure there's a better way for this, but for now: -FULL_REBUILD_TRIGGER=$(OBJS) $(CPP_MODULE_IFCS) - -# The existing actual source subdir(s) should/will match the obj. subdir(s): -World_subdir=Model -View_subdir=View -Platform_subdir=Platform -UI_subdir=UI -#! Note however, about CL /Fo (i.e. "Fuk output subdirs"): -#! "The specified directory must exist, or the compiler reports error D8003. -#! The directory isn't created automatically." -#! -#! GCC could do it all right, without a hitch. Just sayin... - -#!! Kludge until I find out the correct way: -#!! Also done manually, coz no way to track the actual deps automatically...: -CPP_MODULE_IFCS=\ - $(out_dir)/Storage.ifc \ - -OBJS=\ - $(out_dir)/Storage.obj \ - $(out_dir)/main.obj \ - $(out_dir)/SimApp.obj \ - $(out_dir)/OON.obj \ - $(out_dir)/OON_sfml.obj \ - $(out_dir)/$(World_subdir)/Physics.obj \ - $(out_dir)/$(World_subdir)/Object.obj \ - $(out_dir)/$(World_subdir)/World.obj \ - $(out_dir)/$(View_subdir)/render_sfml.obj \ - $(out_dir)/$(UI_subdir)/hud_sfml.obj \ - $(out_dir)/$(UI_subdir)/TGUI-Clipping.obj \ - $(out_dir)/$(UI_subdir)/Input.obj \ - $(out_dir)/audio_sfml.obj \ - -INCLUDES=$(src_dir)/*.hpp $(src_dir)/*.h \ - $(src_dir)/$(World_subdir)/*.hpp \ - $(src_dir)/$(View_subdir)/*.hpp \ - $(src_dir)/$(UI_subdir)/*.hpp \ - $(src_dir)/$(UI_subdir)/adapter/SFML/*.hpp \ -# $(src_dir)/$(Platform_subdir)/*.hpp \ - $(src_dir)/adapter/SFML/*.hpp \ - $(src_dir)/sz/*.hh \ - - -#!!Ugh... A little hamfisted; see #118! -CPP_MODULE_SOURCES=$(src_dir)/*.ixx - - -#!!Should be adjusted to match the build options! -EXT_LIBS=\ - extern/sfw/lib/msvc/sfw-$(CRTMODE).lib \ - extern/zstd/msvc/zstd-$(CRTMODE).lib \ - -#----------------------------------------------------------------------------- -#CC_FLAGS=$(CC_FLAGS) -nologo -CC_FLAGS=$(CC_FLAGS) -W4 -std:c++latest -$(CRTMODE) -EHsc -c -# For GH #15 (don't rely on manually including cfg.h): -CC_FLAGS=$(CC_FLAGS) -FI cfg.h - -CC_OUTDIR_FLAGS_=-Fo$(out_dir)/ -Fd$(out_dir)/ -#! Mind the trailing '_': -CC_FLAGS_=$(CC_FLAGS) $(CC_OUTDIR_FLAGS_) - -CC_OUTDIR_FLAGS_World=-Fo$(out_dir)/$(World_subdir)/ -Fd$(out_dir)/$(World_subdir)/ -CC_OUTDIR_FLAGS_View=-Fo$(out_dir)/$(View_subdir)/ -Fd$(out_dir)/$(View_subdir)/ -CC_OUTDIR_FLAGS_UI=-Fo$(out_dir)/$(UI_subdir)/ -Fd$(out_dir)/$(UI_subdir)/ -CC_FLAGS_World=$(CC_FLAGS) $(CC_OUTDIR_FLAGS_World) -CC_FLAGS_View=$(CC_FLAGS) $(CC_OUTDIR_FLAGS_View) -CC_FLAGS_UI=$(CC_FLAGS) $(CC_OUTDIR_FLAGS_UI) - -#!! No subdirs for modules yet: -CC_FLAGS_CPPMODULES= -ifcOutput $(out_dir)/ -ifcSearchDir $(out_dir)/ - -CC_CMD=cl -nologo -LINK_CMD=link -nologo -#!!?? Why does this not do anything useful: -# LINK_CMD=link /LTCG:INCREMENTAL -# Assuming being called from a script that has already set the path: -BB=busybox -ECHO=@$(BB) echo -MKDIR=$(BB) mkdir -p - -MAKEFILE=$(prjdir)/Makefile - -BUILD_OPT_LABEL=OPTION: - -# Linkmode alternatives: -CC_FLAGS_LINK_static=-DSFML_STATIC -CC_FLAGS_LINK_dll= -#!!NMAKE doesn't seem to support macros in macro names, so we have to dance the !ifs... :-/ -#CC_FLAGS_LINKMODE=$(CC_FLAGS_$(CC_FLAGS_LINKMODE)) -!if "$(LINKMODE)" == "static" -CC_FLAGS_LINKMODE=$(CC_FLAGS_LINK_static) -!else if "$(LINKMODE)" == "dll" -CC_FLAGS_LINKMODE=$(CC_FLAGS_LINK_dll) -!else -!error Unknown link mode: $(LINKMODE)! -!endif - -LIBS_static=\ - sfml-graphics-s.lib sfml-window-s.lib sfml-system-s.lib \ - sfml-audio-s.lib ogg.lib vorbis.lib vorbisenc.lib vorbisfile.lib flac.lib openal32.lib \ - opengl32.lib freetype.lib vorbis.lib vorbisfile.lib \ - user32.lib kernel32.lib gdi32.lib winmm.lib advapi32.lib -LIBS_dll=\ - sfml-graphics.lib sfml-window.lib sfml-system.lib \ - sfml-audio.lib ogg.lib vorbis.lib vorbisenc.lib vorbisfile.lib flac.lib openal32.lib \ - opengl32.lib -#!!sigh... LIBS=$(LIBS$(LINKMODE)) -!if "$(LINKMODE)" == "static" -LIBS=$(LIBS_static) -!else if "$(LINKMODE)" == "dll" -LIBS=$(LIBS_dll) -!else -!error Unknown link mode: $(LINKMODE)! -!endif - -# Debug / Release alternatives: -CC_FLAGS_DEBUG_0=-O2 -DNDEBUG -# These -O... below are taken from Dr. Memory's README/Quick start...: -CC_FLAGS_DEBUG_1=-Zi -Oy- -Ob0 -DDEBUG -LINK_FLAGS_DEBUG_0= -LINK_FLAGS_DEBUG_1=-debug -#!!FFS... CC_FLAGS_DEBUG=$(CC_FLAGS_DEBUG_$(DEBUG)) -!if defined(DEBUG) && $(DEBUG) == 1 -CC_FLAGS_DEBUGMODE=$(CC_FLAGS_DEBUG_1) -LINK_FLAGS_DEBUGMODE=$(LINK_FLAGS_DEBUG_1) -!else if $(DEBUG) == 0 -CC_FLAGS_DEBUGMODE=$(CC_FLAGS_DEBUG_0) -LINK_FLAGS_DEBUGMODE=$(LINK_FLAGS_DEBUG_0) -!else -!error Unknown debug mode: $(DEBUG)! -!endif - -# File types for the "clean" rule (safety measure against a runaway `rm -rf *`): -CLEANED_OUTPUT_EXT=.exe .obj .ifc .lib .pdb .ilk .inc .tmp - - -#----------------------------------------------------------------------------- -# All Internals below... - -CC_FLAGS=$(CC_FLAGS) $(CC_FLAGS_LINKMODE) $(CC_FLAGS_DEBUGMODE) $(CC_FLAGS_CPPMODULES) - - -#----------------------------------------------------------------------------- -# Rules, finally... -# -# AFAIK, NMAKE can't suport multi-tag subpaths in inf. rules (only single-depth -# subdirs), so each dir has to have its distinct rule... :-/ (I hope I'm wrong!) -# -#!!Alas, this doesn't seem to work in inference rules either: -#!! echo SOURCE DRIVE + PATH: %|dpF - -#!!?? I'm not sure if this is actually needed (or is the sane way): -{$(src_dir)/}.ixx{$(out_dir)/}.ifc:: - $(CC_CMD) $(CC_FLAGS_) $< - - -{$(src_dir)/}.cpp{$(out_dir)/}.obj:: - $(CC_CMD) $(CC_FLAGS_) $< - -{$(src_dir)/$(World_subdir)/}.cpp{$(out_dir)/$(World_subdir)/}.obj:: - $(CC_CMD) $(CC_FLAGS_World) $< - -{$(src_dir)/$(View_subdir)/}.cpp{$(out_dir)/$(View_subdir)/}.obj:: - $(CC_CMD) $(CC_FLAGS_View) $< - -{$(src_dir)/$(UI_subdir)/}.cpp{$(out_dir)/$(UI_subdir)/}.obj:: - $(CC_CMD) $(CC_FLAGS_UI) $< - -# -# There should also be a generic case, like this, but this is futile, as -# a) the output path may not exist yet, and CL won't auto-create it :-/ -# b) $(LINK_CMD) won't consider objects not already mentioned in $(OBJS)... -# (And AFAIK, there's no way to wildcard them in NMAKE.) -# -#.cpp.obj:: -# $(CC_CMD) $(CC_FLAGS_) $< - - -## This non-batch alternative for attempting to generate .h* deps is futile... -## (Note: redirecting the -showIncludes output with > $*.dep won't work, as $* is -## illegal in batch rules!) -## But even if the list was massaged into makefile syntax, the MSVC output is still -## "unredirectable", as both the includes AND the errors/warnings go to stdout!... :-( -## {$(src_dir)/}.cpp{$(out_dir)/}.obj: -## $(CC_CMD) $(CC_FLAGS_) $< -showIncludes > $(out_dir)/$*.hdep - - -# NMAKE only runs the first root target by default! So... `::` is essential. -#----------------------------------------------------------------------------- -MAIN:: - $(ECHO) Processing default target ($(EXE))... -!if defined(DEBUG) && "$(DEBUG)" != "0" - $(ECHO) - $(ECHO) - $(BUILD_OPT_LABEL) DEBUG -!else - $(ECHO) - $(ECHO) - $(BUILD_OPT_LABEL) RELEASE (optimized) -!endif -!if defined(SFML_DLL) - $(ECHO) - $(BUILD_OPT_LABEL) Link with SFML DLLs - $(ECHO) -!else - $(ECHO) - $(BUILD_OPT_LABEL) Static-linked SFML - $(ECHO) -!endif -#!! Make this hamfisted subdir creation less atrocious: -#!! (Not that the rest of the "tree management" is any less lame!) - @$(MKDIR) $(out_dir)/$(World_subdir) - @$(MKDIR) $(out_dir)/$(View_subdir) - @$(MKDIR) $(out_dir)/$(Platform_subdir) - @$(MKDIR) $(out_dir)/$(UI_subdir) - -## MAIN:: $(out_dir)/$(UI_subdir)/sfw.lib - -MAIN:: $(HASH_INCLUDE_FILE) - -MAIN:: $(CPP_MODULE_IFCS) - -MAIN:: $(CPP_MODULES) - -MAIN:: $(EXE) - -## !include src/UI/sfw/Makefile.msvc - -#----------------------------------------------------------------------------- -clean: - $(ECHO) - $(ECHO) "Cleaning up..." - $(ECHO) -# FFS... Since migrating the build script to BB sh, the `rm` command started -# failing... It can't find the file for some reason -- the same file that's printed -# I could delete, with the same printed BB command, from the cmdline all right! :-o -# Is it the confusing "stealth" dual globbing behavior again?... -# Not likely: globbing would only be disabled if BB_GLOBBING=0, which shouldn't be -# the case here... Right? RIGHT??? -# ...Oh no!... It really is! (Yeah, I did consider that we are running inside BB sh, -# but assumed it would reset it when launching a "foreign" process like CMD... :-o ) - @set BB_GLOBBING=1 - for %x in ($(CLEANED_OUTPUT_EXT)) do \ - @$(BB) find "$(out_dir)" -type f -name "*%x" -exec $(BB) rm "{}" ^; -#! This didn't work, as `rm -r dir/*x` is too dumb to recurse below dir despite -r -#! (no matter the BB_GLOBBING state): -# @if exist "$(out_dir)/*%x" \ -# $(BB) rm -r "$(out_dir)/*%x" - -#----------------------------------------------------------------------------- -$(EXE):: $(OBJS) - $(LINK_CMD) $(LINK_FLAGS_DEBUGMODE) -out:$(EXE) $(OBJS) $(LIBS) $(EXT_LIBS) - - -#============================================================================= -##!! INCLUDE THESE BELOW INSTEAD !! -#============================================================================= - -$(FULL_REBUILD_TRIGGER): $(MAKEFILE) - -## Sorry, no autodeps. yet... -$(OBJS) $(CPP_MODULE_IFCS): $(INCLUDES) $(CPP_MODULE_SOURCES) - -## Especially for this one...: -$(out_dir)/main.obj: $(HASH_INCLUDE_FILE) - -$(HASH_INCLUDE_FILE): - $(ECHO) " Make last commit ID available for #including:" - $(BB) sh tooling/git/_create_commit_hash_include_file.sh - $(ECHO) diff --git a/Makefile-jumpstart b/Makefile.msvc similarity index 64% rename from Makefile-jumpstart rename to Makefile.msvc index 18161ab..6cefb8c 100644 --- a/Makefile-jumpstart +++ b/Makefile.msvc @@ -1,59 +1,16 @@ -# Linkmode alternatives: -CC_FLAGS_LINK_static=-DSFML_STATIC -CC_FLAGS_LINK_dll= -#!!NMAKE doesn't seem to support macros in macro names, so we have to dance the !ifs... :-/ -#CC_FLAGS_LINKMODE=$(CC_FLAGS_$(CC_FLAGS_LINKMODE)) -!if "$(LINKMODE)" == "static" -CC_FLAGS_LINKMODE=$(CC_FLAGS_LINK_static) -!else if "$(LINKMODE)" == "dll" -CC_FLAGS_LINKMODE=$(CC_FLAGS_LINK_dll) -!else -!error Unknown link mode: $(LINKMODE)! -!endif - -LIBS_static=\ - sfml-graphics-s.lib sfml-window-s.lib sfml-system-s.lib \ - sfml-audio-s.lib ogg.lib vorbis.lib vorbisenc.lib vorbisfile.lib flac.lib openal32.lib \ - opengl32.lib freetype.lib vorbis.lib vorbisfile.lib \ - user32.lib kernel32.lib gdi32.lib winmm.lib advapi32.lib -LIBS_dll=\ - sfml-graphics.lib sfml-window.lib sfml-system.lib \ - sfml-audio.lib ogg.lib vorbis.lib vorbisenc.lib vorbisfile.lib flac.lib openal32.lib \ - opengl32.lib -#!!sigh... LIBS=$(LIBS$(LINKMODE)) -!if "$(LINKMODE)" == "static" -LIBS=$(LIBS_static) -!else if "$(LINKMODE)" == "dll" -LIBS=$(LIBS_dll) -!else -!error Unknown link mode: $(LINKMODE)! -!endif - - - - - - - - - - - - - -#### MSVC Jumpstart Makefile, r12 (Public Domain) +#### MSVC Jumpstart Makefile -- heavily customized from r12! #### -> https://github.com/xparq/NMAKE-Jumpstart #### #### BEWARE! Uses recursive NMAKE invocations, so update the macro below if #### you rename this file: -THIS_MAKEFILE=Makefile +THIS_MAKEFILE=Makefile.msvc #----------------------------------------------------------------------------- # Config - Project layout # # Note: the cfg. options can't be set on the NMAKE command line, only here! #----------------------------------------------------------------------------- -PRJ_NAME=example +PRJ_NAME=$(SZ_APPNAME) # Use the lower-case (processed) path macros here: #main_lib=$(lib_dir)/$(PRJ_NAME)$(buildmode_suffix).lib main_exe=$(exe_dir)/$(PRJ_NAME)$(buildmode_suffix).exe @@ -65,21 +22,41 @@ OUT_DIR=out LIB_DIR=$(OUT_DIR) EXE_DIR=$(OUT_DIR) OBJ_DIR=$(OUT_DIR)/obj -CXX_MOD_IFC_DIR=$(OUT_DIR)/ifc +CXX_MOD_IFC_DIR=$(OUT_DIR) # Put (only) these into the lib (relative to SRC_DIR; leave it empty for "all"): LIB_SRC_SUBDIR= -# Source (translation unit) basename filter: +# Source (translation unit) basename filter (CMD shell glob pattern): UNITS_PATTERN=* +# Ignore-filter on full-path source names -> NMAKE `filterout` pattern list syntax! +# Multiple patterns must be separated by spaces. Do NOT quote the list! +UNITS_NO_COMPILE_PATTERN=.off .tmp +# Ignore-filter on full-path source names -> `findstr` REGEX syntax! +# Multiple patterns must be separated by spaces. Do NOT quote the list! +UNITS_NO_AUTOLINK_PATTERN=main\.cpp \.off \.tmp sz/test sz\\test +UNITS_NO_LIB_PATTERN=$(UNITS_NO_AUTOLINK_PATTERN) + +#!! Kludge until I find out the correct way: +#!! Also done manually, coz no way to track the actual deps automatically...: +OON_CPP_MODULE_IFCS=\ + $(cxx_mod_ifc_dir)/Storage.ifc + +#!Sz: Assuming being called from a script that has already set the path: +BB=busybox +ECHO=@$(BB) echo +MKDIR=$(BB) mkdir -p +# Print more (0, 1 or 2) +VERBOSE_CMD=2 +# # External dependencies: +# EXT_INCLUDE_DIRS= EXT_LIB_DIRS= -#!!Should be adjusted to match the build options! EXT_LIBS=\ - extern/sfw/lib/msvc/sfw-$(CRTMODE).lib \ - extern/zstd/msvc/zstd-$(CRTMODE).lib \ - + $(SFML_LIBROOT)/lib/$(sfml_and_deps_libs) \ + extern/sfw/lib/msvc/sfw$(_cflags_crt_linkmode)$(_buildmode_debug_file_suffix).lib \ + extern/zstd/msvc/zstd$(_cflags_crt_linkmode).lib \ #----------------------------------------------------------------------------- # Config - Build options @@ -87,10 +64,11 @@ EXT_LIBS=\ # Build alternatives (override from the command-line, too, if needed): DEBUG=0 CRT=dll +#!Sz: CRT=dll is always the case with the pre-built SFML libs, so not use changing it! # Custom build options can also be added: -#OPT1 = opt1_default +SFML=static # Custom build options need to be passed along for recursion explicitly: -#custom_build_options = OPT1=$(OPT1) ... +custom_build_options = SFML=$(SFML) ... # Comp. flags: CFLAGS=-W4 -Iinclude @@ -100,15 +78,49 @@ CXXFLAGS=-std:c++latest # Output dir/file suffixes for build alternatives # NOTE: Must differ from their "no ..." counterparts to avoid code (linking) # mismatches! +#!Sz: CRT=dll is always the case with the pre-built SFML libs, so not use changing it! (See also at CRT=...) buildmode_crtdll_dir_suffix=.crtdll buildmode_crtdll_file_suffix=-crtdll buildmode_debug_dir_suffix=.DEBUG buildmode_debug_file_suffix=-d +SFML_linkmode=$(SFML) +buildmode_dir_suffix=.sfml-$(SFML_linkmode) + +#!------------------------------------- +#!Sz Other custom options for OON... +#!------------------------------------- +!if "$(SFML)" == "static" +CFLAGS=$(CFLAGS) -DSFML_STATIC +!endif +CXXFLAGS=-std:c++latest +# Note: C++ compilation would use $(CFLAGS), too. + +# Adapt the various flavors of the SFML libs (as per the debug/link modes)... +sfml_libs_static=sfml-graphics-s.lib sfml-window-s.lib sfml-system-s.lib \ + sfml-audio-s.lib + +sfml_libs_dll=sfml-graphics.lib sfml-window.lib sfml-system.lib \ + sfml-audio.lib + +!if "$(SFML)" == "static" +sfml_libs=$(sfml_libs_static) +sfml_and_deps_libs=$(sfml_libs) opengl32.lib freetype.lib\ + ogg.lib vorbis.lib vorbisenc.lib vorbisfile.lib flac.lib openal32.lib \ + user32.lib kernel32.lib gdi32.lib winmm.lib advapi32.lib +!else if "$(SFML)" == "dll" +sfml_libs=$(sfml_libs_dll) +sfml_and_deps_libs=$(sfml_libs) opengl32.lib +!endif + +!if defined(DEBUG) && $(DEBUG) == 1 +sfml_libs=$(substi .lib,-d.lib,$(sfml_libs)) +!endif + #============================================================================= # NO EDITS NEEDED BELOW, NORMALLY... #============================================================================= -obj_source_exts=cpp cxx c +obj_source_exts=cpp cxx cc c #----------------------------------------------------------------------------- # Show current processing stage... @@ -241,6 +253,8 @@ buildmode_file_suffix=$(buildmode_file_suffix)$(buildmode_crtdll_file_suffix) !endif !if "$(DEBUG)" == "1" +_buildmode_debug_file_suffix=$(buildmode_debug_file_suffix) +_buildmode_debug_dir_suffix=$(buildmode_debug_dir_suffix) buildmode_dir_suffix=$(buildmode_dir_suffix)$(buildmode_debug_dir_suffix) buildmode_file_suffix=$(buildmode_file_suffix)$(buildmode_debug_file_suffix) !endif @@ -266,20 +280,23 @@ obj_dir=$(obj_dir)\$(DIR) # Can't direclty add $(patsubst %,.%,$(obj_source_exts)) to .SUFFIXES, as that # would trigger a syntax error! :-o Well, at least we have a descriptive name: _compilable_src_exts_=$(patsubst %,.%,$(obj_source_exts)) -.SUFFIXES: $(_compilable_src_exts_) .ixx +.SUFFIXES:$(_compilable_src_exts_) .ixx .ifc .exe + #----------------------------------------------------------------------------- {$(src_dir)}.c{$(obj_dir)}.obj:: - $(CC) $(CFLAGS) -Fo$(obj_dir)\ $< + @$(CC) $(CFLAGS) -Fo$(obj_dir)\ $< {$(src_dir)}.cpp{$(obj_dir)}.obj:: - $(CXX) $(CFLAGS) $(CXXFLAGS) -Fo$(obj_dir)\ $< - + @$(CXX) $(CFLAGS) $(CXXFLAGS) -Fo$(obj_dir)\ $< {$(src_dir)}.cxx{$(obj_dir)}.obj:: - $(CXX) $(CFLAGS) $(CXXFLAGS) -Fo$(obj_dir)\ $< + @$(CXX) $(CFLAGS) $(CXXFLAGS) -Fo$(obj_dir)\ $< +{$(src_dir)}.cc{$(obj_dir)}.obj:: + @$(CXX) $(CFLAGS) $(CXXFLAGS) -Fo$(obj_dir)\ $< #!!?? This is probably not the way to compile mod. ifcs!...: -#{$(src_dir)}.ixx{$(obj_dir)}.ifc:: -# $(CXX) $(CFLAGS) $(CXXFLAGS) -ifcOutput $(cxx_mod_ifc_dir)\ $< +{$(src_dir)}.ixx{$(cxx_mod_ifc_dir)}.ifc:: + $(CXX) $(CFLAGS) $(CXXFLAGS) -ifcOutput $(cxx_mod_ifc_dir)\ -Fo$(obj_dir)\ $< + #----------------------------------------------------------------------------- # Default target - walk through the src tree dir-by-dir & build each, @@ -299,23 +316,35 @@ traverse_src_tree: init if exist "$(src_dir)\*.%%x" !_make_! /c compiling SRC_EXT_=%%x $(custom_build_options) || if errorlevel 1 exit -1 ) rem Scan the rest of the source tree for sources... - for /f "delims=" %%i in ('dir /s /b /a:d "$(srcroot_fullpath)"') do ( - rem It's *vital* to use a local name here, not dir (==DIR!!!): - set "_dir_=%%i" - set "_dir_=!_dir_:$(srcroot_fullpath)\=!" - for %%x in ($(obj_source_exts)) do ( - if exist %%i\*.%%x !_make_! /c compiling "DIR=!_dir_!" SRC_EXT_=%%x $(custom_build_options) || if errorlevel 1 exit -1 + for /f "delims=" %%d in ('dir /s /b /a:d "$(srcroot_fullpath)"') do ( + rem It's *vital* to use a local name here, not `dir` (== $(DIR)!!!): + set "_dir_=%%d" + + echo !_dir_! | findstr /L "$(UNITS_NO_COMPILE_PATTERN)" > nul + if not errorlevel 1 ( + echo - EXCLUDE DIR: !_dir_! + ) else ( + set "_dir_=!_dir_:$(srcroot_fullpath)\=!" + for %%x in ($(obj_source_exts)) do ( + if "$(VERBOSE_CMD)"=="2" echo [%%d/*.%%x] + if exist "%%d\*.%%x" ( + !_make_! /c compiling "DIR=!_dir_!" SRC_EXT_=%%x $(custom_build_options) || if errorlevel 1 exit -1 + ) + ) ) ) !_make_! RECURSED_FOR_FINISHING=1 $(custom_build_options) finish -<< +< nul + if not errorlevel 1 ( + echo - EXCLUDE FROM LIB: !_o_! + ) else ( + set "_o_=!_o_:$(srcroot_fullpath)\=!" + for %%x in ($(obj_source_exts)) do ( + set "_o_=!_o_:.%%x=.obj!" + ) + set "objlist=!objlist! $(obj_dir)\!_o_!" + ) ) - set "objlist=!objlist! $(obj_dir)\!_o_!" ) - echo $(main_lib): !objlist! > $(mainlib_rule_inc) -<< -# And this crap is separated here only because echo can't echo TABs: - @type << >> $(mainlib_rule_inc) + echo !objlist! > $(obj_list_file) + echo $(main_lib): !objlist! > $(mainlibexe_rule_inc) +<> $(mainlibexe_rule_inc) @echo Creating lib: $$@... lib -nologo -out:$$@ $$** -<< +< nul + if not errorlevel 1 ( + echo - EXCLUDE FROM AUTO-LINK: !_o_! + ) else ( + set "_o_=!_o_:$(srcroot_fullpath)\=!" + for %%x in ($(obj_source_exts)) do ( + set "_o_=!_o_:.%%x=.obj!" + ) + set "objlist=!objlist! $(obj_dir)\!_o_!" + ) + ) + ) + echo !objlist! > $(obj_list_file) + echo $(main_exe):: !objlist! > $(mainlibexe_rule_inc) +< cmd /e:off (self-explanatory, right?) @if exist "$(obj_dir)\*.obj" cmd /e:off /c del /s /q "$(obj_dir)\*.obj" + @if exist "$(obj_list_file)" cmd /e:off /c del $(obj_list_file) # To let the idiotic tools run at least, the dir must exist, so if it was deleted # in a previous run, we must recreate it just to be able to check and then delete # it right away again... Otherwise: "The system cannot find the file specified."): @@ -395,6 +468,7 @@ clean_all: #----------------------------------------------------------------------------- # Actual (low-level) one-off build jobs... #----------------------------------------------------------------------------- + #------------------------ # Build the "main" lib #------ @@ -408,11 +482,39 @@ clean_all: # Build the "main" exe #------ !if "$(main_exe)" != "" -$(main_exe): $(obj_dir)\main.obj $(main_lib) +$(main_exe):: $(obj_dir)\main.obj $(main_lib) @echo Creating executable: $@... - link -nologo $(LINKFLAGS) -out:$@ $(EXT_LIBS) $** + link -nologo $(LINKFLAGS) -out:$@ @$(obj_list_file) $(EXT_LIBS) $** +!endif + +## Sorry, no autodeps. yet... +#OON legacy: $(OBJS) $(CPP_MODULE_IFCS): $(INCLUDES) $(CPP_MODULE_SOURCES) + +## Especially for this one...: +$(obj_dir)/main.obj: $(OON_HASH_INCLUDE_FILE) + +$(OON_HASH_INCLUDE_FILE): + $(ECHO) " Make last commit ID available for #including..." + $(BB) sh tooling/git/_create_commit_hash_include_file.sh + $(ECHO) + +#----------------------------------------------------------------------------- +# Some auto-remake support (-- the rest is in the OON build script!) +# Changing the makefile triggers a full rebuild. +#!! I'm sure there's a better way for this, but for now: +OON_FULL_REBUILD_BY_MANUAL_DEPS=$(OON_CPP_MODULE_IFCS) +!ifdef SRC_EXT_ +OON_FULL_REBUILD_BY_MANUAL_DEPS=$(OON_FULL_REBUILD_BY_MANUAL_DEPS) $(src_dir)\$(UNITS_PATTERN).$(SRC_EXT_) !endif -MAIN:: $(HASH_INCLUDE_FILE) - echo BOOO! :-o - +$(OON_FULL_REBUILD_BY_MANUAL_DEPS): $(THIS_MAKEFILE) $(OON_INCLUDES_MANUALDEP) + +#!! Sigh... No header autodep... +OON_INCLUDES_MANUALDEP=$(src_dir)/*.hpp $(src_dir)/*.h \ + $(src_dir)/$(World_subdir)/*.hpp \ + $(src_dir)/$(View_subdir)/*.hpp \ + $(src_dir)/$(UI_subdir)/*.hpp \ + $(src_dir)/$(UI_subdir)/adapter/SFML/*.hpp \ +# $(src_dir)/$(Platform_subdir)/*.hpp \ + $(src_dir)/adapter/SFML/*.hpp \ + $(src_dir)/sz/*.hh \ diff --git a/src/Model/Math/Vector2-included.cpp b/src/Model/Math/Vector2-cpp.hpp similarity index 100% rename from src/Model/Math/Vector2-included.cpp rename to src/Model/Math/Vector2-cpp.hpp diff --git a/src/Model/Math/Vector2.inl b/src/Model/Math/Vector2.inl index 84545d0..411cc2c 100644 --- a/src/Model/Math/Vector2.inl +++ b/src/Model/Math/Vector2.inl @@ -219,4 +219,4 @@ template const Vector2 Vector2::UnitY(static_cast(0), static_cast(1)); -#include "Vector2-included.cpp" +#include "Vector2-cpp.hpp" diff --git a/src/Model/Math/Vector3-included.cpp b/src/Model/Math/Vector3-cpp.hpp similarity index 100% rename from src/Model/Math/Vector3-included.cpp rename to src/Model/Math/Vector3-cpp.hpp diff --git a/src/Model/Math/Vector3.inl b/src/Model/Math/Vector3.inl index 2892c61..bfa590d 100644 --- a/src/Model/Math/Vector3.inl +++ b/src/Model/Math/Vector3.inl @@ -208,4 +208,4 @@ constexpr bool operator!=(const Vector3& left, const Vector3& right) } -#include "Vector3-included.cpp" +#include "Vector3-cpp.hpp" diff --git a/src/sz/test/counter.cc b/src/sz/test/counter.cc index e5a11ed..7477f4d 100644 --- a/src/sz/test/counter.cc +++ b/src/sz/test/counter.cc @@ -48,14 +48,14 @@ int main() //------------------------------------------------------------------- cerr << "\n\nAssign: operator=(-1u)\n\t"; - cc.operator=( -1u); cerr << cc << ", "; + cc.operator=(unsigned(-1)); cerr << cc << ", "; cerr << "\nAssign: x = -1u\n\t"; - cc = -1u; cerr << cc << ", "; + cc = unsigned(-1); cerr << cc << ", "; cerr << "\n\nAssign: operator=(-1)\n\t"; - cc.operator=( -1); cerr << cc << ", "; + cc.operator=(unsigned(-1)); cerr << cc << ", "; cerr << "\nAssign: x = -1\n\t"; - cc = -1; cerr << cc << ", "; + cc = unsigned(-1); cerr << cc << ", "; cerr << "\n\nAssign: copy op= cc2 (should be 20)\n\t"; cc = cc2; cerr << cc << ", "; diff --git a/tooling/_setenv.cmd b/tooling/_setenv.cmd index 8951cbd..20fa565 100644 --- a/tooling/_setenv.cmd +++ b/tooling/_setenv.cmd @@ -9,7 +9,7 @@ rem !! These could crash horrendously, if e.g. the existing value has & in it et rem !! if "%sz_prjdir%"=="" set sz_prjdir=%~dp0.. -if "%sfml_libroot%"=="" set sfml_libroot=%sz_prjdir%/extern/sfml/msvc +if "%sfml_libroot%"=="" set SFML_LIBROOT=%sz_prjdir%/extern/sfml/msvc set sz_src_dir=%sz_prjdir%/src set sz_asset_subdir=asset @@ -19,13 +19,13 @@ set sz_run_dir=%sz_prjdir%/run set sz_tmp_dir=%sz_prjdir%/tmp set sz_release_dir=%sz_tmp_dir%/release -set HASH_INCLUDE_FILE=%sz_out_dir%/commit_hash.inc +set OON_HASH_INCLUDE_FILE=%sz_out_dir%/commit_hash.inc rem CD to prj root for the rest of the process: cd "%sz_prjdir%" if not exist "%sz_out_dir%" md "%sz_out_dir%" -set INCLUDE=%sz_src_dir%;extern/sfw/include;%sfml_libroot%/include;%sz_prjdir%;%INCLUDE% -set LIB=%sfml_libroot%/lib;%LIB% -set PATH=%sz_prjdir%/tooling;%sfml_libroot%/bin;%PATH% +set INCLUDE=%sz_src_dir%;extern/sfw/include;%SFML_LIBROOT%/include;%sz_prjdir%;%INCLUDE% +set LIB=%SFML_LIBROOT%/lib;%LIB% +set PATH=%sz_prjdir%/tooling;%SFML_LIBROOT%/bin;%PATH%;extern/Microsoft.VC143.DebugCRT diff --git a/tooling/build/_build.sh b/tooling/build/_build.sh index 4d998d8..4ce7509 100644 --- a/tooling/build/_build.sh +++ b/tooling/build/_build.sh @@ -1,10 +1,10 @@ # Keep the BOM removed, as sh won't find '#' otherwise... ;) # Also: orig. env var names from Windows are converted to upper case here! :-o -make_exe="nmake /nologo" +make_cmd_base="nmake /nologo /f Makefile.msvc" -make_build_cmd="${make_exe} $*" -make_clean_cmd="${make_exe} clean" +make_build_cmd="${make_cmd_base} $*" +make_clean_cmd="${make_cmd_base} clean" # As a heuristic hack, if `build clean` was explicitly called, # skip all the magic and just proceed to make... diff --git a/tooling/git/_create_commit_hash_include_file.sh b/tooling/git/_create_commit_hash_include_file.sh index dc2e92a..1d23f32 100644 --- a/tooling/git/_create_commit_hash_include_file.sh +++ b/tooling/git/_create_commit_hash_include_file.sh @@ -1,4 +1,4 @@ #!/bin/sh commit_hash=$(git rev-parse --short=8 HEAD) -echo "const char* LAST_COMMIT_HASH = \"${commit_hash}\";" > ${HASH_INCLUDE_FILE} +echo "const char* LAST_COMMIT_HASH = \"${commit_hash}\";" > ${OON_HASH_INCLUDE_FILE} diff --git a/tooling/sfml_dl+unzip.cmd b/tooling/sfml_dl+unzip.cmd index 8e618cf..69bbd1d 100644 --- a/tooling/sfml_dl+unzip.cmd +++ b/tooling/sfml_dl+unzip.cmd @@ -37,12 +37,9 @@ rem set SFML :: echo Download... -::!! -::!! BusyBox stopped working for this! :-/ -::!! %~dp0busybox wget -P %_SFML_DOWNLOAD_DIR% %_SFML_DOWNLOAD_URL% -::!! ssl_client: TLS error from peer (alert code 40): handshake failure -::!! wget: error getting response -wget -q -P %_SFML_DOWNLOAD_DIR% %_SFML_DOWNLOAD_URL% +::! Win10 ships with curl! +curl -o %_SFML_DOWNLOADED_PACK% %_SFML_DOWNLOAD_URL% +::! wget -q -P %_SFML_DOWNLOAD_DIR% %_SFML_DOWNLOAD_URL% if not exist "%_SFML_DOWNLOADED_PACK%" ( echo - ERROR: Failed to download package.