-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCocoR.agrum.cmake
34 lines (30 loc) · 2.51 KB
/
CocoR.agrum.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
set(RM cmake -E remove)
find_program(COCOR_EXECUTABLE cococpp)
if (COCOR_EXECUTABLE STREQUAL "COCOR_EXECUTABLE-NOTFOUND")
find_program(COCOR_EXECUTABLE2 Coco)
if (COCOR_EXECUTABLE2 STREQUAL "COCOR_EXECUTABLE2-NOTFOUND")
message(STATUS "** aGrUM notification: Coco/R not found : you cannot change atg files !")
else (COCOR_EXECUTABLE2 STREQUAL "COCOR_EXECUTABLE2-NOTFOUND")
set(COCOR_EXECUTABLE "${COCOR_EXECUTABLE2}")
message(STATUS "** aGrUM Notification: Coco/R found")
endif (COCOR_EXECUTABLE2 STREQUAL "COCOR_EXECUTABLE2-NOTFOUND")
endif (COCOR_EXECUTABLE STREQUAL "COCOR_EXECUTABLE-NOTFOUND")
macro(CocoRTarget DIRNAME ARG_PREFIX ARG_NAMESPACE MODULE)
ADD_CUSTOM_COMMAND(
OUTPUT ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Parser.cpp ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Parser.h ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Scanner.cpp ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Scanner.h
COMMAND ${COCOR_EXECUTABLE} -namespace ${ARG_NAMESPACE} -frames ${AGRUM_SOURCE_DIR}/agrum/tools/core/cocoR ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/${ARG_PREFIX}.atg -o ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/
COMMAND ${RM} -f ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Scanner.h.old
COMMAND ${RM} -f ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Scanner.cpp.old
COMMAND ${RM} -f ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Parser.h.old
COMMAND ${RM} -f ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Parser.cpp.old
DEPENDS ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/${ARG_PREFIX}.atg ${AGRUM_SOURCE_DIR}/agrum/tools/core/cocoR/Scanner.frame ${AGRUM_SOURCE_DIR}/agrum/tools/core/cocoR/Parser.frame ${AGRUM_SOURCE_DIR}/agrum/tools/core/cocoR/Copyright.frame
)
set(AGRUM_${MODULE}_SOURCES ${AGRUM_${MODULE}_SOURCES} ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Parser.cpp ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Scanner.cpp)
set(AGRUM_${MODULE}_INCLUDES ${AGRUM_${MODULE}_INCLUDES} ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Parser.h ${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Scanner.h)
SET_SOURCE_FILES_PROPERTIES(${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Parser.cpp GENERATED)
SET_SOURCE_FILES_PROPERTIES(${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Parser.h GENERATED)
SET_SOURCE_FILES_PROPERTIES(${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Scanner.cpp GENERATED)
SET_SOURCE_FILES_PROPERTIES(${AGRUM_SOURCE_DIR}/agrum/${DIRNAME}/Scanner.h GENERATED)
message(STATUS "** aGrUM notification: (+) ${ARG_NAMESPACE} found")
endmacro(CocoRTarget)
# Since parser does not exists yet when cmake is run, mark it as generated