Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

further enhancements #119

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function(target_include_directories target)

if(NOT COMMAND _target_include_directories)
cmake_parse_arguments("" "SYSTEM;BEFORE;PUBLIC;INTERFACE;PRIVATE" "" "" ${ARGN} )
message(DEBUG "using fallback version of target_include_directories, consider upgrading to cmake >= 2.8.10")
# message(DEBUG "using fallback version of target_include_directories, consider upgrading to cmake >= 2.8.10")

if(_SYSTEM OR _BEFORE OR _INTERFACE OR _PRIVATE)
message(FATAL_ERROR "shim for target_include_directories does not support SYSTEM, PRIVATE, INTERFACE or BEFORE upgrade to cmake >= 2.8.10")
Expand Down
27 changes: 27 additions & 0 deletions cmake/cmakepp/cmakepp_configure.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function(cmakepp_configure project_path)
print_Vars(project_path)

pwd()
ans(cwd)
print_Vars(cwd)



if(NOT EXISTS "${project_path}/CMakeLists.txt")
throw("no cmakelists found")
endif()


pushd(--create "${project_path}/build")


cmake(..)

popd()




return(ok)

endfunction()
21 changes: 18 additions & 3 deletions cmake/cmakepp/cmakepp_project_cli.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function(cmakepp_project_cli)
if(verbose)

event_addhandler("on_log_message" "[](entry)message(FORMAT '{entry.function}: {entry.message}')")
event_addhandler("project_on_new" "[](entry) message(FORMAT '{event.event_id}')")
event_addhandler("project_on_opening" "[](proj) message(FORMAT '{event.event_id}: {proj.content_dir}'); message(PUSH)")
event_addhandler("project_on_opened" "[](proj) message(FORMAT '{event.event_id}')")
event_addhandler("project_on_loading" "[](proj) message(FORMAT '{event.event_id}'); message(PUSH)")
Expand All @@ -41,6 +42,9 @@ function(cmakepp_project_cli)
endif()


list_pop_front(args)
ans(cmd)

list_extract_flag(args --save)
ans(save)

Expand All @@ -56,18 +60,28 @@ function(cmakepp_project_cli)
else()
project_read("${project_dir}")
ans(project)
## removes the current config directory
if("${cmd}" STREQUAL reinit)
map_tryget("${project}" project_descriptor )
ans(project_descriptor)
map_tryget("${project_descriptor}" config_dir)
ans(config_dir)
project_close("${project}")
log("reinitializing project - deleting config dir ${project_dir}/${config_dir}")
rm(-r "${project_dir}/${config_dir}")
set(cmd init)
endif()
endif()

list_pop_front(args)
ans(cmd)

if(NOT cmd)
set(cmd run)
endif()

## creates the project int the specified path
if("${cmd}" STREQUAL "init")
list_pop_front(args)
ans(path)
log("initializeing project in ${path}")
project_open("${path}")
ans(project)
endif()
Expand All @@ -90,6 +104,7 @@ function(cmakepp_project_cli)


if("${cmd}" STREQUAL "init")

elseif("${cmd}" STREQUAL "get")

if("${args}" MATCHES "(.+)\\((.*)\\)$")
Expand Down
46 changes: 0 additions & 46 deletions cmake/core/dbg.cmake

This file was deleted.

Empty file removed cmake/core/err.cmake
Empty file.
19 changes: 10 additions & 9 deletions cmake/core/exception/exception_new.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
## an exception is map `<exception> ::= { message: <string> }` of $type `exception`
## if checked in an if statement it evaluates to false because it ends with -NOTFOUND
##
function(exception_new message)
function(exception_new)
address_new()
ans(error)
set(error "${error}-NOTFOUND")
map_set(${error} message "${message}")
if(ARGN)
map_set(${error} inner_exceptions ${ARGN})
endif()
map_set_special(${error} $type exception)
return_ref(error)
ans(exception)
set(exception "${exception}-NOTFOUND")
set(args ${ARGN})
list_pop_front(args)
ans(code)
map_set(${exception} code "${code}")
map_set(${exception} message ${args})
map_set_special(${exception} $type exception)
return_ref(exception)
endfunction()
53 changes: 10 additions & 43 deletions cmake/core/message.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@

