Created
April 25, 2020 20:54
-
-
Save mao-test-h/c3f42961edee7b0f84cf9f306c8ec0be to your computer and use it in GitHub Desktop.
xcodeprojにccache向けの設定を適用するサンプル
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if UNITY_IOS | |
using System.IO; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using UnityEditor.iOS.Xcode; | |
namespace Samples | |
{ | |
static class CcacheSettings | |
{ | |
/// <summary> | |
/// xcodeprojにccache向けの設定を適用するサンプル | |
/// </summary> | |
[PostProcessBuild] | |
public static void OnPostprocessBuild(BuildTarget buildTarget, string path) | |
{ | |
if (buildTarget == BuildTarget.iOS) | |
{ | |
var pbxProjectPath = PBXProject.GetPBXProjectPath(path); | |
var pbxProject = new PBXProject(); | |
pbxProject.ReadFromString(File.ReadAllText(pbxProjectPath)); | |
// refered to: | |
// https://qiita.com/tani-shi/items/e1493e63a02966ef1bac | |
var target = pbxProject.ProjectGuid(); | |
pbxProject.AddBuildProperty(target, "CC", "$(DT_TOOLCHAIN_DIR)/usr/bin/ccache_wrapper"); | |
pbxProject.SetBuildProperty(target, "LDPLUSPLUS", "$(DT_TOOLCHAIN_DIR)/usr/bin/clang++"); | |
File.WriteAllText(pbxProjectPath, pbxProject.WriteToString()); | |
} | |
} | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment