banan-os/userspace/programs/create_program.sh

29 lines
392 B
Bash
Raw Normal View History

#!/bin/bash
set -e
PROGRAM_NAME=$1
mkdir $PROGRAM_NAME
cat > $PROGRAM_NAME/CMakeLists.txt << EOF
set(SOURCES
main.cpp
)
add_executable($PROGRAM_NAME \${SOURCES})
banan_link_library($PROGRAM_NAME ban)
banan_link_library($PROGRAM_NAME libc)
install(TARGETS $PROGRAM_NAME OPTIONAL)
EOF
cat > $PROGRAM_NAME/main.cpp << EOF
#include <stdio.h>
int main()
{
printf("Hello World\n");
}
EOF