Skip to content

Commit

Permalink
add a test that checks for conflicts with <windows.h>
Browse files Browse the repository at this point in the history
  • Loading branch information
wojdyr committed Mar 22, 2024
1 parent 9f7a8f2 commit 25aa3af
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ endif()
#add_executable(c_test EXCLUDE_FROM_ALL fortran/c_test.c)
#target_link_libraries(c_test PRIVATE cgemmi)

add_executable(cpptest EXCLUDE_FROM_ALL tests/main.cpp tests/cif.cpp)
add_executable(cpptest EXCLUDE_FROM_ALL tests/main.cpp tests/cif.cpp tests/windowsh.cpp)
target_compile_definitions(cpptest PRIVATE USE_STD_SNPRINTF=1)
target_link_libraries(cpptest PRIVATE gemmi_headers)
target_include_directories(cpptest PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/third_party")
Expand Down
106 changes: 106 additions & 0 deletions tests/windowsh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// Test if all gemmi headers can be included after Windows headers.
// Windows headers contain typedefs and macros (#define small char)
// that cause surprising effects when these names are used in the code.
#ifdef _WIN32
#include <windows.h>
#include <gemmi/addends.hpp>
#include <gemmi/align.hpp>
#include <gemmi/assembly.hpp>
#include <gemmi/asudata.hpp>
#include <gemmi/asumask.hpp>
#include <gemmi/atof.hpp>
#include <gemmi/atox.hpp>
#include <gemmi/bessel.hpp>
#include <gemmi/binner.hpp>
#include <gemmi/blob.hpp>
#include <gemmi/bond_idx.hpp>
#include <gemmi/c4322.hpp>
#include <gemmi/calculate.hpp>
#include <gemmi/ccp4.hpp>
#include <gemmi/cellred.hpp>
#include <gemmi/chemcomp.hpp>
#include <gemmi/chemcomp_xyz.hpp>
#include <gemmi/cif.hpp>
#include <gemmi/cif2mtz.hpp>
#include <gemmi/cifdoc.hpp>
#include <gemmi/contact.hpp>
#include <gemmi/crd.hpp>
#include <gemmi/ddl.hpp>
#include <gemmi/dencalc.hpp>
#include <gemmi/dirwalk.hpp>
#include <gemmi/ecalc.hpp>
#include <gemmi/eig3.hpp>
#include <gemmi/elem.hpp>
#include <gemmi/enumstr.hpp>
#include <gemmi/fail.hpp>
#include <gemmi/fileutil.hpp>
#include <gemmi/floodfill.hpp>
#include <gemmi/formfact.hpp>
#include <gemmi/fourier.hpp>
#include <gemmi/fprime.hpp>
#include <gemmi/fstream.hpp>
#include <gemmi/grid.hpp>
#include <gemmi/gz.hpp>
#include <gemmi/input.hpp>
#include <gemmi/intensit.hpp>
#include <gemmi/interop.hpp>
#include <gemmi/it92.hpp>
#include <gemmi/iterator.hpp>
#include <gemmi/json.hpp>
#include <gemmi/levmar.hpp>
#include <gemmi/linkhunt.hpp>
#include <gemmi/math.hpp>
#include <gemmi/metadata.hpp>
#include <gemmi/mmcif.hpp>
#include <gemmi/mmcif_impl.hpp>
//#include <gemmi/mmdb.hpp>
#include <gemmi/mmread.hpp>
#include <gemmi/mmread_gz.hpp>
#include <gemmi/model.hpp>
#include <gemmi/modify.hpp>
#include <gemmi/monlib.hpp>
#include <gemmi/mtz.hpp>
#include <gemmi/mtz2cif.hpp>
#include <gemmi/neighbor.hpp>
#include <gemmi/neutron92.hpp>
#include <gemmi/numb.hpp>
#include <gemmi/pdb.hpp>
#include <gemmi/pdb_id.hpp>
#include <gemmi/pirfasta.hpp>
#include <gemmi/polyheur.hpp>
#include <gemmi/qcp.hpp>
#include <gemmi/read_cif.hpp>
#include <gemmi/read_map.hpp>
#include <gemmi/recgrid.hpp>
#include <gemmi/reciproc.hpp>
#include <gemmi/refln.hpp>
#include <gemmi/remarks.hpp>
#include <gemmi/resinfo.hpp>
#include <gemmi/riding_h.hpp>
#include <gemmi/scaling.hpp>
#include <gemmi/select.hpp>
#include <gemmi/seqalign.hpp>
#include <gemmi/seqid.hpp>
#include <gemmi/seqtools.hpp>
#include <gemmi/serialize.hpp>
#include <gemmi/sfcalc.hpp>
#include <gemmi/small.hpp>
#include <gemmi/smcif.hpp>
#include <gemmi/solmask.hpp>
#include <gemmi/span.hpp>
#include <gemmi/sprintf.hpp>
#include <gemmi/stats.hpp>
#include <gemmi/symmetry.hpp>
#include <gemmi/to_chemcomp.hpp>
#include <gemmi/to_cif.hpp>
#include <gemmi/to_json.hpp>
#include <gemmi/to_mmcif.hpp>
#include <gemmi/to_pdb.hpp>
#include <gemmi/topo.hpp>
#include <gemmi/twin.hpp>
#include <gemmi/unitcell.hpp>
#include <gemmi/utf.hpp>
#include <gemmi/util.hpp>
#include <gemmi/version.hpp>
#include <gemmi/xds_ascii.hpp>
#endif

0 comments on commit 25aa3af

Please sign in to comment.