source: git/modules/DynModMacros.cmake @ fec53d

fieker-DuValspielwiese
Last change on this file since fec53d was 8cc501, checked in by Kai Krüger <krueger@…>, 14 years ago
Added files to compile with cmake. Still experimental. Might not work git-svn-id: file:///usr/local/Singular/svn/trunk@13240 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.7 KB
Line 
1# -*- mode: cmake; -*-
2
3# Macros used for modgen
4function(sing_create_pathname GEN_FILE) 
5
6  message("create pathnames.h...")
7#  set(${GEN_FILE} ${INFILE} PARENT_SCOPE)
8  set(_GEN_FILE "${CMAKE_CURRENT_BINARY_DIR}/pathnames.h")
9#  file(WRITE filename "/*
10#*
11#*/
12#
13#define TOPSRCDIR \"$(topsrcdir)\"
14#define SINGUNAME \"$(SINGUNAME)\"
15#")
16
17  add_custom_command(OUTPUT ${_GEN_FILE}
18    COMMAND echo "/\*" > ${_GEN_FILE}
19    COMMAND echo " \*" >> ${_GEN_FILE}
20    COMMAND echo " \*/" >> ${_GEN_FILE}
21    COMMAND echo "" >> ${_GEN_FILE}
22    COMMAND echo "#define TOPSRCDIR \"$(topsrcdir)\"" >> ${_GEN_FILE}
23    COMMAND echo "#define SINGUNAME \"$(SINGUNAME)\"" >> ${_GEN_FILE}
24    COMMENT "Creatting '${_GEN_FILE}'..."
25    )
26  message(STATUS "argv: ${ARGV}")
27  message(STATUS "argn: ${ARGC}")
28  message(STATUS "argn: '${ARGN}'")
29
30
31  set(${GEN_FILE} ${_GEN_FILE} PARENT_SCOPE)
32endfunction()
33
34function(sing_create_decl GEN_FILE GRAMMAR_H TOK_H) 
35
36  message("sing_create_decl...")
37  set(_GEN_FILE "${CMAKE_CURRENT_BINARY_DIR}/decl.inc")
38  add_custom_command(OUTPUT ${_GEN_FILE}
39    COMMAND echo "/* declaration for modgen.cc */" > ${GEN_FILE}
40    COMMAND grep "^#define" ${GRAMMAR_H} | awk 
41    '{print "\tcase "$$2": strcpy(name,\""$$2"\"); break;"}' >> ${_GEN_FILE}
42    COMMAND echo "" >> ${_GEN_FILE}
43    COMMAND echo "/* declaration from tok.h */" >> ${_GEN_FILE}
44    COMMAND grep "^  [A-Z_]*," ../../Singular/tok.h | sed "s/,//g" | awk
45    '{print "\tcase "$$1": strcpy(name,\""$$1"\"); break;"}'>>${_GEN_FILE}
46    DEPENDS ${GRAMMAR_H}
47    COMMENT "Compiling '${GRAMMAR_H}'..."
48    )
49  message(STATUS "argv: ${ARGV}")
50  message(STATUS "argn: ${ARGC}")
51  message(STATUS "argn: '${ARGN}'")
52
53
54  set(${GEN_FILE} ${_GEN_FILE} PARENT_SCOPE)
55endfunction()
Note: See TracBrowser for help on using the repository browser.