From a1a0ae3ad4d1855ff7eb6f1c990b4df7897fb03a Mon Sep 17 00:00:00 2001 From: Harry Mallon Date: Mon, 13 Jun 2022 12:02:13 +0100 Subject: Xcode: Add Xcode SCHEME control for 'Launch' control --- Auxiliary/vim/syntax/cmake.vim | 2 ++ Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/XCODE_GENERATE_SCHEME.rst | 1 + Help/prop_tgt/XCODE_SCHEME_LAUNCH_MODE.rst | 22 ++++++++++++++++++++++ Help/release/dev/xcode-launch-mode.rst | 7 +++++++ Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst | 13 +++++++++++++ Source/cmTarget.cxx | 1 + Source/cmXCodeScheme.cxx | 10 +++++++++- .../XcodeProject/XcodeSchemaProperty-check.cmake | 2 ++ .../XcodeProject/XcodeSchemaProperty.cmake | 2 ++ 11 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 Help/prop_tgt/XCODE_SCHEME_LAUNCH_MODE.rst create mode 100644 Help/release/dev/xcode-launch-mode.rst create mode 100644 Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index e1a2885..1273c00 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -436,6 +436,7 @@ syn keyword cmakeProperty contained \ XCODE_SCHEME_ENVIRONMENT \ XCODE_SCHEME_EXECUTABLE \ XCODE_SCHEME_GUARD_MALLOC + \ XCODE_SCHEME_LAUNCH_MODE \ XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP \ XCODE_SCHEME_MALLOC_GUARD_EDGES \ XCODE_SCHEME_MALLOC_SCRIBBLE @@ -1537,6 +1538,7 @@ syn keyword cmakeVariable contained \ CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE \ CMAKE_XCODE_SCHEME_ENVIRONMENT \ CMAKE_XCODE_SCHEME_GUARD_MALLOC + \ CMAKE_XCODE_SCHEME_LAUNCH_MODE \ CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP \ CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES \ CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index d88322c..f7160db 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -451,6 +451,7 @@ Properties on Targets /prop_tgt/XCODE_SCHEME_ENVIRONMENT /prop_tgt/XCODE_SCHEME_EXECUTABLE /prop_tgt/XCODE_SCHEME_GUARD_MALLOC + /prop_tgt/XCODE_SCHEME_LAUNCH_MODE /prop_tgt/XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP /prop_tgt/XCODE_SCHEME_MALLOC_GUARD_EDGES /prop_tgt/XCODE_SCHEME_MALLOC_SCRIBBLE diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 9fbb146..1c11681 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -278,6 +278,7 @@ Variables that Change Behavior /variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE /variable/CMAKE_XCODE_SCHEME_ENVIRONMENT /variable/CMAKE_XCODE_SCHEME_GUARD_MALLOC + /variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE /variable/CMAKE_XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP /variable/CMAKE_XCODE_SCHEME_MALLOC_GUARD_EDGES /variable/CMAKE_XCODE_SCHEME_MALLOC_SCRIBBLE diff --git a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst index 8f46d2f..eceddc1 100644 --- a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst +++ b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst @@ -41,4 +41,5 @@ The following target properties will be applied on the - :prop_tgt:`XCODE_SCHEME_ENABLE_GPU_FRAME_CAPTURE_MODE` - :prop_tgt:`XCODE_SCHEME_ENVIRONMENT` - :prop_tgt:`XCODE_SCHEME_EXECUTABLE` +- :prop_tgt:`XCODE_SCHEME_LAUNCH_MODE` - :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY` diff --git a/Help/prop_tgt/XCODE_SCHEME_LAUNCH_MODE.rst b/Help/prop_tgt/XCODE_SCHEME_LAUNCH_MODE.rst new file mode 100644 index 0000000..df5ae07 --- /dev/null +++ b/Help/prop_tgt/XCODE_SCHEME_LAUNCH_MODE.rst @@ -0,0 +1,22 @@ +XCODE_SCHEME_LAUNCH_MODE +------------------------ + +.. versionadded:: 3.25 + +Property value for ``Launch`` in the Info section of the generated Xcode +scheme. + +Possible values are: + +``AUTO`` + Launch automatically. This is the default. + +``WAIT`` + Wait for the executable to be launched. + +This property is initialized by the value of the variable +:variable:`CMAKE_XCODE_SCHEME_LAUNCH_MODE` if it is set when a target is +created. + +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property +documentation to see all Xcode schema related properties. diff --git a/Help/release/dev/xcode-launch-mode.rst b/Help/release/dev/xcode-launch-mode.rst new file mode 100644 index 0000000..32b9ee6 --- /dev/null +++ b/Help/release/dev/xcode-launch-mode.rst @@ -0,0 +1,7 @@ +xcode-launch-mode +----------------- + +* The :variable:`CMAKE_XCODE_SCHEME_LAUNCH_MODE` variable and corresponding + :prop_tgt:`XCODE_SCHEME_LAUNCH_MODE` target property were added to tell + the :generator:`Xcode` generator what to put in the scheme's "Launch" + mode setting. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst b/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst new file mode 100644 index 0000000..c15b1ea --- /dev/null +++ b/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_MODE.rst @@ -0,0 +1,13 @@ +CMAKE_XCODE_SCHEME_LAUNCH_MODE +------------------------------ + +.. versionadded:: 3.25 + +Property value for ``Launch`` in the Info section of the generated Xcode +scheme. + +This variable initializes the :prop_tgt:`XCODE_SCHEME_LAUNCH_MODE` property on +all targets. + +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property +documentation to see all Xcode schema related properties. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 83dc1c2..ffbb456 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -610,6 +610,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, initProp("XCODE_SCHEME_MALLOC_SCRIBBLE"); initProp("XCODE_SCHEME_MALLOC_GUARD_EDGES"); initProp("XCODE_SCHEME_GUARD_MALLOC"); + initProp("XCODE_SCHEME_LAUNCH_MODE"); initProp("XCODE_SCHEME_ZOMBIE_OBJECTS"); initProp("XCODE_SCHEME_MALLOC_STACK"); initProp("XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE"); diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index adc500a..a62015f 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -147,7 +147,15 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, "Xcode.DebuggerFoundation.Debugger.LLDB"); xout.Attribute("selectedLauncherIdentifier", "Xcode.DebuggerFoundation.Launcher.LLDB"); - xout.Attribute("launchStyle", "0"); + { + cmValue launchMode = + this->Target->GetTarget()->GetProperty("XCODE_SCHEME_LAUNCH_MODE"); + std::string value = "0"; // == 'AUTO' + if (launchMode && *launchMode == "WAIT") { + value = "1"; + } + xout.Attribute("launchStyle", value); + } WriteCustomWorkingDirectory(xout, configuration); xout.Attribute("ignoresPersistentStateOnLaunch", "NO"); diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake index be44ecd..efd70cf 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake @@ -43,6 +43,8 @@ check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED" "enableGPUFrameCaptureMo check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL" "enableGPUFrameCaptureMode=\"1\"") check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE" "enableGPUFrameCaptureMode=\"3\"") check_property("ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE" "enableGPUFrameCaptureMode=\"1\"") +check_property("LAUNCH_MODE_AUTO" "launchStyle=\"0\"") +check_property("LAUNCH_MODE_WAIT" "launchStyle=\"1\"") check_property("EXECUTABLE" "myExecutable") check_property("ARGUMENTS" [=["--foo"]=]) diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake index 126a9fc..5edbc89 100644 --- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake @@ -38,6 +38,8 @@ create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED ENABLE_GPU_FRA create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_METAL ENABLE_GPU_FRAME_CAPTURE_MODE Metal) create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_DISABLED_MIXED_CASE ENABLE_GPU_FRAME_CAPTURE_MODE DISAbled) create_scheme_for_property(ENABLE_GPU_FRAME_CAPTURE_MODE_METAL_MIXED_CASE ENABLE_GPU_FRAME_CAPTURE_MODE METal) +create_scheme_for_property(LAUNCH_MODE_AUTO LAUNCH_MODE AUTO) +create_scheme_for_property(LAUNCH_MODE_WAIT LAUNCH_MODE WAIT) create_scheme_for_property(EXECUTABLE EXECUTABLE myExecutable) create_scheme_for_property(ARGUMENTS ARGUMENTS "--foo;--bar=baz") create_scheme_for_property(ENVIRONMENT ENVIRONMENT "FOO=foo;BAR=bar") -- cgit v0.12