Skip to content

Commit

Permalink
win,build: add option to enable cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
huseyinacacak-janea committed Jan 14, 2025
1 parent f4fcf0e commit ca2c5ba
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

'clang%': 0,
'error_on_warn%': 'false',
'cfg%': 'false',

'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
'openssl_no_asm%': 0,
Expand Down Expand Up @@ -309,6 +310,11 @@
'/Zm2000',
],
}],
['cfg=="true"', {
'AdditionalOptions': [
'/guard:cf', # Control Flow Guard
],
}],
],
'BufferSecurityCheck': 'true',
'DebugInformationFormat': 1, # /Z7 embed info in .obj files
Expand All @@ -335,6 +341,11 @@
['target_arch=="arm64"', {
'TargetMachine' : 0, # NotSet. MACHINE:ARM64 is inferred from the input files.
}],
['cfg=="true"', {
'AdditionalOptions': [
'/guard:cf', # Control Flow Guard
],
}],
],
'GenerateDebugInformation': 'true',
'SuppressStartupBanner': 'true',
Expand Down
7 changes: 7 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,12 @@
default=None,
help='do not install the bundled Corepack')

parser.add_argument('--cfg',
action='store_true',
dest='enable_cfg',
default=None,
help='enable Control Flow Guard (CFG)')

# Dummy option for backwards compatibility
parser.add_argument('--without-report',
action='store_true',
Expand Down Expand Up @@ -1394,6 +1400,7 @@ def configure_node(o):
o['variables']['node_prefix'] = options.prefix
o['variables']['node_install_npm'] = b(not options.without_npm)
o['variables']['node_install_corepack'] = b(not options.without_corepack)
o['variables']['cfg'] = b(options.enable_cfg)
o['variables']['node_use_amaro'] = b(not options.without_amaro)
o['variables']['debug_node'] = b(options.debug_node)
o['default_configuration'] = 'Debug' if options.debug else 'Release'
Expand Down
3 changes: 3 additions & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ set no_shared_roheap=
set doc=
set extra_msbuild_args=
set compile_commands=
set cfg=
set exit_code=0

:next-arg
Expand Down Expand Up @@ -148,6 +149,7 @@ if /i "%1"=="no-shared-roheap" set no_shared_roheap=1&goto arg-ok
if /i "%1"=="doc" set doc=1&goto arg-ok
if /i "%1"=="binlog" set extra_msbuild_args=/binaryLogger:out\%config%\node.binlog&goto arg-ok
if /i "%1"=="compile-commands" set compile_commands=1&goto arg-ok
if /i "%1"=="cfg" set cfg=1&goto arg-ok

echo Error: invalid command line option `%1`.
exit /b 1
Expand Down Expand Up @@ -207,6 +209,7 @@ if defined openssl_no_asm set configure_flags=%configure_flags% --openssl-no-a
if defined no_shared_roheap set configure_flags=%configure_flags% --disable-shared-readonly-heap
if defined DEBUG_HELPER set configure_flags=%configure_flags% --verbose
if defined compile_commands set configure_flags=%configure_flags% -C
if defined cfg set configure_flags=%configure_flags% --cfg

if "%target_arch%"=="x86" (
echo "32-bit Windows builds are not supported anymore."
Expand Down

0 comments on commit ca2c5ba

Please sign in to comment.