this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #192 from seanballais/feature/cmake-improvements

Let SDL_gpu repo be easily added as a dependency in a CMake project

authored by

Jonathan Dearborn and committed by
GitHub
f15d33cc 642cdce6

+25 -16
+1 -1
.gitignore
··· 1 1 CMakeCache.txt 2 2 CMakeFiles 3 3 Makefile 4 + build/ 4 5 *.cmake 5 6 *-demo 6 7 *-test ··· 8 9 *.so 9 10 *.o 10 11 11 -
+22 -13
CMakeLists.txt
··· 25 25 26 26 set(SDL_GPU_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUGFIX}") 27 27 28 - message("Writing version header for v${SDL_GPU_VERSION}") 29 - string(CONCAT VERSION_HEADER_CONTENTS "#ifndef _SDL_GPU_VERSION_H__ 28 + if(${CMAKE_CURRENT_SOURCE_DIR}/version.txt IS_NEWER_THAN ${CMAKE_CURRENT_SOURCE_DIR}/include/SDL_gpu_version.h) 29 + # This is to prevent CMake from rebuilding SDL_gpu, which is important when it is an external project in another project. 30 + # This works since whenever version.txt is changed, it will be newer than SDL_gpu_version.h. The only time SDL_gpu_version.h 31 + # will be newer than version.txt is when it is created or modified after the latter file. 32 + message("Writing version header for v${SDL_GPU_VERSION}") 33 + string(CONCAT VERSION_HEADER_CONTENTS "#ifndef _SDL_GPU_VERSION_H__ 30 34 #define _SDL_GPU_VERSION_H__ 31 35 32 36 #define SDL_GPU_VERSION_MAJOR ${VERSION_MAJOR} ··· 34 38 #define SDL_GPU_VERSION_PATCH ${VERSION_BUGFIX} 35 39 36 40 #endif") 37 - file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/SDL_gpu_version.h ${VERSION_HEADER_CONTENTS}) 41 + 42 + file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/SDL_gpu_version.h ${VERSION_HEADER_CONTENTS}) 43 + endif() 38 44 39 45 set(DEFAULT_INSTALL_LIBRARY ON) 40 46 set(DEFAULT_BUILD_SHARED ON) ··· 100 106 option(BUILD_TESTS "Build SDL_gpu test programs" OFF) 101 107 option(BUILD_VIDEO_TEST "Build SDL_gpu video test program (requires FFMPEG)" OFF) 102 108 option(BUILD_TOOLS "Build SDL_gpu tool programs" OFF) 109 + option(BUILD_DOCS "Build SDL_gpu documentation" OFF) 103 110 option(USE_SDL1 "Use SDL 1.2 headers and library instead of SDL 2" OFF) 104 111 option(DISABLE_OPENGL "Disable OpenGL renderers. Overrides specific OpenGL renderer flags." ${DEFAULT_DISABLE_OPENGL}) 105 112 option(DISABLE_GLES "Disable OpenGLES renderers. Overrides specific GLES renderer flags." ${DEFAULT_DISABLE_GLES}) ··· 323 330 endif(NOT STBI_FOUND OR NOT STBI_WRITE_FOUND) 324 331 325 332 # add a target to generate API documentation with Doxygen 326 - find_package(Doxygen) 327 - if(DOXYGEN_FOUND) 328 - set(DOXYGEN_INPUT ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) 329 - configure_file(${CMAKE_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) 330 - add_custom_target(doc 331 - ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 332 - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 333 - COMMENT "Generating API documentation with Doxygen" VERBATIM 334 - ) 335 - endif(DOXYGEN_FOUND) 333 + if (BUILD_DOCS) 334 + find_package(Doxygen) 335 + if(DOXYGEN_FOUND) 336 + set(DOXYGEN_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src) 337 + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) 338 + add_custom_target(doc 339 + ` ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 340 + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 341 + COMMENT "Generating API documentation with Doxygen" VERBATIM 342 + ) 343 + endif(DOXYGEN_FOUND) 344 + endif (BUILD_DOCS) 336 345 337 346 add_definitions("-Wall -pedantic") 338 347
+2 -2
src/CMakeLists.txt
··· 110 110 configure_file(${INC_FILE} ${CMAKE_BINARY_DIR}/${OUTPUT_DIR}/include/${BASE} COPYONLY) 111 111 endforeach(INC_FILE) 112 112 113 - configure_file(${CMAKE_SOURCE_DIR}/LICENSE.txt ${CMAKE_BINARY_DIR}/${OUTPUT_DIR}/LICENSE.txt COPYONLY) 114 - configure_file(${CMAKE_SOURCE_DIR}/README.md ${CMAKE_BINARY_DIR}/${OUTPUT_DIR}/README.md COPYONLY) 113 + configure_file(../LICENSE.txt ${CMAKE_BINARY_DIR}/${OUTPUT_DIR}/LICENSE.txt COPYONLY) 114 + configure_file(../README.md ${CMAKE_BINARY_DIR}/${OUTPUT_DIR}/README.md COPYONLY) 115 115 116 116 # Build the shared library (.so or .dll) 117 117 if(BUILD_SHARED)