function(message)
cmake_parse_arguments("" "PUSH_AFTER;POP_AFTER;DEBUG;INFO;FORMAT;PUSH;POP" "LEVEL" "" ${ARGN})
set(log_level ${_LEVEL})
set(text ${_UNPARSED_ARGUMENTS})
cmake_parse_arguments("" "PUSH_AFTER;POP_AFTER;INFO;FORMAT;PUSH;POP" "" "" ${ARGN})
## format
if(_FORMAT)
format("${_UNPARSED_ARGUMENTS}")
ans(text)
else()
set(text ${_UNPARSED_ARGUMENTS})
endif()


## indentation
if(_PUSH)
Expand All @@ -24,26 +30,7 @@ function(message)
## end of indentationb


## log_level
if(_DEBUG)
if(NOT log_level)
set(log_level 3)
endif()
set(text STATUS ${text})
endif()
if(_INFO)
if(NOT log_level)
set(log_level 2)
endif()
set(text STATUS ${text})
endif()
if(NOT log_level)
set(log_level 0)
endif()

if(NOT MESSAGE_LEVEL)
set(MESSAGE_LEVEL 3)
endif()

list(GET text 0 modifier)
if(${modifier} MATCHES "FATAL_ERROR|STATUS|AUTHOR_WARNING|WARNING|SEND_ERROR|DEPRECATION")
Expand All @@ -52,15 +39,8 @@ function(message)
set(modifier)
endif()

## format
if(_FORMAT)
format( "${text}")
ans(text)
endif()


if(NOT MESSAGE_DEPTH )
set(MESSAGE_DEPTH -1)
endif()

if(NOT text)
return()
Expand All @@ -70,22 +50,9 @@ function(message)
ans(message)
map_set(${message} text "${text}")
map_set(${message} indent_level ${message_indent_level})
map_set(${message} log_level ${log_level})
map_set(${message} mode "${modifier}")
event_emit(on_message ${message})

if(log_level GREATER MESSAGE_LEVEL)
return()
endif()
if(MESSAGE_QUIET)
return()
endif()
# check if deep message are to be ignored
if(NOT MESSAGE_DEPTH LESS 0)
if("${message_indent_level}" GREATER "${MESSAGE_DEPTH}")
return()
endif()
endif()

tock()

Expand Down
45 changes: 45 additions & 0 deletions cmake/csharp/csharp_project.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
function(csharp_project name)
set(sources ${ARGN})
message(csharp_project)
endfunction()


function(cmake_configure project_root)
set(args ${ARGN})

list_extract_flag(args --clean)
ans(clean)

pushd("${project_root}")
ans(project_root)

if(EXISTS "${project_root}" AND clean)
rm(-r build)
endif()

pushd(--create build)
cmake(.. --passthru)
rethrow()
popd()
popd()
return()
endfunction()


function(cmake_build project_root)
message("starting build")
pushd("${project_root}")
ans(project_root)
if(NOT EXISTS "${project_root}/build")
cmake_configure("${project_root}" ${ARGN})
rethrow()
endif()
pushd("build")
cmake(--build . --passthru)
rethrow()
popd()
popd()

return()
endfunction()

36 changes: 0 additions & 36 deletions cmake/debugging/breakpoint.cmake

This file was deleted.

1 change: 0 additions & 1 deletion cmake/filesystem/file_map_write.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

## writes a file_map to the pwd.
## empty directories are not created
## fm is parsed according to obj()
Expand Down
1 change: 0 additions & 1 deletion cmake/filesystem/fwrite_temp.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

##
##
## creates a temporary file containing the specified content
Expand Down
1 change: 1 addition & 0 deletions cmake/filesystem/globbing/glob.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ function(glob)

return_ref(paths)
endfunction()

17 changes: 17 additions & 0 deletions cmake/filesystem/globbing/glob_single.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

##
##
## returns a single file name to which the glob expression matches
## if the glob expression matches multiple files then nothing is returned
function(glob_single)
glob(${ARGN})
ans(found)


list(LENGTH found len)
if(${len} EQUAL 1)
return_ref(found)
endif()

return()
endfunction()
Loading