PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/lscript/lscript_compile/CMakeLists.txt

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 150 lines | 128 code | 20 blank | 2 comment | 4 complexity | 63f2c03569e164bb287c4fbe404b3558 MD5 | raw file
  1# -*- cmake -*-
  2
  3include(00-Common)
  4include(LLCommon)
  5include(LLMath)
  6include(LLMessage)
  7include(LLInventory)
  8include(LLPrimitive)
  9include(LScript)
 10
 11include(FindCygwin)
 12
 13find_program(FLEX flex
 14             "C:/Program Files/GnuWin32/bin"
 15             ${CYGWIN_INSTALL_PATH}/bin
 16             /bin
 17             /usr/bin
 18             /usr/local/bin
 19             )
 20mark_as_advanced(FLEX)
 21
 22find_program(BISON bison
 23             "C:/Program Files/GnuWin32/bin"
 24             ${CYGWIN_INSTALL_PATH}/bin
 25             /bin
 26             /usr/bin
 27             /usr/local/bin
 28             )
 29mark_as_advanced(BISON)
 30
 31find_program(M4 m4
 32             "C:/Program Files/GnuWin32/bin"
 33             ${CYGWIN_INSTALL_PATH}/bin
 34             /bin
 35             /usr/bin
 36             /usr/local/bin
 37             )
 38mark_as_advanced(M4)
 39
 40include_directories(
 41    ${LLCOMMON_INCLUDE_DIRS}
 42    ${LLMATH_INCLUDE_DIRS}
 43    ${LLMESSAGE_INCLUDE_DIRS}
 44    ${LLINVENTORY_INCLUDE_DIRS}
 45    ${LLPRIMITIVE_INCLUDE_DIRS}
 46    ${LSCRIPT_INCLUDE_DIRS}
 47    )
 48
 49set(lscript_generated_SOURCE_FILES
 50    indra.l.cpp
 51    indra.y.cpp
 52    )
 53
 54set(lscript_compile_SOURCE_FILES
 55    lscript_alloc.cpp
 56    lscript_bytecode.cpp
 57    lscript_error.cpp
 58    lscript_heap.cpp
 59    lscript_resource.cpp
 60    lscript_scope.cpp
 61    lscript_tree.cpp
 62    lscript_typecheck.cpp
 63    )
 64    
 65set(lscript_compile_HEADER_FILES
 66    CMakeLists.txt
 67
 68    indra.l
 69    indra.y
 70
 71    ../lscript_alloc.h
 72    ../lscript_byteformat.h
 73    ../lscript_byteconvert.h
 74    ../lscript_http.h
 75
 76    lscript_error.h
 77    lscript_bytecode.h
 78    lscript_heap.h
 79    lscript_resource.h
 80    lscript_scope.h
 81    lscript_tree.h
 82    lscript_typecheck.h
 83    )
 84
 85set_source_files_properties(${lscript_compile_HEADER_FILES}
 86                            PROPERTIES HEADER_FILE_ONLY TRUE)
 87
 88set_source_files_properties(${lscript_generated_SOURCE_FILES}
 89                            PROPERTIES HEADER_FILE_ONLY FALSE GENERATED TRUE)
 90
 91list(APPEND lscript_compile_SOURCE_FILES ${lscript_generated_SOURCE_FILES} ${lscript_compile_HEADER_FILES})
 92
 93add_custom_command(
 94    OUTPUT
 95      ${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp
 96    COMMAND ${FLEX}
 97    ARGS
 98      -o${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp
 99      ${CMAKE_CURRENT_SOURCE_DIR}/indra.l
100    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/indra.l
101    )
102
103if (WINDOWS)
104  set_source_files_properties(indra.l.cpp
105                              PROPERTIES COMPILE_FLAGS /DYY_NO_UNISTD_H)
106endif (WINDOWS)
107
108if (WINDOWS)
109  get_filename_component(M4_PATH ${M4} PATH)
110  add_custom_command(
111      OUTPUT
112        ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
113        ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
114      COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat
115        ${BISON} ${M4_PATH}
116        ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
117        ${CMAKE_CURRENT_SOURCE_DIR}/indra.y
118      DEPENDS
119        ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat
120        ${CMAKE_CURRENT_SOURCE_DIR}/indra.y
121      )
122  include_directories(${CMAKE_CURRENT_SOURCE_DIR}/windows)
123else (WINDOWS)
124  add_custom_command(
125      OUTPUT
126        ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
127        ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
128      COMMAND
129        ${BISON}
130      ARGS
131        -d -o ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp
132        ${CMAKE_CURRENT_SOURCE_DIR}/indra.y
133      DEPENDS
134        ${CMAKE_CURRENT_SOURCE_DIR}/indra.y
135      )
136endif (WINDOWS)
137
138if (DARWIN)
139  # Mac OS X 10.4 compatibility
140  add_custom_command(
141    OUTPUT
142      ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
143    COMMAND
144      mv
145      ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp.h
146      ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp
147    )
148endif (DARWIN)
149
150add_library (lscript_compile ${lscript_compile_SOURCE_FILES})