mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-04 00:26:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			59 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			CMake
		
	
	
	
	
	
cmake_minimum_required(VERSION 3.27)
 | 
						|
project(SDL2_video_demo C)
 | 
						|
set(CMAKE_C_STANDARD 99)
 | 
						|
 | 
						|
include(FetchContent)
 | 
						|
set(FETCHCONTENT_QUIET FALSE)
 | 
						|
 | 
						|
FetchContent_Declare(
 | 
						|
    SDL2
 | 
						|
    GIT_REPOSITORY "https://github.com/libsdl-org/SDL.git"
 | 
						|
    GIT_TAG "release-2.30.10"
 | 
						|
    GIT_PROGRESS TRUE
 | 
						|
    GIT_SHALLOW TRUE
 | 
						|
)
 | 
						|
FetchContent_MakeAvailable(SDL2)
 | 
						|
 | 
						|
FetchContent_Declare(
 | 
						|
    SDL2_ttf
 | 
						|
    GIT_REPOSITORY "https://github.com/libsdl-org/SDL_ttf.git"
 | 
						|
    GIT_TAG "release-2.22.0"
 | 
						|
    GIT_PROGRESS TRUE
 | 
						|
    GIT_SHALLOW TRUE
 | 
						|
)
 | 
						|
FetchContent_MakeAvailable(SDL2_ttf)
 | 
						|
 | 
						|
FetchContent_Declare(
 | 
						|
    SDL2_image
 | 
						|
    GIT_REPOSITORY "https://github.com/libsdl-org/SDL_image.git"
 | 
						|
    GIT_TAG "release-2.8.4"
 | 
						|
    GIT_PROGRESS TRUE
 | 
						|
    GIT_SHALLOW TRUE
 | 
						|
)
 | 
						|
FetchContent_MakeAvailable(SDL2_image)
 | 
						|
 | 
						|
add_executable(SDL2_video_demo main.c)
 | 
						|
 | 
						|
target_compile_options(SDL2_video_demo PUBLIC)
 | 
						|
target_include_directories(SDL2_video_demo PUBLIC .)
 | 
						|
 | 
						|
target_link_libraries(SDL2_video_demo PUBLIC
 | 
						|
    SDL2::SDL2main
 | 
						|
    SDL2::SDL2-static
 | 
						|
    SDL2_ttf::SDL2_ttf-static
 | 
						|
    SDL2_image::SDL2_image-static
 | 
						|
)
 | 
						|
 | 
						|
if(MSVC)
 | 
						|
  set(CMAKE_C_FLAGS_DEBUG "/D CLAY_DEBUG")
 | 
						|
else()
 | 
						|
  set(CMAKE_C_FLAGS_DEBUG "-Wall -Werror -Wno-error=missing-braces -DCLAY_DEBUG")
 | 
						|
  set(CMAKE_C_FLAGS_RELEASE "-O3")
 | 
						|
endif()
 | 
						|
 | 
						|
add_custom_command(
 | 
						|
        TARGET SDL2_video_demo POST_BUILD
 | 
						|
        COMMAND ${CMAKE_COMMAND} -E copy_directory
 | 
						|
        ${CMAKE_CURRENT_SOURCE_DIR}/resources
 | 
						|
        ${CMAKE_CURRENT_BINARY_DIR}/resources)
 |