You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
|
11 years ago
|
#!/usr/bin/python
|
||
|
|
#snippet plugin
|
||
|
|
import juci_to_python_api as juci, inspect
|
||
|
|
import sys, os
|
||
|
|
|
||
|
|
def initPlugin():
|
||
|
|
juci.addMenuElement("CreateProject")
|
||
|
|
juci.addSubMenuElement("CreateProjectMenu", #name of parent menu
|
||
|
|
"Create new project", #menu description
|
||
|
|
"newProject()", #function to execute
|
||
|
|
inspect.getfile(inspect.currentframe()), #plugin path
|
||
|
|
"<control><alt>p")
|
||
|
|
|
||
|
|
def newProject():
|
||
|
|
path='../Projects/newtestProject/'
|
||
|
|
if not os.path.exists(path):
|
||
|
|
os.makedirs(path)
|
||
|
|
cmake=path+'CMakeLists.txt'
|
||
|
|
main=path+'main.cpp'
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
cmakefile = open(cmake, 'w')
|
||
|
|
|
||
|
|
cmakefile.write("""\
|
||
|
|
cmake_minimum_required (VERSION 2.8.4)
|
||
|
|
set(project_name newtestproject)
|
||
|
|
project (${project_name})
|
||
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||
|
|
|
||
|
|
INCLUDE(FindPkgConfig)
|
||
|
|
|
||
|
|
add_executable(main
|
||
|
|
main.cpp
|
||
|
|
)
|
||
|
|
""")
|
||
|
|
|
||
|
|
mainfile = open(main, 'w')
|
||
|
|
|
||
|
|
mainfile.write("""\
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
int main(int argc, char *argv[]) {
|
||
|
|
std::cout << "Hello, world!" << std::endl;
|
||
|
|
}
|
||
|
|
""")
|
||
|
|
|