79 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
# Copyright (c) 2022 Dominic Masters
 | 
						|
# 
 | 
						|
# This software is released under the MIT License.
 | 
						|
# https://opensource.org/licenses/MIT
 | 
						|
 | 
						|
# Custom variables
 | 
						|
set(
 | 
						|
  DAWN_TARGET_DEPENDENCIES_LAST
 | 
						|
  CACHE INTERNAL ${DAWN_CACHE_TARGET}
 | 
						|
)
 | 
						|
 | 
						|
# Build Project
 | 
						|
add_executable(${DAWN_TARGET_NAME})
 | 
						|
 | 
						|
# Change what we are building. Pulled from the cmake/targets dir.
 | 
						|
if(DEFINED DAWN_BUILDING)
 | 
						|
  add_subdirectory(${DAWN_BUILDING})
 | 
						|
endif()
 | 
						|
 | 
						|
# Validate game project includes the target name
 | 
						|
if(DEFINED DAWN_TARGET_NAME)
 | 
						|
  # Add in base library
 | 
						|
  add_subdirectory(dawn)
 | 
						|
 | 
						|
  # Compile entry targets
 | 
						|
  if(DAWN_TARGET_WIN32)
 | 
						|
    add_subdirectory(dawnwin32)
 | 
						|
  elseif(DAWN_TARGET_LINUX)
 | 
						|
    add_subdirectory(dawnlinux)
 | 
						|
  elseif(DAWN_TARGET_OSX)
 | 
						|
    add_subdirectory(dawnosx)
 | 
						|
  elseif(DAWN_TARGET_VITA)
 | 
						|
    add_subdirectory(dawnvita)
 | 
						|
  elseif(DAWN_TARGET_EMSCRIPTEN)
 | 
						|
    add_subdirectory(dawnemscripten)
 | 
						|
  else()
 | 
						|
    message(FATAL_ERROR "You need to define an entry target")
 | 
						|
  endif()
 | 
						|
 | 
						|
  # Host Libraries
 | 
						|
  target_link_libraries(${DAWN_TARGET_NAME}
 | 
						|
    PUBLIC
 | 
						|
      ${DAWN_BUILD_HOST_LIBS}
 | 
						|
  )
 | 
						|
 | 
						|
  # Compile support targets
 | 
						|
  if(DAWN_TARGET_GLFW)
 | 
						|
    add_subdirectory(dawnglfw)
 | 
						|
    add_subdirectory(dawnopengl)
 | 
						|
  endif()
 | 
						|
 | 
						|
  if(DAWN_TARGET_SDL2)
 | 
						|
    add_subdirectory(dawnsdl2)
 | 
						|
    add_subdirectory(dawnopengl)
 | 
						|
  endif()
 | 
						|
 | 
						|
  if(DAWN_TARGET_ARCHIVE)
 | 
						|
    # add_subdirectory(dawnarchiveasset)
 | 
						|
  else()
 | 
						|
    add_subdirectory(dawnfileasset)
 | 
						|
  endif()
 | 
						|
 | 
						|
  if(DAWN_TARGET_VITA)
 | 
						|
    add_subdirectory(dawnopengl)
 | 
						|
  endif()
 | 
						|
 | 
						|
  if(DAWN_TARGET_OPENAL)
 | 
						|
    add_subdirectory(dawnopenal)
 | 
						|
  endif()
 | 
						|
 | 
						|
  # Late definitions, used by tools
 | 
						|
  if(NOT DAWN_TARGET_DEPENDENCIES_LAST)
 | 
						|
  else()
 | 
						|
    add_dependencies(${DAWN_TARGET_NAME} ${DAWN_TARGET_DEPENDENCIES_LAST})
 | 
						|
  endif()
 | 
						|
 | 
						|
  # Compress the game assets.
 | 
						|
  add_dependencies(${DAWN_TARGET_NAME} dawnassets)
 | 
						|
endif() |