CMakeLists.txt
changeset 711 d547597e81de
parent 710 cbcba3ea6a05
child 714 e8ed66bfff18
equal deleted inserted replaced
710:cbcba3ea6a05 711:d547597e81de
     1 CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
     1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
     2 PROJECT(MojoShader)
     2 PROJECT(MojoShader)
     3 
     3 
     4 INCLUDE_DIRECTORIES(.)
     4 INCLUDE_DIRECTORIES(.)
     5 
     5 
     6 FIND_PROGRAM(HG hg DOC "Path to hg command line app: http://www.selenic.com/mercurial/")
     6 FIND_PROGRAM(HG hg DOC "Path to hg command line app: http://www.selenic.com/mercurial/")
    52 
    52 
    53 # We build lemon, then use it to generate parser C code.
    53 # We build lemon, then use it to generate parser C code.
    54 ADD_EXECUTABLE(lemon "misc/lemon.c")
    54 ADD_EXECUTABLE(lemon "misc/lemon.c")
    55 GET_TARGET_PROPERTY(LEMON lemon LOCATION)
    55 GET_TARGET_PROPERTY(LEMON lemon LOCATION)
    56 ADD_CUSTOM_COMMAND(
    56 ADD_CUSTOM_COMMAND(
    57     OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_parser_hlsl.c" "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_parser_hlsl.h"
    57     OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_parser_hlsl.c"
    58     MAIN_DEPENDENCY mojoshader_parser_hlsl.lemon
    58     MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_parser_hlsl.lemon"
    59     DEPENDS lemon
    59     DEPENDS lemon "${CMAKE_CURRENT_SOURCE_DIR}/misc/lempar.c"
    60     WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/misc"
       
    61     COMMAND "${LEMON}"
    60     COMMAND "${LEMON}"
    62     ARGS -l -q "-T${CMAKE_CURRENT_SOURCE_DIR}/misc/lempar.c" "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_parser_hlsl.lemon"
    61     ARGS -l -q "-T${CMAKE_CURRENT_SOURCE_DIR}/misc/lempar.c" "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_parser_hlsl.lemon"
    63 )
    62 )
    64 
    63 
    65 ADD_LIBRARY(mojoshader STATIC
    64 ADD_LIBRARY(mojoshader STATIC
    67     mojoshader_compiler.c
    66     mojoshader_compiler.c
    68     mojoshader_preprocessor.c
    67     mojoshader_preprocessor.c
    69     mojoshader_lexer.c
    68     mojoshader_lexer.c
    70     mojoshader_assembler.c
    69     mojoshader_assembler.c
    71     mojoshader_opengl.c
    70     mojoshader_opengl.c
       
    71 )
       
    72 
       
    73 SET_SOURCE_FILES_PROPERTIES(
       
    74     mojoshader_compiler.c
       
    75     PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_parser_hlsl.c"
    72 )
    76 )
    73 
    77 
    74 FIND_PROGRAM(RE2C re2c DOC "Path to re2c command line app: http://re2c.org/")
    78 FIND_PROGRAM(RE2C re2c DOC "Path to re2c command line app: http://re2c.org/")
    75 IF(NOT RE2C)
    79 IF(NOT RE2C)
    76     MESSAGE(STATUS "re2c missing. You can go on, but can't rebuild the lexer.")
    80     MESSAGE(STATUS "re2c missing. You can go on, but can't rebuild the lexer.")
    85 ENDIF(NOT RE2C)
    89 ENDIF(NOT RE2C)
    86 
    90 
    87 FIND_PACKAGE(SDL)
    91 FIND_PACKAGE(SDL)
    88 IF(SDL_FOUND)
    92 IF(SDL_FOUND)
    89     INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
    93     INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
    90     ADD_DEFINITIONS(-DFINDERRORS_COMPILE_SHADERS=1)
       
    91     ADD_EXECUTABLE(glcaps utils/glcaps.c)
    94     ADD_EXECUTABLE(glcaps utils/glcaps.c)
    92     TARGET_LINK_LIBRARIES(glcaps ${SDL_LIBRARY})
    95     TARGET_LINK_LIBRARIES(glcaps ${SDL_LIBRARY})
    93     ADD_EXECUTABLE(bestprofile utils/bestprofile.c)
    96     ADD_EXECUTABLE(bestprofile utils/bestprofile.c)
    94     TARGET_LINK_LIBRARIES(bestprofile mojoshader ${SDL_LIBRARY})
    97     TARGET_LINK_LIBRARIES(bestprofile mojoshader ${SDL_LIBRARY})
    95     ADD_EXECUTABLE(availableprofiles utils/availableprofiles.c)
    98     ADD_EXECUTABLE(availableprofiles utils/availableprofiles.c)
    96     TARGET_LINK_LIBRARIES(availableprofiles mojoshader ${SDL_LIBRARY})
    99     TARGET_LINK_LIBRARIES(availableprofiles mojoshader ${SDL_LIBRARY})
    97 ENDIF(SDL_FOUND)
   100 ENDIF(SDL_FOUND)
    98 
   101 
       
   102 ADD_EXECUTABLE(finderrors utils/finderrors.c)
       
   103 TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL_LIBRARY})
       
   104 IF(SDL_FOUND)
       
   105     SET_SOURCE_FILES_PROPERTIES(
       
   106         utils/finderrors.c
       
   107         PROPERTIES COMPILE_FLAGS "-DFINDERRORS_COMPILE_SHADERS=1"
       
   108     )
       
   109 ENDIF(SDL_FOUND)
       
   110 
    99 ADD_EXECUTABLE(testparse utils/testparse.c)
   111 ADD_EXECUTABLE(testparse utils/testparse.c)
   100 TARGET_LINK_LIBRARIES(testparse mojoshader)
   112 TARGET_LINK_LIBRARIES(testparse mojoshader)
   101 ADD_EXECUTABLE(testoutput utils/testoutput.c)
   113 ADD_EXECUTABLE(testoutput utils/testoutput.c)
   102 TARGET_LINK_LIBRARIES(testoutput mojoshader)
   114 TARGET_LINK_LIBRARIES(testoutput mojoshader)
   103 ADD_EXECUTABLE(finderrors utils/finderrors.c)
       
   104 TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL_LIBRARY})
       
   105 ADD_EXECUTABLE(mojoshader-compiler utils/mojoshader-compiler.c)
   115 ADD_EXECUTABLE(mojoshader-compiler utils/mojoshader-compiler.c)
   106 TARGET_LINK_LIBRARIES(mojoshader-compiler mojoshader)
   116 TARGET_LINK_LIBRARIES(mojoshader-compiler mojoshader)
   107 
   117 
   108 # End of CMakeLists.txt ...
   118 # End of CMakeLists.txt ...
   109 
   119