Skip to content

Commit

Permalink
Merge pull request #46 from cmaker-dev/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
lsproule authored Nov 7, 2023
2 parents 1b68b25 + cb89ce0 commit 3c2b01d
Show file tree
Hide file tree
Showing 49 changed files with 4,137 additions and 418 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: CMake on a single platform

on:
push:
pull_request:
branches: [ "dev" ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
install_manifest.txt
build/*
build
.cache
.cache/*
.cmake
Makefile
DartConfiguration.txt
config.toml
CMakeFiles
CMakeCache.txt
Expand Down
2 changes: 1 addition & 1 deletion CLEAN_EVERYTHIN.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rm -rf ./_deps ./CMakeCache.txt ./CMakeFiles
rm -rf ./_deps ./CMakeCache.txt ./CMakeFiles build/*
make clean
rm -rf ./Makefile
sudo xargs rm -rf < install_manifest.txt
25 changes: 19 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,18 @@ FetchContent_Declare(
GIT_REPOSITORY "https://github.com/curl/curl.git"
GIT_TAG "curl-8_3_0"
)

FetchContent_Declare(
termcolor
GIT_REPOSITORY "https://github.com/ikalnytskyi/termcolor.git"
GIT_TAG "v2.1.0"
)
)

FetchContent_MakeAvailable(nlohmann_json)
FetchContent_MakeAvailable(cxxopts)
FetchContent_MakeAvailable(curl)
FetchContent_MakeAvailable(termcolor)




file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR}
"src/**.cpp"
"src/**.c"
Expand Down Expand Up @@ -98,12 +96,27 @@ else()
endif()
endif()

target_link_libraries(${PROJECT_NAME} curl)
target_link_libraries(${PROJECT_NAME} libcurl)
target_link_libraries(${PROJECT_NAME} cxxopts)
target_link_libraries(${PROJECT_NAME} nlohmann_json)
target_link_libraries(${PROJECT_NAME} termcolor::termcolor)

set(SOURCE_DIR src)
set(BUILD_DIR build)
set_target_properties(cmaker PROPERTIES RUNTIME_OUTPUT_DIRECTORY build)
install(TARGETS cmaker DESTINATION bin)
install(FILES ./completions/cmaker-completion.zsh
DESTINATION /usr/local/share/zsh/site-functions/
RENAME _cmaker)
install(FILES ./completions/cmaker-completion.bash
DESTINATION /etc/bash_completion.d/
RENAME cmaker)
install(FILES ./completions/cmaker-completion.fish
DESTINATION /usr/share/fish/vendor_completions.d
RENAME cmaker.fish)

if(NOT DEFINED MAN_INSTALL_DIR)
set(MAN_INSTALL_DIR "share/man/man1")
endif()

add_custom_target(man ALL DEPENDS docs/man/cmaker.1)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/docs/man/cmaker.1" DESTINATION "${MAN_INSTALL_DIR}")
1 change: 0 additions & 1 deletion CTestTestfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# testing this directory and lists subdirectories to be tested as well.
subdirs("_deps/nlohmann_json-build")
subdirs("_deps/cxxopts-build")
subdirs("_deps/tomlplusplus-build")
subdirs("_deps/curl-build")
subdirs("_deps/termcolor-build")
subdirs("_deps/catch2-build")
106 changes: 0 additions & 106 deletions DartConfiguration.tcl

This file was deleted.

33 changes: 33 additions & 0 deletions completions/cmaker-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
_cmaker() {
local cur prev words cword
_get_comp_words_by_ref -n : cur prev words cword

local commands="init run watch add ftp help"
local add_subcommands="dep lib flags"

case "${prev}" in
add)
COMPREPLY=($(compgen -W "${add_subcommands}" -- "${cur}"))
return 0
;;
esac

case "${words[1]}" in
add)
if [ "$cword" -eq 2 ]; then
COMPREPLY=($(compgen -W "${add_subcommands}" -- "${cur}"))
return 0
fi
;;
*)
if [ "$cword" -eq 1 ]; then
COMPREPLY=($(compgen -W "${commands}" -- "${cur}"))
return 0
fi
;;
esac

COMPREPLY=()
}

complete -F _cmaker cmaker
27 changes: 27 additions & 0 deletions completions/cmaker-completion.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function __fish_cmaker_needs_command
set -l cmd (commandline -opc)
if test (count $cmd) -eq 1
return 0
end
return 1
end

function __fish_cmaker_using_command
set -l cmd (commandline -opc)
set -e cmd[1]
if contains -- $argv[1] $cmd
return 0
end
return 1
end

function __fish_cmaker_needs_subcommand
set -l cmd (commandline -opc)
if test (count $cmd) -eq 2
return 0
end
return 1
end

complete -c cmaker -n '__fish_cmaker_needs_command' -a 'init run watch add ftp help' -f
complete -c cmaker -n '__fish_cmaker_using_command add' -a 'dep lib flags' -f
44 changes: 44 additions & 0 deletions completions/cmaker-completion.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#compdef cmaker

_cmaker() {
local state
local -a options
local -a cmd

_arguments -C \
'1: :->command' \
'2: :->subcommand' \
'*::arg:->args'

options=(
'init:Initializes your project'
'run:Builds and runs your project'
'watch:Watches builds and runs your project on changes'
'add:[dep, lib, flags] Add library, dependecy or flags to your project'
'ftp:Delets the entire project (F*ck this project)'
'help:Print help'
)

add_options=(
'dep:Add a dependecy <dep>'
'lib:Add a library <lib>'
'flags:Add a flag <flag>'
)

case $state in
command)
_describe -t commands "command" options
;;
subcommand)
case $words[2] in
add)
_describe -t subcommands "subcommand" add_options
esac
;;
args)
# Leaving empty for now
;;
esac
}

_cmaker "$@"
61 changes: 61 additions & 0 deletions docs/man/cmaker.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.TH "cmaker" "1" "2023-11-05" "cmaker" "cmaker manual"
.SH "NAME"
\fBcmaker - c/cpp package manager\fR
.SH SYNOPSIS
.P
\fBcmaker <sub\-command>\fR
.SH DESCRIPTION
.P
\fBCmaker\fR came to fruition out of the desperate hopes and dreams of a few people looking to softly lighten their suffering while using c++\.
.SH init
.P
Initializes your project\. You'll be prompted with information to enter and cmaker will take care of the rest\.
.br
This will create a cmake file, 1 source file in src directory and config\.toml, where cmaker specific configuration is stored\.
.SS options
.SS \-y | \-\-skip\-init
.P
Skips initialization\.
.SS \-n | \-\-name example\-name
.P
Name of your project
.SS \-l | \-\-language cpp/c
.P
Language of your choice, c or cpp\.
.SH run
.P
Builds and runs your project\.
.SH watch
.P
Same a run command, but also watches file changes and rebuilds your project accordingly\.
.SH add
.P
This command adds a dependency, library or flag to your project\.
.br
\fBSubcommands:\fR
.SS dep
.P
Searches and adds dependency to your project\.
.br
Example:
.RS 2
.nf
cmaker add dep sdl
.fi
.RE
.P
You'll be shown found results and will be promted to choose from the list\.
.SS lib
.P
Searches and adds library to your project\.
.SS flags
.P
Adds flag to your project\.
.SH ftp
.P
Deletes the entire project :)\.
.br
Why?
.br
Why not?

Loading

0 comments on commit 3c2b01d

Please sign in to comment.