In order to realize micron scale to millimeter scale phase structure analysis, as well as accurate phase structure analysis of surface uneven samples, X-ray diffractometer named Hawk-II, which can adaptively adjust the diameter of irradiated X-ray beam spot according to the diameter of internal tangential circle at the measured point, is developed by combining X-ray diffraction technology, CCD camera imaging technology and slightly-focusing ploycapillary X-ray control technology. The X-ray source system, six-dimensional linkage motion system, CCD camera, detection system and control system based on LabVIEW are the main components of the Hawk-II. Compared with the 3°–5° divergence of the conventional X-ray source, the divergence of the X-ray emitted by the slightly-focusing polycapillary X-ray optics is only about 0.15° and also the intensity within the beam spot range is dozens of times stronger. Therefore, the shift of peak position will not appear due to the pores, curvature or uneven surface of the sample, when Hawk-II is used to analyze the samples with irregular surface. The diffraction pattern of the uneven Ren Min Bi five-cent coin are collected in the Hawk-II and PANalytical X-Pert Pro MPD conventional X-ray diffractometer respectively. By comparing the analysis results, it is found that the diffraction peaks measured by the X-Pert Pro MPD are shifted seriously, with a maximum deviation angle of 0.52°. While the diffraction peaks detected by the Hawk-II are basically consistent with the data from the standard PDF card, which verifies the advantages of the analysis of irregular samples by the Hawk-II. In order to explore the difference between different beam spots used for analysis at the same point, red and green porcelain fired in Qing dynasty and GaAs-based Cu and Fe plated films are analyzed by the Hawk-II. It is found that when the samples are relatively uniform, the intensities of diffraction peaks of different beam spots are relatively close, while when the samples are not uniform, the diffraction peaks vary greatly. Especially, some microcrystalline phases can be detected only with large beam spots. In addition, to verify the adaptive functionality of the Hawk-II, a bronze from the Western Han Dynasty, with different rust spots on it, is tested. It is found that the Hawk-II can adjust the beam spot size according to the different corrosion points, making the irradiation area coincide with the area to be analysed and the phase structure detected more accurately. Therefore, the Hawk-II is a general purpose X-ray diffractometer, which has the analytical capability from micron scale to millimeter scale and the energy dispersive X-ray fluorescence analysis function. Moreover, it has the advantages of the accurate analysis of irregular samples, fast detection speed, simple operation, etc. Based on the above analysis, the Hawk-II will be widely used in different fields.