It's generally acknowledged that deliberate and indiscriminate targeting of cities, even with a military objective, can be viewed as contrary to the principles of the laws of war.
There is no need for weasel words. Indiscriminate attacks are explicitly forbidden in Article 51 of the 1977 Protocol Additional to the Geneva Conventions:
Indiscriminate attacks are prohibited. Indiscriminate attacks are:
(a) those which are not directed at a specific military objective;
(b) those which employ a method or means of combat which cannot be directed at a specific military objective; or
(c) those which employ a method or means of combat the effects of which cannot be limited as required by this Protocol;
and consequently, in each such case, are of a nature to strike military objectives and civilians or civilian objects without distinction.
That is, indiscriminate attacks are war crimes, regardless of where they happen.
So, I wonder, why isn't the bombing of cities under any circumstance considered a war crime, full stop?
Bombing entire cities is an indiscriminate attack and therefore a war crime.
What is allowed is bombing military targets within cities, provided your aim is good enough to meet the standard of proportionality as set out in paragraph 5b of article 51:
Among others, the following types of attacks are to be considered as indiscriminate:
(a) an attack by bombardment by any methods or means which treats as a single military objective a number of clearly separated and distinct military objectives located in a city, town, village or other area containing a similar concentration of civilians or civilian objects; and
(b) an attack which may be expected to cause incidental loss of civilian life, injury to civilians, damage to civilian objects, or a combination thereof, which would be excessive in relation to the concrete and direct military advantage anticipated.
That is, you may engage military targets in cities as long as incidental suffering of civilians is not "excessive in relation to the concrete and direct military advantage anticipated".
Now, you are correct that this is a judgement call. However, there is a lengthy commentary, as well as some case law, which I can not reproduce here in their entirety.
One paragraph of this commentary is relevant to your question though:
The delegation which voted against justified its vote by arguing that the article could seriously hinder the conduct of military operations against an invader and compromise the exercise of the right to self-defence recognized in Article 51 of the Charter of the United Nations. According to this delegation, the provisions relating to indiscriminate attacks should not be such as to prevent a State from defending its territory against an invader, even if this were to entail losses in its own population. Several delegations made similar statements.
That is, there were concerns that outlawing combat in cities would "seriously hinder the conduct of military operations against an invader". I think that explains why the diplomatic conference chose not to outlaw urban combat entirely, but permitted it as long as attacks meet the standards of distinction, proportionality, and precaution.
I specifically mean using heavy weapons such as rockets, bombs, artillery, etc., as I understand that sometimes warfare occurs in cities. In such cases, only light weapons that don't cause severe damage to cities should be used.
That's pretty much what the Geneva Conventions say. The only difference is that the Geneva Conventions only protect civilians and civilian objects, not cities entire. Military objectives in cities may be attacked as long as the attack is carried out with sufficient distinction, proportionality, and precaution to avoid excess injury to civilians. In practice, this means that weapons must not leave craters greater than the target. But if a city contains a sufficiently large military target (say, a military base), the use of heavy weaponry is allowed as long as it can be expected to be mostly on target.
However, the rules provide too much leeway for armies to avoid clearly classifying their attacks as war crimes
[citation needed] [opinion] [unsubstantiated]