[{"data":1,"prerenderedAt":221},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fdev\u002Fshader-sdk-mac":3,"docs-surround-\u002Fdocs\u002Fdev\u002Fshader-sdk-mac":210},{"id":4,"title":5,"body":6,"description":16,"extension":202,"image":203,"meta":204,"navTitle":203,"navigation":205,"path":206,"seo":207,"stem":208,"__hash__":209},"docs\u002Fdocs\u002Fdev\u002Fshader-sdk-mac.md","Shader SDK (MAC)",{"type":7,"value":8,"toc":194},"minimark",[9,13,17,28,33,36,39,45,48,51,57,60,65,69,88,93,96,99,107,111,116,119,124,129,135,138,143,148,155,160,165,168,172,175,180,183,188,191],[10,11,5],"h1",{"id":12},"shader-sdk-mac",[14,15,16],"p",{},"In this tutorial we will show how to setup Beam Shader SDK on Mac OS",[14,18,19,20,27],{},"The Shader SDK's current version can be characterized as an ",[21,22,23],"em",{},[24,25,26],"strong",{},"early developer preview",", with a high possibility of encountering unusual issues and bugs.",[29,30,32],"h3",{"id":31},"prerequisites","Prerequisites",[14,34,35],{},"You will  need a Python 3.x installed and available in the path (check by typing 'python' in the command line)",[14,37,38],{},"In addition, you will need XCode Command line tools. The command to install those is:",[14,40,41],{},[42,43,44],"code",{},"xcode-select --install",[14,46,47],{},"But please consult with official documentation for more details.",[14,49,50],{},"You will also need the following packages (I used brew to install those):",[14,52,53,56],{},[42,54,55],{},"brew install openssl cmake ninja","\\",[14,58,59],{},"Also, set the OPENSSL_ROOT_DIR environment variable as follows:",[14,61,62],{},[42,63,64],{},"export OPENSSL_ROOT_DIR=\"\u002Fusr\u002Flocal\u002Fopt\u002Fopenssl@1.1\"",[29,66,68],{"id":67},"building-shader-sdk","Building Shader SDK",[70,71,72,82,85],"ol",{},[73,74,75,76],"li",{},"Clone Shader SDK repository from here: ",[77,78,79],"a",{"href":79,"rel":80},"https:\u002F\u002Fgithub.com\u002FBeamMW\u002Fshader-sdk",[81],"nofollow",[73,83,84],{},"Open the Terminal application",[73,86,87],{},"Change directory to the location of the shader-sdk and run:",[14,89,90],{},[42,91,92],{},".\u002Fshade init",[14,94,95],{},"This will operation will install and build all the necessary components.",[14,97,98],{},"Here comes a small song and dance part that has to do with the fact that shader-sdk is still very raw",[70,100,101,104],{},[73,102,103],{},"Inside the shader-sdk folder create a 'bin' folder",[73,105,106],{},"Copy shader-sdk\u002Fbuild\u002Fhost\u002Fbeam\u002Fbvm\u002Fsid_generator\u002Fgenerate-sid to the newly created bin folder",[29,108,110],{"id":109},"creating-a-new-shader-project","Creating a new Shader Project",[70,112,113],{},[73,114,115],{},"Open a Terminal and create a new folder for your Shader project. We will use 'vault' in our example",[14,117,118],{},"2. Set the following environment variables to point to the location of you shader-sdk and wasi-sdk:",[14,120,121],{},[42,122,123],{},"export BEAM_SHADER_SDK=~\u002FCode\u002Fshader-sdk",[14,125,126],{},[42,127,128],{},"export WASI_SDK_PREFIX=~\u002FCode\u002Fshader-sdk\u002Fwasi-sdk-14.0",[14,130,131,132],{},"3. Run the following command: ",[42,133,134],{},"shade create_project \u003Cproject name>",[14,136,137],{},"In our case:",[14,139,140],{},[42,141,142],{},"~\u002FCode\u002Fshader-sdk\u002Fshade create_project vault",[14,144,145],{},[42,146,147],{},"Here comes another issue. Your Mac is very likely to warn you about the fact that generate-sid application was not created by a certified developer",[14,149,150],{},[151,152],"img",{"alt":153,"src":154},"",".gitbook\u002Fassets\u002FScreen%20Shot%202022-11-19%20at%2014.27.00%20(1).png",[14,156,157],{},[42,158,159],{},"To avoid this you will need to allow running this script anyway from the Settings -> Security & Privacy dialogue and then rerunning the command",[14,161,162],{},[151,163],{"alt":153,"src":164},".gitbook\u002Fassets\u002FScreen%20Shot%202022-11-19%20at%2014.27.55.png",[14,166,167],{},"This will initialize the structure of the Shader project",[29,169,171],{"id":170},"building-the-shader-project","Building the Shader Project",[14,173,174],{},"Inside the project folder run the following command:",[14,176,177],{},[42,178,179],{},"cmake -G \"Ninja\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$WASI_SDK_PREFIX\u002Fshare\u002Fcmake\u002Fwasi-sdk.cmake -DCMAKE_SYSROOT=$WASI_SDK_PREFIX\u002Fshare\u002Fwasi-sysroot -DWASI_SDK_PREFIX=$WASI_SDK_PREFIX -DCMAKE_CXX_COMPILER_FORCED=True -DCMAKE_C_COMPILER_FORCED=True -DCMAKE_SYSTEM_NAME=\"WASI\"",[14,181,182],{},"Then run:",[14,184,185],{},[42,186,187],{},"ninja",[14,189,190],{},"And the .wasm files with compiled contracts will be generated in the \u002Fshaders folder",[14,192,193],{},"Now you are ready to start coding your Shader!",{"title":153,"searchDepth":195,"depth":195,"links":196},2,[197,199,200,201],{"id":31,"depth":198,"text":32},3,{"id":67,"depth":198,"text":68},{"id":109,"depth":198,"text":110},{"id":170,"depth":198,"text":171},"md",null,{},true,"\u002Fdocs\u002Fdev\u002Fshader-sdk-mac",{"title":5,"description":16},"docs\u002Fdev\u002Fshader-sdk-mac","XMfxUZidzh-ZQ0yT-lKWdtmBcwpdeAQGivkTIKtl4TE",[211,216],{"title":212,"path":213,"stem":214,"description":215,"children":-1},"Running local blockchain","\u002Fdocs\u002Fdev\u002Frunning-local-blockchain","docs\u002Fdev\u002Frunning-local-blockchain","In this tutorial we will explain how to run local blockchain. It will be extremely useful for testing your dapps locally, before deplying them to public networks",{"title":217,"path":218,"stem":219,"description":220,"children":-1},"Shader SDK (WIN)","\u002Fdocs\u002Fdev\u002Fshader-sdk-win","docs\u002Fdev\u002Fshader-sdk-win","This tutorial demonstrates How-to set up Beam Shader SDK on the Windows operating system.",1783006054291]