2023-06-02 18:40:24 +03:00
|
|
|
#!/bin/bash
|
2023-05-11 18:10:06 +03:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
PROGRAM_NAME=$1
|
|
|
|
|
|
|
|
mkdir $PROGRAM_NAME
|
|
|
|
|
|
|
|
cat > $PROGRAM_NAME/CMakeLists.txt << EOF
|
|
|
|
cmake_minimum_required(VERSION 3.26)
|
|
|
|
|
|
|
|
project($PROGRAM_NAME CXX)
|
|
|
|
|
|
|
|
set(SOURCES
|
|
|
|
main.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_executable($PROGRAM_NAME \${SOURCES})
|
|
|
|
target_compile_options($PROGRAM_NAME PUBLIC -O2 -g)
|
2023-06-02 18:42:25 +03:00
|
|
|
target_link_libraries($PROGRAM_NAME PUBLIC libc)
|
2023-05-11 18:10:06 +03:00
|
|
|
|
|
|
|
add_custom_target($PROGRAM_NAME-install
|
2023-08-23 10:35:16 +03:00
|
|
|
COMMAND sudo cp \${CMAKE_CURRENT_BINARY_DIR}/$PROGRAM_NAME \${BANAN_BIN}/
|
2023-05-11 18:10:06 +03:00
|
|
|
DEPENDS $PROGRAM_NAME
|
2023-08-23 10:35:16 +03:00
|
|
|
USES_TERMINAL
|
2023-05-11 18:10:06 +03:00
|
|
|
)
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > $PROGRAM_NAME/main.cpp << EOF
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
EOF
|