Skip to content

Commit

Permalink
libspatialite: add a workaround for NMakeDeps quoting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Dec 5, 2023
1 parent 2952905 commit 6f2d4a1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions recipes/libspatialite/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def source(self):
def generate(self):
if is_msvc(self):
tc = NMakeToolchain(self)
tc.extra_defines.append("YY_NO_UNISTD_H")
if self.options.shared:
tc.extra_defines.append("DLL_EXPORT")
tc.generate()
deps = NMakeDeps(self)
deps.generate()
Expand Down Expand Up @@ -194,12 +197,15 @@ def _build_msvc(self):
if not self.options.with_minizip:
replace_in_file(self, gaiaconfig_msvc, "#define ENABLE_MINIZIP 1", "")

# Workaround for a NMakeDeps define quoting issue:
# https://github.com/conan-io/conan/issues/13603
replace_in_file(self, os.path.join(self.generators_folder, "conannmakedeps.bat"),
r'/DSQLITE_API#\"__declspec(dllimport)\"',
"/DSQLITE_API#__declspec(dllimport)", strict=False)

target = "spatialite_i.lib" if self.options.shared else "spatialite.lib"
optflags = ["-DYY_NO_UNISTD_H"]
if self.options.shared:
optflags.append("-DDLL_EXPORT")
with chdir(self, self.source_folder):
self.run(f"nmake -f makefile.vc {target} OPTFLAGS=\"{' '.join(optflags)}\"")
self.run(f"nmake -f makefile.vc {target}")

def _build_autotools(self):
# fix MinGW
Expand Down

0 comments on commit 6f2d4a1

Please sign in to comment.