The logic can be presented in several ways, but I would single out two for special mention. Argument A and argument B outlined below have some elements in common but I offer them both because they have different styles and each can teach something useful.
Argument A
We begin by proving Carnot's theorem, which is the theorem that for given thermal reservoirs no engine is more efficient than a reversible engine (where we have in mind a cycle with two adiabatic and two isothermal stages i.e. the Carnot engine) and all reversible engines are equally efficient. Note, the proof of this does not require any definition of temperature beyond an ability to state which of two reservoirs is the hotter one. Also it does not require any particular example of a Carnot engine (it need not involve a gas or even a fluid, for example).
The proof can be done by showing that the existence of a more efficient engine would lead to a machine which could break either the Clausius or the Kelvin statement of the Second Law.
With Carnot's theorem in hand, one can now define absolute temperature $T$. We define $T$ such that if $Q_1$ and $Q_2$ are the heats exchanged at two reservoirs during a cycle of a Carnot engine, then the reservoir temperatures are in the ratio given by
$$
\frac{T_1}{T_2} = \frac{Q_1}{Q_2}. \tag{1}
$$
This is sufficient to define temperature, and Carnot's theorem will then guarantee that all reservoirs having the same temperature thus defined will be found to be in equilibrium with one another if they are brought into thermal contact. Note there is no need to mention any gas, whether ideal or not, in any argument so far.
Finally we come to Boyle's law which says $pV = f(T)$ for an ideal gas, with the function $f(T)$ to be discovered. If we also bring in Joule's law (that $U=U(T)$ for ideal gas) then one can show that for the ideal gas one must have that $f(T)$ is proportional to $T$. Thus one derives the ideal gas equation of state from the combination {Boyle's law, Joule's law, defn of temperature}.
Once one has the ideal gas equation of state, one can show that the heats exchanged for a Carnot cycle of an ideal gas obey the equation (1) given above. But this has to happen because that equation was used to derive the ideal gas equation of state! If instead one claims to know the ideal gas equation of state at the outset, then the argument amounts to showing that the $T$ mentioned in the ideal gas equation of state must be proportional to the absolute temperature whose definition is given above.
(By the way, arguments involving the ideal gas cannot be used to define temperature in general because the ideal gas is itself an impossible and inconsistent system at low enough temperature at any given density.)
Argument B
For argument B one takes as starting-point the entropy statement of the Second Law, which asserts that every isolated system has a function of state called entropy which is extensive and whose value is maximised in thermal equilibrium. One then defines
$$
T \equiv \left. \frac{\partial U}{\partial S} \right|_{V,N}
$$
and one goes on to consider heat transfer. One notes that during reversible heat transfer, the entropy functions of the two systems involved change by $\Delta Q/T$ (one going up, the other going down), and that reversible process must involve no change in entropy for an isolated system. From this it follows that the heats transferred in a Carnot cycle must be in proportion to $T_1/T_2$. One can then invoke the same reasoning as in argument A to derive the equation of state of an ideal gas, or to show that the ideal gas temperature given by $pV$ must be proportional to the absolute temperture (in the limit where the ideal gas makes sense as a physical system).