/********************************************************************** * Premake - cb_cpp.c * The Code::Blocks C/C++ target * * Copyright (c) 2002-2006 Jason Perkins and the Premake project * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License in the file LICENSE.txt for details. **********************************************************************/ #include #include #include "premake.h" #include "cb.h" static const char* filterLinks(const char* name); static const char* filterLinksForPaths(const char* name); static const char* listFiles(const char* name); static void print_opt(const char* opt); int cb_cpp() { int i; /* Write the file */ if (!io_openfile(path_join(prj_get_pkgpath(), prj_get_pkgname(), "cbp"))) return 0; io_print("\n"); io_print("\n"); io_print("\t\n"); io_print("\t\n"); io_print("\t\t\n"); io_print("\n"); io_closefile(); return 1; } static void print_opt(const char* opt) { io_print("\t\t\t\t\t\n", opt); } /************************************************************************ * Output a description block for each source file ***********************************************************************/ static const char* listFiles(const char* filename) { int i; io_print("\t\t\n", filename); if (matches(path_getextension(filename), ".rc")) { io_print("\t\t\t\n"); return NULL; } /************************************************************************ * Checks each entry in the list of package links. If the entry refers * to a sibling package, returns the path to that package's output ***********************************************************************/ static const char* filterLinks(const char* name) { int i = prj_find_package(name); if (i >= 0) { const char* lang = prj_get_language_for(i); if (matches(lang, "c++") || matches(lang, "c")) { const char* target = prj_get_targetname_for(i); return path_getname(target); } else { return NULL; } } else { return name; } } static const char* filterLinksForPaths(const char* name) { int i = prj_find_package(name); if (i >= 0) { const char* lang = prj_get_language_for(i); if (matches(lang, "c++") || matches(lang, "c")) { const char* target = prj_get_target_for(i); const char* dir = path_getdir(target); if (!prj_has_libpath(dir)) { return dir; } } } return NULL; }