Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nanopb/nanopb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2023-10-20 10:03:43 +0300
committerPetteri Aimonen <jpa@github.mail.kapsi.fi>2023-10-27 13:37:50 +0300
commitf5593b78ba0984c8a4d8382f93b17ee7dd490ba8 (patch)
treedc06de82945cf6984569156dadbbac6c50da8de3
parent79549005b9116d7d990f3af5f3470f2bc692a264 (diff)
CMakeLists: reorder generator installation commands
-rw-r--r--CMakeLists.txt45
1 files changed, 25 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d359c8f..5a2c3d0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,8 +86,17 @@ if(nanopb_BUILD_GENERATOR)
install( FILES generator/__init__.py
DESTINATION ${PYTHON_INSTDIR}/nanopb/ )
- # Include the full path to Python executable in Windows .bat scripts, in case it is not in PATH
+ # Install a script that calls nanopb.generator Python module when invoked
+ install(
+ PROGRAMS
+ extra/script_wrappers/nanopb_generator.py
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
+
+ # Install shell/bat script wrappers for invoking nanopb_generator.py.
+ # protoc-gen-nanopb is automatically used by protoc when --nanopb_out= option is used.
if(WIN32)
+ # Include the full path to Python executable in Windows .bat scripts, as it is not in PATH on all systems
file(READ generator/protoc-gen-nanopb.bat FILE_CONTENTS)
string(REPLACE "python" ${Python_EXECUTABLE} FILE_CONTENTS "${FILE_CONTENTS}")
file(WRITE ${PROJECT_BINARY_DIR}/protoc-gen-nanopb.bat "${FILE_CONTENTS}")
@@ -95,26 +104,22 @@ if(nanopb_BUILD_GENERATOR)
file(READ generator/nanopb_generator.bat FILE_CONTENTS)
string(REPLACE "python" ${Python_EXECUTABLE} FILE_CONTENTS "${FILE_CONTENTS}")
file(WRITE ${PROJECT_BINARY_DIR}/nanopb_generator.bat "${FILE_CONTENTS}")
- endif()
-endif()
-# Install small script wrappers to invoke the generator from the installed module
-if(WIN32)
- install(
- PROGRAMS
- extra/script_wrappers/nanopb_generator.py
- ${PROJECT_BINARY_DIR}/protoc-gen-nanopb.bat
- ${PROJECT_BINARY_DIR}/nanopb_generator.bat
- DESTINATION ${CMAKE_INSTALL_BINDIR}
- )
-else()
- install(
- PROGRAMS
- extra/script_wrappers/nanopb_generator.py
- generator/protoc-gen-nanopb
- generator/nanopb_generator
- DESTINATION ${CMAKE_INSTALL_BINDIR}
- )
+ install(
+ PROGRAMS
+ ${PROJECT_BINARY_DIR}/protoc-gen-nanopb.bat
+ ${PROJECT_BINARY_DIR}/nanopb_generator.bat
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
+ else()
+ # Linux/Mac scripts currently use python3 from PATH
+ install(
+ PROGRAMS
+ generator/protoc-gen-nanopb
+ generator/nanopb_generator
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
+ endif()
endif()
if(nanopb_BUILD_RUNTIME)