Python code to produce C++14 hex integer literal with ticks
Python 2, 68 65 bytes

-3 bytes for both thanks to tsh



lambda n:"0x"+re.sub("(?!^)(?=(....)+u)","'","%xuLL"%n)
import re


Try it online!

Eligible for both bonuses, 76 73 bytes

lambda x,d:"0x"+re.sub("(?!^)(?=(....)+u)","'","%%0%dxuLL"%d%x)
import re


Try it online!