Repository navigation
Fix BUILD_GEMMA_DLL CMake build, install paths, and C/C# bindings - #1083
akamilkhan wants to merge 1 commit into
Conversation
- Link nlohmann_json::nlohmann_json into gemma_shared in CMakeLists.txt to match libgemma (required by deepseek/dsv4_tokenizer.cc in SOURCES). - Fix BUILD_GEMMA_DLL install paths to point to gemma/bindings/c_api.h, gemma/bindings/context.h, and gemma/bindings/GemmaInterop.cs. - Add CMAKE_POLICY_VERSION_MINIMUM='3.5' to the windows-dll CMake preset to match the windows preset for sentencepiece compatibility. - Declare GemmaSetMaxGeneratedTokens and GemmaSetPrefillTbatchSize in gemma/bindings/c_api.h to match c_api.cc and GemmaInterop.cs. - Guard against null tokenizer_path/weights_path in GemmaContext::Create and remove duplicate threading_args.spin assignment. - Update the GemmaCreate DllImport signature in GemmaInterop.cs to match the 3-parameter C API and constructor call site.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Thanks for the change. Are you able to sign the CLA? |
|
Signed the CLA and rescanned, thanks! On |
Summary
Fixes several build, installation, and binding signature issues in the C API / shared library target (
BUILD_GEMMA_DLL/gemma/bindings/):CMakeLists.txt:nlohmann_json::nlohmann_jsonintogemma_sharedto matchlibgemma(required sincedeepseek/dsv4_tokenizer.ccin${SOURCES}includes<nlohmann/json.hpp>).BUILD_GEMMA_DLLinstall(FILES ...)paths from the non-existentgemma/c_api.handgemma/GemmaInterop.cslocations togemma/bindings/c_api.h,gemma/bindings/context.h, andgemma/bindings/GemmaInterop.cs.CMakePresets.json:"CMAKE_POLICY_VERSION_MINIMUM": "3.5"to thewindows-dllconfigure preset (matching thewindowspreset so CMake 4.x configuressentencepiece).gemma/bindings/c_api.h:GEMMA_APIdeclarations forGemmaSetMaxGeneratedTokensandGemmaSetPrefillTbatchSize(already defined ingemma/bindings/c_api.ccand imported inGemmaInterop.cs).gemma/bindings/context.cc:tokenizer_path/weights_pathinGemmaContext::Createbefore constructingLoaderArgs(const std::string&, const std::string&)(preventing undefined behavior whentokenizer_pathisNULLfor single-file.sbsweights), and remove duplicatethreading_args.spinassignment.gemma/bindings/GemmaInterop.cs:[DllImport("gemma")]declaration ofGemmaCreatefrom the obsolete 5-parameter signature to the 3-parameter signature(tokenizerPath, weightsPath, maxGeneratedTokens)matchingc_api.hand theGemmaconstructor call site.