-
Notifications
You must be signed in to change notification settings - Fork 0
/
pnew
executable file
·104 lines (99 loc) · 2.38 KB
/
pnew
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
RED="\e[31m"
NOCOLOR="\e[0m"
CYAN="\e[36m"
if [ -z $1 ]
then
echo "Name of package: "
read name
else
name=$1
fi
if [ -d $name ]
then
echo -e "${RED}Package already exists! ($name)"
else
echo -e "[$name] ${CYAN} Creating package: Starting${NOCOLOR}"
echo -e "[$name] ${CYAN} Creating directory${NOCOLOR}"
mkdir $name
echo -e "[$name] ${CYAN} Entering directory${NOCOLOR}"
cd $name
echo -e "[$name] ${CYAN} Initializing git${NOCOLOR}"
git init
echo -e "[$name] ${CYAN} Do you want to include sdl2? (y/n):${NOCOLOR}"
read yon
if [ $yon == "y" ]
then
echo -e "${CYAN}C or C++? (c/c++): ${NOCOLOR}"
read corcpp
if [ $corcpp == "c" ]
then
echo -e '#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hi package!");
}
' > main.c
echo -e "cmake_minimum_required(VERSION 3.10)
project($name)
find_package(PkgConfig)
pkg_check_modules(SDL sdl2)
pkg_check_modules(SDL2_IMAGE SDL2_image)
pkg_check_modules(SDL2_TTF SDL2_ttf)
set(CMAKE_BUILD_TYPE Debug)
add_executable($name main.c)
target_link_libraries($name
SDL2 SDL2_image SDL2_ttf
"'${SDL_LDFLAGS}'" -lm)" > CMakeLists.txt
else
echo -e '#include <iostream>
using namespace std;
int main()
{
cout << "Hi package!";
}
' > main.cpp
echo -e "cmake_minimum_required(VERSION 3.10)
project($name)
find_package(PkgConfig)
pkg_check_modules(SDL sdl2)
pkg_check_modules(SDL2_IMAGE SDL2_image)
pkg_check_modules(SDL2_TTF SDL2_ttf)
set(CMAKE_BUILD_TYPE Debug)
add_executable($name main.cpp)
target_link_libraries($name
SDL2 SDL2_image SDL2_ttf
"'${SDL_LDFLAGS}'" -lm)" > CMakeLists.txt
fi
else
echo -e "${CYAN} C or C++? (c/c++): ${NOCOLOR}"
read corcpp
if [ $corcpp == "c" ]
then
echo -e '#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hi package!");
}
' > main.c
echo -e "cmake_minimum_required(VERSION 3.10)
project($name)
add_executable($name main.c)" > CMakeLists.txt
else
echo -e '#include <iostream>
using namespace std;
int main()
{
cout << "Hi package!";
}' > main.cpp
echo -e "cmake_minimum_required(VERSION 3.10)
project($name)
add_executable($name main.cpp)
" > CMakeLists.txt
fi
fi
echo "build" > .gitignore
echo -e "[$name] ${CYAN} Creating package: Done${NOCOLOR}"
fi