mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Generate appropriate project for CLion IDE and CVS // Resolve #523
This commit is contained in:
@ -12,6 +12,8 @@ PlatformIO 2.0
|
|||||||
(`issue #527 <https://github.com/platformio/platformio/issues/527>`_)
|
(`issue #527 <https://github.com/platformio/platformio/issues/527>`_)
|
||||||
* Improved handling of String-based ``CPPDEFINES`` passed to extra ``build_flags``
|
* Improved handling of String-based ``CPPDEFINES`` passed to extra ``build_flags``
|
||||||
(`issue #526 <https://github.com/platformio/platformio/issues/526>`_)
|
(`issue #526 <https://github.com/platformio/platformio/issues/526>`_)
|
||||||
|
* Generate appropriate project for CLion IDE and CVS
|
||||||
|
(`issue #523 <https://github.com/platformio/platformio/issues/523>`_)
|
||||||
* Fixed issue with incorrect handling of user's build flags where the base flags
|
* Fixed issue with incorrect handling of user's build flags where the base flags
|
||||||
were passed after user's flags to GCC compiler
|
were passed after user's flags to GCC compiler
|
||||||
(`issue #528 <https://github.com/platformio/platformio/issues/528>`_)
|
(`issue #528 <https://github.com/platformio/platformio/issues/528>`_)
|
||||||
|
3
examples/ide/clion/.gitignore
vendored
3
examples/ide/clion/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
.pioenvs
|
.pioenvs
|
||||||
|
CMakeListsLocal.txt
|
||||||
|
@ -1,58 +1,51 @@
|
|||||||
cmake_minimum_required(VERSION 3.2)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
project(clion)
|
project(clion)
|
||||||
|
|
||||||
set(PLATFORMIO_CMD platformio)
|
include(CMakeListsLocal.txt)
|
||||||
|
|
||||||
include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/variants/standard")
|
add_definitions(-DF_CPU=16000000L)
|
||||||
include_directories("$ENV{HOME}/.platformio/packages/framework-arduinoavr/cores/arduino")
|
add_definitions(-DARDUINO_ARCH_AVR)
|
||||||
include_directories("$ENV{HOME}/.platformio/packages/toolchain-atmelavr/avr/include")
|
add_definitions(-DARDUINO_AVR_UNO)
|
||||||
include_directories("$ENV{HOME}/.platformio/packages/toolchain-atmelavr/bfd/include")
|
add_definitions(-DARDUINO=10607)
|
||||||
include_directories("$ENV{HOME}/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include")
|
add_definitions(-DPLATFORMIO=020805)
|
||||||
include_directories("$ENV{HOME}/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include-fixed")
|
add_definitions(-D__AVR_ATmega328P__)
|
||||||
|
|
||||||
add_definitions(-DF_CPU=16000000L)
|
add_custom_target(
|
||||||
add_definitions(-DARDUINO_ARCH_AVR)
|
PLATFORMIO_BUILD ALL
|
||||||
add_definitions(-DARDUINO_AVR_UNO)
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run
|
||||||
add_definitions(-DARDUINO=10607)
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
add_definitions(-DPLATFORMIO=020701)
|
)
|
||||||
add_definitions(-D__AVR_ATmega328P__)
|
|
||||||
|
add_custom_target(
|
||||||
add_custom_target(
|
PLATFORMIO_UPLOAD ALL
|
||||||
PLATFORMIO_BUILD ALL
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
)
|
||||||
)
|
|
||||||
|
add_custom_target(
|
||||||
add_custom_target(
|
PLATFORMIO_CLEAN ALL
|
||||||
PLATFORMIO_UPLOAD ALL
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
)
|
||||||
)
|
|
||||||
|
add_custom_target(
|
||||||
add_custom_target(
|
PLATFORMIO_PROGRAM ALL
|
||||||
PLATFORMIO_CLEAN ALL
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
)
|
||||||
)
|
|
||||||
|
add_custom_target(
|
||||||
add_custom_target(
|
PLATFORMIO_UPLOADFS ALL
|
||||||
PLATFORMIO_PROGRAM ALL
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
)
|
||||||
)
|
|
||||||
|
add_custom_target(
|
||||||
add_custom_target(
|
PLATFORMIO_UPDATE_ALL ALL
|
||||||
PLATFORMIO_UPLOADFS ALL
|
COMMAND ${PLATFORMIO_CMD} -f -c clion update
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
)
|
||||||
)
|
|
||||||
|
add_executable(clion
|
||||||
add_custom_target(
|
src/blink.cpp
|
||||||
PLATFORMIO_UPDATE_ALL ALL
|
)
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion update
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(clion
|
|
||||||
src/blink.cpp
|
|
||||||
)
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (2, 8, "5.dev0")
|
VERSION = (2, 8, "5.dev1")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
2
platformio/ide/tpls/clion/.gitignore.tpl
Normal file
2
platformio/ide/tpls/clion/.gitignore.tpl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.pioenvs
|
||||||
|
CMakeListsLocal.txt
|
@ -1,73 +1,60 @@
|
|||||||
cmake_minimum_required(VERSION 3.2)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
project({{project_name}})
|
project({{project_name}})
|
||||||
|
|
||||||
set(ENV{PATH} "{{env_path}}")
|
include(CMakeListsLocal.txt)
|
||||||
set(PLATFORMIO_CMD "{{platformio_path}}")
|
|
||||||
|
% for define in defines:
|
||||||
% for include in includes:
|
add_definitions(-D{{!define}})
|
||||||
% if include.startswith(user_home_dir):
|
% end
|
||||||
% if "windows" in systype:
|
|
||||||
include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
|
add_custom_target(
|
||||||
% else:
|
PLATFORMIO_BUILD ALL
|
||||||
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run
|
||||||
% end
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
% else:
|
)
|
||||||
include_directories("{{include.replace("\\", "/")}}")
|
|
||||||
% end
|
add_custom_target(
|
||||||
% end
|
PLATFORMIO_UPLOAD ALL
|
||||||
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload
|
||||||
% for define in defines:
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
add_definitions(-D{{!define}})
|
)
|
||||||
% end
|
|
||||||
|
add_custom_target(
|
||||||
add_custom_target(
|
PLATFORMIO_CLEAN ALL
|
||||||
PLATFORMIO_BUILD ALL
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
)
|
||||||
)
|
|
||||||
|
add_custom_target(
|
||||||
add_custom_target(
|
PLATFORMIO_PROGRAM ALL
|
||||||
PLATFORMIO_UPLOAD ALL
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
)
|
||||||
)
|
|
||||||
|
add_custom_target(
|
||||||
add_custom_target(
|
PLATFORMIO_UPLOADFS ALL
|
||||||
PLATFORMIO_CLEAN ALL
|
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
)
|
||||||
)
|
|
||||||
|
add_custom_target(
|
||||||
add_custom_target(
|
PLATFORMIO_UPDATE_ALL ALL
|
||||||
PLATFORMIO_PROGRAM ALL
|
COMMAND ${PLATFORMIO_CMD} -f -c clion update
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
)
|
||||||
)
|
|
||||||
|
% if src_files and any([f.endswith((".c", ".cpp")) for f in src_files]):
|
||||||
add_custom_target(
|
add_executable({{project_name}}
|
||||||
PLATFORMIO_UPLOADFS ALL
|
% for f in src_files:
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs
|
% if f.endswith((".c", ".cpp")):
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
{{f.replace("\\", "/")}}
|
||||||
)
|
% end
|
||||||
|
% end
|
||||||
add_custom_target(
|
)
|
||||||
PLATFORMIO_UPDATE_ALL ALL
|
% else:
|
||||||
COMMAND ${PLATFORMIO_CMD} -f -c clion update
|
#
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
# To enable code auto-completion, please specify path
|
||||||
)
|
# to main source file (*.c, *.cpp) and uncomment line below
|
||||||
|
#
|
||||||
% if src_files and any([f.endswith((".c", ".cpp")) for f in src_files]):
|
# add_executable({{project_name}} src/main_change_me.cpp)
|
||||||
add_executable({{project_name}}
|
% end
|
||||||
% for f in src_files:
|
|
||||||
% if f.endswith((".c", ".cpp")):
|
|
||||||
{{f.replace("\\", "/")}}
|
|
||||||
% end
|
|
||||||
% end
|
|
||||||
)
|
|
||||||
% else:
|
|
||||||
#
|
|
||||||
# To enable code auto-completion, please specify path
|
|
||||||
# to main source file (*.c, *.cpp) and uncomment line below
|
|
||||||
#
|
|
||||||
# add_executable({{project_name}} src/main_change_me.cpp)
|
|
||||||
% end
|
|
||||||
|
14
platformio/ide/tpls/clion/CMakeListsLocal.txt.tpl
Normal file
14
platformio/ide/tpls/clion/CMakeListsLocal.txt.tpl
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
set(ENV{PATH} "{{env_path}}")
|
||||||
|
set(PLATFORMIO_CMD "{{platformio_path}}")
|
||||||
|
|
||||||
|
% for include in includes:
|
||||||
|
% if include.startswith(user_home_dir):
|
||||||
|
% if "windows" in systype:
|
||||||
|
include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
|
||||||
|
% else:
|
||||||
|
include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\", "/")}}")
|
||||||
|
% end
|
||||||
|
% else:
|
||||||
|
include_directories("{{include.replace("\\", "/")}}")
|
||||||
|
% end
|
||||||
|
% end
|
Reference in New Issue
Block a user