Skip to content

Commit

Permalink
unified jBuild scripts (with windows-arm64 support)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicSavichev committed Apr 1, 2024
1 parent 6284fbd commit a0648a3
Show file tree
Hide file tree
Showing 46 changed files with 780 additions and 1,783 deletions.
4 changes: 2 additions & 2 deletions jam_src/jam.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ extern char **environ;
# endif
# endif

#define JAMBUILDSTR "1.3-2024/03/12"
#define JAMBUILDSTR "1.3-2024/04/01"

int main(int argc, char **argv, char **arg_environ)
{
Expand Down Expand Up @@ -249,7 +249,7 @@ int main(int argc, char **argv, char **arg_environ)
if( ( s = getoptval( optv, 'v', 0 ) ) )
{
printf( "Jam %s. %s. [Build %s] ", VERSION, OSMINOR, JAMBUILDSTR );
printf( "Copyright 1993-2002 Christopher Seiwald [Modified by Gaijin Games KFT, 2004-2023]\n" );
printf( "Copyright 1993-2002 Christopher Seiwald [Modified by Gaijin Games KFT, 2004-2024]\n" );

return EXITOK;
}
Expand Down
4 changes: 2 additions & 2 deletions jam_src/jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Sources =
;

if $(OS) = NT {
Platform ?= win64 ;
PlatformArch ?= x86_64 ;
Copt = -DNT ;
Sources += filent.c ;
}
if $(OS) = MACOSX {
Copt = -Wno-parentheses ;
if $(OSX_CPU_TYPE) = arm64 { MacOSXArch ?= arm64 ; MacOSXMinVer ?= 11.0 ; }
if $(OSX_CPU_TYPE) = arm64 { PlatformArch ?= arm64 ; MacOSXMinVer ?= 11.0 ; }
}

include $(Root)/prog/_jBuild/build.jam ;
23 changes: 18 additions & 5 deletions prog/_jBuild/_vc/win_sdk.jam
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,34 @@ _WIN_SDK_BIN = $(_WIN_SDK)/bin ;
_WIN_SDK_INC = $(_WIN_SDK)/Include ;
_WIN_SDK_LIB = $(_WIN_SDK)/lib ;

if ! [ GLOB $(_VC_DIR) : * ] { exit FATAL\: _VC_DIR \"$(_VC_DIR)\" not found! Please, update DEVTOOLS ; }
if ! [ GLOB $(_WIN_SDK) : * ] { exit FATAL\: _WIN_SDK \"$(_WIN_SDK)\" not found! Please, update DEVTOOLS ; }

if $(WinSdkVer) = win.sdk.81 {
_WIN_SDK_TARGET_SUFFIX ?= x86 ;
local include_subdir = shared um winrt ;
_WIN_SDK_INC = $(_WIN_SDK_INC)/$(include_subdir) ;
_WIN_SDK_LIB = $(_WIN_SDK_LIB)/winv6.3/um ;
}
if $(WinSdkVer) = win.sdk.100 {
WinSdkUpdateVer ?= 19041 ;
local _inc = $(_DEVTOOL)/win.sdk.100/include/10.0.$(WinSdkUpdateVer).0 ;
local _lib = $(_DEVTOOL)/win.sdk.100/lib/10.0.$(WinSdkUpdateVer).0 ;
if ! [ GLOB $(_inc) : * ] { exit FATAL\: WinSDK \"$(_inc)\" not found! Please, update DEVTOOLS ; }

if [ GLOB $(_WIN_SDK_BIN) : 10.0.$(WinSdkUpdateVer).0 ] { _WIN_SDK_BIN = $(_WIN_SDK_BIN)/10.0.$(WinSdkUpdateVer).0 ; }

_WIN_SDK_TARGET_SUFFIX ?= x86 ;
if [ GLOB $(_WIN_SDK_BIN) : 10.0.19041.0 ] { _WIN_SDK_BIN = $(_WIN_SDK_BIN)/10.0.19041.0 ; }
_WIN_SDK_INC = $(_DEVTOOL)/win.sdk.100/include/10.0.19041.0/um $(_DEVTOOL)/win.sdk.100/include/10.0.19041.0/shared ;
_WIN_SDK_LIB = $(_DEVTOOL)/win.sdk.100/lib/10.0.19041.0/um ;
local include_subdir = um shared ;
_WIN_SDK_INC = $(_inc)/$(include_subdir) ;
_WIN_SDK_LIB = $(_lib)/um ;

_UCRT_INC = $(_inc)/ucrt ;
_UM_LIB = $(_lib)/um/$(_WIN_SDK_TARGET_SUFFIX) ;
_UCRT_LIB = $(_lib)/ucrt/$(_WIN_SDK_TARGET_SUFFIX) ;
}
if $(_WIN_SDK_TARGET_SUFFIX) {
_WIN_SDK_BIN = $(_WIN_SDK_BIN)/$(_WIN_SDK_TARGET_SUFFIX) ;
_WIN_SDK_BIN = $(_WIN_SDK_BIN)/x64 ;
_WIN_SDK_LIB = $(_WIN_SDK_LIB)/$(_WIN_SDK_TARGET_SUFFIX) ;
}

Expand All @@ -34,6 +48,5 @@ actions together quietly compile_pch_sync
:end

clr_filters
$(CODE_CHECK) -x $(1) $(2)
}

14 changes: 10 additions & 4 deletions prog/_jBuild/defPlatform.jam
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
switch $(OS) {
case NT : Platform ?= win32 ;
case MACOSX : Platform ?= macosx ;
case LINUX : Platform ?= linux64 ;
case NT : Platform ?= windows ;
case MACOSX : Platform ?= macOS ;
case LINUX : Platform ?= linux ;
}
PlatformArch_windows ?= x86 ;
PlatformArch_linux ?= x86_64 ;
PlatformArch_macOS ?= x86_64 ;

if $(Platform) in win32 win64 macosx linux64 {
PlatformArch ?= $(PlatformArch_$(Platform)) ;
PlatformArch ?= x86_64 ;

if $(Platform) in windows macOS linux {
PlatformDataFormatCode ?= PC ;
} else {
PlatformDataFormatCode ?= PC ; # unknown, let it be PC format
Expand Down
110 changes: 47 additions & 63 deletions prog/_jBuild/defaults.jam
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,23 @@ if ! $(__DEFAULTS_INCLUDED) {

include $(Root)/prog/_jBuild/defPlatform.jam ;

PlatformSpec_win32 ?= vc16 ;
PlatformSpec_win64 ?= vc16 ;
PlatformSpec_macosx ?= clang64 ;
PlatformSpec_linux64 ?= gcc ;
PlatformSpec_$(Platform) ?= $(PlatformSpec_$(Platform)_$(PlatformArch)) ;
PlatformSpec_windows ?= vc16 ;
PlatformSpec_macOS ?= clang ;
PlatformSpec_linux ?= gcc ;
CLangVer ?= 15.0.7 ;
DefaultCPPStd = 17 ;
CPPStd ?= 17 ;
Sanitize ?= disabled ;
NoMemBaseInclude ?= no ;

switch $(Platform) {
case win32 : PlatformSpec ?= $(PlatformSpec_win32) ;
case win64 : PlatformSpec ?= $(PlatformSpec_win64) ;
case macosx : PlatformSpec ?= $(PlatformSpec_macosx) ;
case linux64 : PlatformSpec ?= $(PlatformSpec_linux64) ;
case * : PlatformSpec ?= none ;
}
PlatformSpec ?= $(PlatformSpec_$(Platform)) ;
if $(PlatformSpec) = vc17
{
VCUpdateVer ?= 17.5.4 ;
VCUpdateVer ?= 17.9.5 ;
} else if $(PlatformSpec) = vc16
{
VCUpdateVer ?= 16.10.3 ;
VCUpdateVer ?= 16.11.34 ;
} else if $(PlatformSpec) = vc15
{
VCUpdateVer ?= 15.9.5 ;
Expand All @@ -51,11 +45,9 @@ if ! $(__DEFAULTS_INCLUDED) {
IncludeMSVCDir ?= -I ;

Config ?= dev ;
CoreLinkage ?= static ;
DriverLinkage ?= static ;
KernelLinkage ?= static ;
MacOSXVer ?= 11.0 ;
MacOSXMinVer ?= $(MacOSXVer) ;
MacOSXArch ?= x86_64 ;
WinSdkVer ?= win.sdk.100 ;
UseD3DMulti ?= no ;
MSVectorcall ?= no ;
Expand All @@ -64,8 +56,9 @@ if ! $(__DEFAULTS_INCLUDED) {
CheckOnly ?= no ;
ForcePdb ?= no ;
BundleVersion ?= 1.0.0 ;
DbgDigest ?= once ; # once, min, max, stop

if ! $(Platform) in win32 win64 { DisableUsingPCH ?= yes ; }
if ! $(Platform) in windows { DisableUsingPCH ?= yes ; }

if $(Config) = dbg {
CheckedContainers ?= yes ;
Expand All @@ -81,8 +74,8 @@ if ! $(__DEFAULTS_INCLUDED) {
StackProtection = no ;
}

if $(Platform) in macosx { SSEVersion = ; } # use only default SSEVersion for these platforms
if $(Platform) in macosx win64 {
if $(Platform) in macOS { SSEVersion = ; } # use only default SSEVersion for these platforms
if $(Platform) in macOS || $(Platform)-$(PlatformArch) = windows-x86_64 {
SSEVersion ?= 4 ;
}
SSEVersion ?= 2 ;
Expand All @@ -94,7 +87,7 @@ if ! $(__DEFAULTS_INCLUDED) {
Rtti ?= yes ;
} else if $(Config) in dbg dev {
Exceptions ?= yes ;
CatchSEH ?= yes ;
CatchSEH ?= no ;
Rtti ?= no ;
} else {
Exceptions ?= no ;
Expand All @@ -104,10 +97,6 @@ if ! $(__DEFAULTS_INCLUDED) {

UseWholeOpt ?= no ;

if $(Config) = dbg {
FastLink ?= yes ; # this speed-up linking but pdb become dependand on obj output
}

if $(OS) = MACOSX {
if ! $(_DEVTOOL) && [ GLOB /devtools : * ] { _DEVTOOL = /devtools ; }
if ! $(_DEVTOOL) && [ GLOB /var/devtools : * ] { _DEVTOOL = /var/devtools ; }
Expand All @@ -125,7 +114,7 @@ if ! $(__DEFAULTS_INCLUDED) {
}
}

include $(Root)/prog/_jBuild/macosx/setup-ver.jam ;
include $(Root)/prog/_jBuild/macOS/setup-ver.jam ;
}
if $(OS) = LINUX {
GDEVTOOL ?= $(HOME)/devtools ;
Expand Down Expand Up @@ -204,11 +193,14 @@ if ! $(__DEFAULTS_INCLUDED) {
type ?= $(TargetType) ;
if $(1:S) { return $(1) ; }
if $(type) = exe {
if $(Platform) in win32 win64 { return $(1).exe ; }
if $(Platform) in windows { return $(1).exe ; }
} else if $(type) = dll {
if $(Platform) in win32 win64 { return $(1).dll ; }
if $(Platform) in macosx { return $(1).dylib ; }
if $(Platform) in linux64 { if $(1:D) { return $(1:D)/lib$(1:D=:S=.so) ; } else { return lib$(1:D=:S=.so) ; } }
if $(Platform) in windows { return $(1).dll ; }
if $(Platform) in macOS {
if macOS-shortform in $(3) { return $(1:S=.dylib) ; }
if $(1:D) { return $(1:D)/lib$(1:D=:S=.dylib) ; } else { return lib$(1:D=:S=.dylib) ; }
}
if $(Platform) in linux { if $(1:D) { return $(1:D)/lib$(1:D=:S=.so) ; } else { return lib$(1:D=:S=.so) ; } }
}
return $(1) ;
}
Expand All @@ -222,58 +214,53 @@ if ! $(__DEFAULTS_INCLUDED) {

rule SetupOutputDir
{
local out ;
local _platform = $(Platform) ;
local _platform_spec = $(PlatformSpec) ;

if $(PlatformSpec) in vc14 vc14u vc15 vc16 vc17 && $(VCUpdateVer) {
PlatformOutputDir ?= $(PlatformSpec)-$(VCUpdateVer) ;
} else if $(PlatformSpec) = clang && $(Platform) in win32 win64 {
PlatformOutputDir ?= $(PlatformSpec)~$(CLangVer) ;
if $(PlatformSpec) in vc14 vc14 vc15 vc16 vc17 && $(VCUpdateVer) {
_platform_spec = $(_platform_spec)-$(VCUpdateVer) ;
} else if $(PlatformSpec) = clang && $(Platform) in windows {
_platform_spec = $(_platform_spec)-$(CLangVer) ;
}
if $(PlatformOutputDir) { _platform_spec = $(PlatformOutputDir) ; }

PlatformOutputDir ?= $(PlatformSpec) ;

if $(Platform) = macosx {
out = $(Platform)~$(MacOSXVer)~m$(MacOSXMinVer) ;
if $(MacOSXArch) = arm64 {
if $(Platform) = macOS {
_platform = $(_platform)-$(MacOSXVer)~m$(MacOSXMinVer) ;
if $(PlatformArch) = arm64 {
local ver = [ MATCH "([^\.]+)\.(.+)" : $(MacOSXMinVer) ] ;
if ! $(ver[0]) || ! $(ver[0]) in 11 12 13 14 15 { Exit MacOSXArch=$(MacOSXArch) requires MacOSXMinVer 11+ ($(MacOSXMinVer) is not allowed) ; }
if ! $(ver[0]) || ! $(ver[0]) in 11 12 13 14 15 { Exit PlatformArch=$(PlatformArch) requires MacOSXMinVer 11+ ($(MacOSXMinVer) is not allowed) ; }
}
if $(MacOSXArch) != x86_64 { out = $(out)~$(MacOSXArch) ; }
out = $(out)~$(PlatformOutputDir)~$(Config) ;
} else if $(Platform) in win32 win64 {
} else if $(Platform) in windows {
local ver = [ MATCH "([^\.]+)\.([^\.]+)\.(.*)" : $(WinSdkVer) ] ;
if ! $(ver[3] { ver = [ MATCH "([^\.]+)\.(.*)" : $(WinSdkVer) ] ; }
if ( ! $(ver[2]) ) || ( ! $(ver[1]) in win win32 ) { Exit bad WinSdkVer\=$(WinSdkVer) ; }
if $(ver[2]) = sdk && $(ver[3]) { ver = $(ver[3]) ; } else { ver = $(ver[2-]:J) ; }
out = $(Platform)~$(ver)~$(PlatformOutputDir)~$(Config) ;
} else {
out = $(Platform)~$(PlatformOutputDir)~$(Config) ;
_platform = $(_platform)-$(ver) ;
}

local out = $(_platform)~$(PlatformArch)~$(Config)~$(_platform_spec) ;

if $(CPPStd) != $(DefaultCPPStd) {
out = $(out)~cpp$(CPPStd) ;
}

if $(Platform) in win32 win64 linux64 macosx && $(UseD3DMulti) = yes {
if $(Platform) in windows linux macOS && $(UseD3DMulti) = yes {
if ! -D_TARGET_D3D_MULTI in $(GlobalCPPopt) { GlobalCPPopt += -D_TARGET_D3D_MULTI ; }
out = $(out)~m ;
} else if $(Platform) in macosx {
out = $(out)~MTL ;
}

if $(MSVectorcall) = yes && $(Platform) in win32 win64 {
if $(MSVectorcall) = yes && $(PlatformArch) = x86_64 && $(Platform) in windows {
out = $(out)~v ;
}

if $(DriverLinkage) = dynamic {
if $(KernelLinkage) = dynamic {
out = $(out)~krnlimp ;
if $(CoreLinkage) = dynamic { out = $(out)~coreimp ; }
}

if $(Platform) in win32 win64 macosx linux64 {
if $(Platform) in windows macOS linux {
out = $(out)~s$(SSEVersion) ;
}
if $(Platform) in win32 win64 {
if $(Platform) in windows {
switch $(VCMathOption) {
case -fp:fast : # default choice and output name
case -fp:precise : out = $(out)~fp ;
Expand All @@ -286,20 +273,17 @@ if ! $(__DEFAULTS_INCLUDED) {
if ! -DDAGOR_FORCE_LOGS=1 in $(GlobalCPPopt) { GlobalCPPopt += -DDAGOR_FORCE_LOGS=1 ; }
out = $(out)~log ;
}
if $(Demo) = yes {
out = $(out)~demo ;
}
if $(Exceptions) != no {
out = $(out)~ex ;
if $(CatchSEH) != yes {
out = $(out)ns ;
if $(CatchSEH) = yes {
out = $(out)s ;
}
}
if $(Rtti) != no {
out = $(out)~rtti ;
}
if $(Sanitize) != disabled {
out = $(out)~san~$(Sanitize) ;
out = $(out)~san-$(Sanitize) ;
}
if $(CxxStdLib) = libc++ {
out = $(out)~libcxx ;
Expand Down Expand Up @@ -327,10 +311,12 @@ if ! $(__DEFAULTS_INCLUDED) {
out = $(out)~nmb ;
}

if $(UseWholeOpt) != no && $(Platform) in win32 win64 {
if $(UseWholeOpt) != no {
out = $(out)~who ;
}

if $(Analyze) = yes { out = $(out)~a ; }

_Output = $(_OutputRoot)/$(out) ;
_PrintedOutput = [$(out)] ;
}
Expand All @@ -343,8 +329,6 @@ if ! $(__DEFAULTS_INCLUDED) {
if clean in $(JAMTARGETS) { GLOBAL_CleanObj = clean ; }
else if clean_all in $(JAMTARGETS) { GLOBAL_CleanObj = clean_all ; }

CODE_CHECK ?= rem if not errorlevel 1 call $(Root)/prog/_jBuild/_codeCheck/cc-dev.exe -d -r$(Root) ;


# prepare command line to call another jam (used in some rules)
if $(OS) = NT {
Expand Down
Loading

0 comments on commit a0648a3

Please sign in to comment.