CMakeLists.txt
changeset 1230 600d972bbd57
parent 1229 3ecd29a50d9d
child 1233 e3bd5f116e38
equal deleted inserted replaced
1229:3ecd29a50d9d 1230:600d972bbd57
   123 IF(NOT PROFILE_ARB1_NV)
   123 IF(NOT PROFILE_ARB1_NV)
   124     ADD_DEFINITIONS(-DSUPPORT_PROFILE_ARB1_NV=0)
   124     ADD_DEFINITIONS(-DSUPPORT_PROFILE_ARB1_NV=0)
   125 ENDIF(NOT PROFILE_ARB1_NV)
   125 ENDIF(NOT PROFILE_ARB1_NV)
   126 IF(NOT PROFILE_METAL)
   126 IF(NOT PROFILE_METAL)
   127     ADD_DEFINITIONS(-DSUPPORT_PROFILE_METAL=0)
   127     ADD_DEFINITIONS(-DSUPPORT_PROFILE_METAL=0)
       
   128 ELSE(NOT PROFILE_METAL)
       
   129     SET(LOBJC -lobjc)
   128 ENDIF(NOT PROFILE_METAL)
   130 ENDIF(NOT PROFILE_METAL)
   129 IF(NOT PROFILE_SPIRV)
   131 IF(NOT PROFILE_SPIRV)
   130     ADD_DEFINITIONS(-DSUPPORT_PROFILE_SPIRV=0)
   132     ADD_DEFINITIONS(-DSUPPORT_PROFILE_SPIRV=0)
   131 ENDIF(NOT PROFILE_SPIRV)
   133 ENDIF(NOT PROFILE_SPIRV)
   132 IF(NOT PROFILE_GLSPIRV)
   134 IF(NOT PROFILE_GLSPIRV)
   183         mojoshader_lexer.c
   185         mojoshader_lexer.c
   184         mojoshader_assembler.c
   186         mojoshader_assembler.c
   185     )
   187     )
   186 ENDIF(COMPILER_SUPPORT)
   188 ENDIF(COMPILER_SUPPORT)
   187 IF(BUILD_SHARED)
   189 IF(BUILD_SHARED)
   188     TARGET_LINK_LIBRARIES(mojoshader ${LIBM} ${CARBON_FRAMEWORK})
   190     TARGET_LINK_LIBRARIES(mojoshader ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
   189 ENDIF(BUILD_SHARED)
   191 ENDIF(BUILD_SHARED)
   190 
   192 
   191 SET_SOURCE_FILES_PROPERTIES(
   193 SET_SOURCE_FILES_PROPERTIES(
   192     mojoshader_compiler.c
   194     mojoshader_compiler.c
   193     PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_parser_hlsl.h"
   195     PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_parser_hlsl.h"
   209 find_path(SDL2_INCLUDE_DIR SDL.h PATH_SUFFIXES include/SDL2)
   211 find_path(SDL2_INCLUDE_DIR SDL.h PATH_SUFFIXES include/SDL2)
   210 find_library(SDL2 NAMES SDL2 PATH_SUFFIXES lib)
   212 find_library(SDL2 NAMES SDL2 PATH_SUFFIXES lib)
   211 IF(SDL2)
   213 IF(SDL2)
   212     INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
   214     INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})
   213     ADD_EXECUTABLE(glcaps utils/glcaps.c)
   215     ADD_EXECUTABLE(glcaps utils/glcaps.c)
   214     TARGET_LINK_LIBRARIES(glcaps ${SDL2} ${LIBM} ${CARBON_FRAMEWORK})
   216     TARGET_LINK_LIBRARIES(glcaps ${SDL2} ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
   215     ADD_EXECUTABLE(bestprofile utils/bestprofile.c)
   217     ADD_EXECUTABLE(bestprofile utils/bestprofile.c)
   216     TARGET_LINK_LIBRARIES(bestprofile mojoshader ${SDL2} ${LIBM} ${CARBON_FRAMEWORK})
   218     TARGET_LINK_LIBRARIES(bestprofile mojoshader ${SDL2} ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
   217     ADD_EXECUTABLE(availableprofiles utils/availableprofiles.c)
   219     ADD_EXECUTABLE(availableprofiles utils/availableprofiles.c)
   218     TARGET_LINK_LIBRARIES(availableprofiles mojoshader ${SDL2} ${LIBM} ${CARBON_FRAMEWORK})
   220     TARGET_LINK_LIBRARIES(availableprofiles mojoshader ${SDL2} ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
   219 ENDIF(SDL2)
   221 ENDIF(SDL2)
   220 
   222 
   221 IF(COMPILER_SUPPORT)
   223 IF(COMPILER_SUPPORT)
   222     ADD_EXECUTABLE(finderrors utils/finderrors.c)
   224     ADD_EXECUTABLE(finderrors utils/finderrors.c)
   223     TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL2} ${LIBM} ${CARBON_FRAMEWORK})
   225     TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL2} ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
   224     IF(SDL2)
   226     IF(SDL2)
   225         SET_SOURCE_FILES_PROPERTIES(
   227         SET_SOURCE_FILES_PROPERTIES(
   226             utils/finderrors.c
   228             utils/finderrors.c
   227             PROPERTIES COMPILE_FLAGS "-DFINDERRORS_COMPILE_SHADERS=1"
   229             PROPERTIES COMPILE_FLAGS "-DFINDERRORS_COMPILE_SHADERS=1"
   228         )
   230         )
   235     INCLUDE_DIRECTORIES(${SPIRV_TOOLS_INCLUDE_DIR})
   237     INCLUDE_DIRECTORIES(${SPIRV_TOOLS_INCLUDE_DIR})
   236     ADD_DEFINITIONS(-DMOJOSHADER_HAS_SPIRV_TOOLS)
   238     ADD_DEFINITIONS(-DMOJOSHADER_HAS_SPIRV_TOOLS)
   237 ENDIF(SPIRV_TOOLS_INCLUDE_DIR AND SPIRV_TOOLS_LIBRARY)
   239 ENDIF(SPIRV_TOOLS_INCLUDE_DIR AND SPIRV_TOOLS_LIBRARY)
   238 
   240 
   239 ADD_EXECUTABLE(testparse utils/testparse.c)
   241 ADD_EXECUTABLE(testparse utils/testparse.c)
   240 TARGET_LINK_LIBRARIES(testparse mojoshader ${LIBM} ${CARBON_FRAMEWORK})
   242 TARGET_LINK_LIBRARIES(testparse mojoshader ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
   241 IF(SPIRV_TOOLS_INCLUDE_DIR AND SPIRV_TOOLS_LIBRARY)
   243 IF(SPIRV_TOOLS_INCLUDE_DIR AND SPIRV_TOOLS_LIBRARY)
   242     TARGET_LINK_LIBRARIES(testparse ${SPIRV_TOOLS_LIBRARY})
   244     TARGET_LINK_LIBRARIES(testparse ${SPIRV_TOOLS_LIBRARY})
   243 ENDIF(SPIRV_TOOLS_INCLUDE_DIR AND SPIRV_TOOLS_LIBRARY)
   245 ENDIF(SPIRV_TOOLS_INCLUDE_DIR AND SPIRV_TOOLS_LIBRARY)
   244 ADD_EXECUTABLE(testoutput utils/testoutput.c)
   246 ADD_EXECUTABLE(testoutput utils/testoutput.c)
   245 TARGET_LINK_LIBRARIES(testoutput mojoshader ${LIBM} ${CARBON_FRAMEWORK})
   247 TARGET_LINK_LIBRARIES(testoutput mojoshader ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
   246 IF(COMPILER_SUPPORT)
   248 IF(COMPILER_SUPPORT)
   247     ADD_EXECUTABLE(mojoshader-compiler utils/mojoshader-compiler.c)
   249     ADD_EXECUTABLE(mojoshader-compiler utils/mojoshader-compiler.c)
   248     TARGET_LINK_LIBRARIES(mojoshader-compiler mojoshader ${LIBM} ${CARBON_FRAMEWORK})
   250     TARGET_LINK_LIBRARIES(mojoshader-compiler mojoshader ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK})
   249 ENDIF(COMPILER_SUPPORT)
   251 ENDIF(COMPILER_SUPPORT)
   250 
   252 
   251 # Unit tests...
   253 # Unit tests...
   252 IF(COMPILER_SUPPORT)
   254 IF(COMPILER_SUPPORT)
   253     ADD_CUSTOM_TARGET(
   255     ADD_CUSTOM_TARGET(