YosysHQ / nextpnr

nextpnr portable FPGA place and route tool
ISC License
1.3k stars 243 forks source link

ChipDBs build flag for windows #521

Open davidcorrigan714 opened 3 years ago

davidcorrigan714 commented 3 years ago

I'm working on getting nextpnr & prjtrellis compiled on windows and I've made good progress except something seems off about loading the chipdbs - namely that it seems to take an extra compiler flag to make it work properly on windows. Browsing through the code I see it's looking for the WIN32 flag, which seems to pick the right loading function if I add it to the compiler command line, but maybe it should be _WIN32 to pick up windows builds automatically?

whitequark commented 3 years ago

The situation with WIN32 and _WIN32 is a bit complicated; in short, _WIN32 is always defined by a compiler targeting Windows, and WIN32 is defined somewhere else. That "somewhere else" is the project template in case of MSVC, and the system headers in case of MinGW.

Your conclusion is correct, common/embed.{cc,h} should use _WIN32 instead of WIN32.

davidcorrigan714 commented 3 years ago

I'll submit a PR for it in the next few days.