From 6943ebfd872a41b4b38ab9569c233c021af7ba02 Mon Sep 17 00:00:00 2001 From: Nicholas O'Connor Date: Thu, 23 Mar 2017 14:43:48 -0700 Subject: [PATCH] cogged include/internal/bottles.hpp --- CMakeLists.txt | 3 ++- include/internal/bottles.hpp | 12 ------------ include/internal/bottles.hpp.cog | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 13 deletions(-) delete mode 100644 include/internal/bottles.hpp create mode 100644 include/internal/bottles.hpp.cog diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c53543..bd139ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ foreach(cogfile ${cogfiles}) string(REGEX REPLACE ".cog\$" "" outfile "${cogfile}") set(thisfile "${CMAKE_CURRENT_SOURCE_DIR}/${outfile}") - add_custom_command(OUTPUT "${thisfile}" + add_custom_command(OUTPUT "${thisfile}" PRE_BUILD COMMAND ${PYTHON_EXECUTABLE} -m cogapp -d -o "${outfile}" "${cogfile}" DEPENDS ${cogfile} COMMENT "Greasing the cog for ${thisfile}") @@ -50,6 +50,7 @@ endforeach(cogfile) add_library(bottles SHARED ${src}/bottles/bottles.cpp ${src}/bottles/active.cpp ${src}/bottles/commands.cpp) +add_dependencies(bottles cog) add_custom_target(cog ALL DEPENDS ${coggedfiles}) diff --git a/include/internal/bottles.hpp b/include/internal/bottles.hpp deleted file mode 100644 index c8050d5..0000000 --- a/include/internal/bottles.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __INTERNAL_BOTTLES_HPP -#define __INTERNAL_BOTTLES_HPP -#pragma once - -namespace cellar { - namespace bottles { - extern void print_bottles(int,char**); - extern void print_active_bottle(int,char**); - } -} - -#endif // __INTERNAL_BOTTLES_HPP diff --git a/include/internal/bottles.hpp.cog b/include/internal/bottles.hpp.cog new file mode 100644 index 0000000..aeb0e1a --- /dev/null +++ b/include/internal/bottles.hpp.cog @@ -0,0 +1,20 @@ +// vim: filetype=cpp : +#ifndef __INTERNAL_BOTTLES_HPP +#define __INTERNAL_BOTTLES_HPP +#pragma once + +namespace cellar { + namespace bottles { + /*[[[cog + import cog + + with open("src/bottles/commands.txt") as commandsfile: + for line in commandsfile: + item = line.split(" ") + cog.outl("extern void {0} (int, char**);".format(item[1])) + ]]]*/ + //[[[end]]] + } +} + +#endif // __INTERNAL_BOTTLES_HPP