The first annexation of the Zuid Afrikaansche Republiek by Sir Theophilus Shepstone in 1877 led to the establishment of a military camp on the present premises of the South African Army Headquarters. This camp housed the five thousand strong British force that was garrisoned in Pretoria.
After the departure of the British garrison in 1881, the camp and its buildings were taken over by the Transvaalsche Rijdende Artillerie.
Several poorly planned buildings were found on the site in the early 1890s. As a result of the deteriorating conditions Klaas van Rijsse, an architect was commissioned to design the artillery camp in a neo-renaissance style.
Construction began in August 1895 and during the next three years stables, buildings for cannon and wagons, magazines, a machine building and a barracks for the troops were constructed. 15 Houses were also built for the officers just north of the complex. 
In 1900 there was an attemp to blow up the Artillery Barracks and magazine by the Boer's during british rule.The incedent was averted by  A sentry who observed a Boer in a suspicious attitude near the barracks, and on closer scrutiny found him in the act of lighting a time fuse connected with the magazine. The sentry flung himself on the man and extinguished the fuse, but he was stabbed in the neck and died. Two other soldiers then seized the miscreant and overpowered him, handing him over to the guard. Had the attempt succeeded the explosion would probably have levelled the barracks and killed almost everybody within.
 
After numerous discussions the decision was taken in 1924 to construct a new building in front of the old barracks. This three storey building was to accommodate the General staff, and thus became known as the General building.
Further alterations to the artillery camp were also proposed. One of these proposals was the construction of a drill hall on the western side of the machine building. The construction of the drill hall in 1927 defaced the original structure of the machine building forever.
The entire complex was declared a national monument in the 1970s and was scheduled by the Department of Public Works for restoration in 1997. This saw the restoration of the Machine Building which now houses the library.
 
This building is grand in an uncompromising manner, as with most of the PWD ZAR (Departement Publieke Werken, Zuid-Afrikaansche Republiek) buildings it is constructed of the usual red brick and ochre, with a corrugated-iron roof. The elongated double-storied building is divided into the usual five sections: an ornate central section is flanked by two recessed, simple blocks containing the main portions of the building; and at either end, pavilion-like end-pieces. These together with the central section, have square turreted (a small tower) roofs terminated by finials (an ornament at the top of a gable or roof ridge) and a clock tower forming a slender centre-piece.
 
A historic account of the building was written in a letter from a Hawke's Bay Trooper. Trooper W. Heslcp, writing from Pretoria to his father, at Omaranui, and was issued in the Hawke's Bay Herald, Volume XXXV, Issue 11674 on the 24 October 1900. The following is a segment out of the letter he wrote:
"The finest building in Pretoria is undoubtedly the Artillery Barracks. It is constructed of brick and stone, and is a credit to any town in the world. Almost every person stepping out of the train here expresses surprise at the magnitude of the building, and can scarcely believe when told it was erected by the Boers for the use of their soldiers. The entrance to the building is across a court-yard dotted with trees, Old England's oak and elm being in the majority. This court-yard is lit up with eleotric light, the plant being connected with the building. To enter you pass under a magnificent arch, and over this is hung a powerful electric light, which could expose to view what a man has had for dinner. The corridors through which you pass remind a person of long narrow rooms about 12ft by 100 yards. On mounting up the steps, each of which is said to have cost a guinea, your eyes then cross a quadrangle, the floor being of tiles beautifully matched. Passing through the different dormitories you pass through another arch, and out to the courtyard, which covers about three acres. Here you find different grades of artillery, from the 100-pounders to 1-pound pom poms. After going through carpenters' and farriers' shops you pass into the best stables and stalls in the military world. Accommodation is provided for over 4000 horses, and over each stall is the name of the animal occupying it. The stalls are partitioned by tongued and grooved American pine (timber is very dear here). From the stables we come to the gun sheds, which are about 50 yards wide by about 160 yards long. Passing down an alleyway brings me to 15 houses built exactly alike. These are the officers' quarters, each building costing £10,000. The whole are lit with the electric light. My health is keeping splendid."
Geolocation
-25° 45' 20.3995", 28° 10' 45.8371"
References

https://able.wiki.up.ac.za/index.php/Artillery_Barracks;_Dequar_Rd_Complex,_Salvokop,_Pretoria

https://www.sahra.org.za/sahris/sites/92258
Further Reading

www.sahistory.org.za/article/first-anglo-boer-war