summaryrefslogtreecommitdiffstats
path: root/dev/rays/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'dev/rays/cmake')
-rw-r--r--dev/rays/cmake/DownloadHelper.txt.in52
-rw-r--r--dev/rays/cmake/ExternalProjectDownloadBuildInstall.cmake196
-rw-r--r--dev/rays/cmake/MessageMacros.cmake34
-rw-r--r--dev/rays/cmake/UseOpenGL.cmake104
4 files changed, 193 insertions, 193 deletions
diff --git a/dev/rays/cmake/DownloadHelper.txt.in b/dev/rays/cmake/DownloadHelper.txt.in
index fb29bff..69f3039 100644
--- a/dev/rays/cmake/DownloadHelper.txt.in
+++ b/dev/rays/cmake/DownloadHelper.txt.in
@@ -1,26 +1,26 @@
-# This file is part of the MinGfx cmake build system.
-# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
-
-# This is a "helper" cmake project -- the only thing this project does is download
-# the external project. So, the configure, build, install, and test commands for
-# ExternalProject_Add() are intentionally set as NOPs.
-
-cmake_minimum_required (VERSION 3.9)
-
-project(@EXT_PROJECT_NAME@-download)
-
-include(ExternalProject)
-ExternalProject_Add(
- @EXT_PROJECT_NAME@
- SOURCE_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/src"
- BINARY_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/download-helper"
- @DOWNLOAD_OPTIONS@
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- TEST_COMMAND ""
- LOG_DOWNLOAD ON
- GIT_PROGRESS 1
-)
-
-
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# This is a "helper" cmake project -- the only thing this project does is download
+# the external project. So, the configure, build, install, and test commands for
+# ExternalProject_Add() are intentionally set as NOPs.
+
+cmake_minimum_required (VERSION 3.9)
+
+project(@EXT_PROJECT_NAME@-download)
+
+include(ExternalProject)
+ExternalProject_Add(
+ @EXT_PROJECT_NAME@
+ SOURCE_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/src"
+ BINARY_DIR "@DOWNLOAD_DIR@/@EXT_PROJECT_NAME@/download-helper"
+ @DOWNLOAD_OPTIONS@
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+ LOG_DOWNLOAD ON
+ GIT_PROGRESS 1
+)
+
+
diff --git a/dev/rays/cmake/ExternalProjectDownloadBuildInstall.cmake b/dev/rays/cmake/ExternalProjectDownloadBuildInstall.cmake
index ce12d1d..4585dd3 100644
--- a/dev/rays/cmake/ExternalProjectDownloadBuildInstall.cmake
+++ b/dev/rays/cmake/ExternalProjectDownloadBuildInstall.cmake
@@ -1,98 +1,98 @@
-# This file is part of the MinGfx cmake build system.
-# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
-
-
-# Calling CMAKE_CURRENT_LIST_DIR inside a function returns the list dir of the calling script
-# but we want the list dir of this file in order to find the DownloadHelper.txt.in file, which
-# should be stored right next to this one. So, defining this variable outside the scope of the
-# functions below.
-set(DIR_OF_THIS_FILE ${CMAKE_CURRENT_LIST_DIR})
-
-
-
-# Usage:
-# ExternalProject_Download(
-# # This first argument is the name of the project to download. It is required:
-# glm
-#
-# # Additional arguments specify how to download the project using GIT, SVN, CVS, or URL.
-# # These can be any of the arguments used for the downloading step of the cmake builtin
-# # ExternalProject_Add command.
-# GIT_REPOSITORY "https://github.com/g-truc/glm.git"
-# GIT_TAG master
-# etc..
-# )
-function(ExternalProject_Download EXT_PROJECT_NAME DOWNLOAD_DIR)
-
- include(MessageMacros)
- h1("BEGIN EXTERNAL PROJECT DOWNLOAD (${EXT_PROJECT_NAME}).")
-
- h2("Creating a download helper project for ${EXT_PROJECT_NAME}.")
-
- set(DOWNLOAD_OPTIONS ${ARGN})
- string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " DOWNLOAD_OPTIONS "${DOWNLOAD_OPTIONS}")
-
-
- file(MAKE_DIRECTORY ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME})
- configure_file(
- ${DIR_OF_THIS_FILE}/DownloadHelper.txt.in
- ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper/CMakeLists.txt
- )
-
- h2("Generating build files for the ${EXT_PROJECT_NAME} download helper project.")
- execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
-
- h2("Building the ${EXT_PROJECT_NAME} download helper project. (This actually performs the download and may take some time...)")
- execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
-
- h2("Completed download of external project ${EXT_PROJECT_NAME}.")
-
-endfunction()
-
-
-# Usage:
-# ExternalProject_BuildAndInstallNow(
-# # This first argument is the name of the external project to download. It is required:
-# VRPN
-# # This second argument is the relative path from ${EXTERNAL_DIR_NAME}/projectname/ to the project's
-# # main CMakeLists.txt file:
-# src
-#
-# # Additional arguments are passed on as options to the cmake build file generator
-# -DVRPN_BUILD_DIRECTSHOW_VIDEO_SERVER=OFF
-# -DVRPN_BUILD_HID_GUI=OFF
-# etc..
-# )
-function(ExternalProject_BuildAndInstallNow EXT_PROJECT_NAME DOWNLOAD_DIR RELPATH_TO_CMAKELISTS)
-
- include(MessageMacros)
- h1("BEGIN EXTERNAL PROJECT BUILD AND INSTALL (${EXT_PROJECT_NAME}).")
-
- # any extra args to the function are interpreted as arguments for the cmake config process
- set(CMAKE_CONFIG_OPTIONS ${ARGN})
-
- # always set the install prefix to be the same as for the main project
- list(APPEND CMAKE_CONFIG_OPTIONS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX})
-
- #string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " CMAKE_CONFIG_OPTIONS "${CMAKE_CONFIG_OPTIONS}")
-
-
- set(SRC_DIR "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/${RELPATH_TO_CMAKELISTS}")
- set(BUILD_DIR "${CMAKE_BINARY_DIR}/external/${EXT_PROJECT_NAME}")
-
- file(MAKE_DIRECTORY ${BUILD_DIR})
-
- h2("Generating build files for external project ${EXT_PROJECT_NAME}.")
- message(STATUS "Using source dir: ${SRC_DIR}")
- message(STATUS "Using build dir: ${BUILD_DIR}")
- message(STATUS "Config options: ${CMAKE_CONFIG_OPTIONS}")
-
- execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" ${SRC_DIR} ${CMAKE_CONFIG_OPTIONS} WORKING_DIRECTORY ${BUILD_DIR})
-
- h2("Building external project ${EXT_PROJECT_NAME}. (This may take some time...)")
- execute_process(COMMAND "${CMAKE_COMMAND}" --build ${BUILD_DIR} --target install)
-
- h2("Completed external build of ${EXT_PROJECT_NAME}.")
-
-endfunction()
-
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+
+# Calling CMAKE_CURRENT_LIST_DIR inside a function returns the list dir of the calling script
+# but we want the list dir of this file in order to find the DownloadHelper.txt.in file, which
+# should be stored right next to this one. So, defining this variable outside the scope of the
+# functions below.
+set(DIR_OF_THIS_FILE ${CMAKE_CURRENT_LIST_DIR})
+
+
+
+# Usage:
+# ExternalProject_Download(
+# # This first argument is the name of the project to download. It is required:
+# glm
+#
+# # Additional arguments specify how to download the project using GIT, SVN, CVS, or URL.
+# # These can be any of the arguments used for the downloading step of the cmake builtin
+# # ExternalProject_Add command.
+# GIT_REPOSITORY "https://github.com/g-truc/glm.git"
+# GIT_TAG master
+# etc..
+# )
+function(ExternalProject_Download EXT_PROJECT_NAME DOWNLOAD_DIR)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT DOWNLOAD (${EXT_PROJECT_NAME}).")
+
+ h2("Creating a download helper project for ${EXT_PROJECT_NAME}.")
+
+ set(DOWNLOAD_OPTIONS ${ARGN})
+ string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " DOWNLOAD_OPTIONS "${DOWNLOAD_OPTIONS}")
+
+
+ file(MAKE_DIRECTORY ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME})
+ configure_file(
+ ${DIR_OF_THIS_FILE}/DownloadHelper.txt.in
+ ${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper/CMakeLists.txt
+ )
+
+ h2("Generating build files for the ${EXT_PROJECT_NAME} download helper project.")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Building the ${EXT_PROJECT_NAME} download helper project. (This actually performs the download and may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/download-helper")
+
+ h2("Completed download of external project ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
+
+# Usage:
+# ExternalProject_BuildAndInstallNow(
+# # This first argument is the name of the external project to download. It is required:
+# VRPN
+# # This second argument is the relative path from ${EXTERNAL_DIR_NAME}/projectname/ to the project's
+# # main CMakeLists.txt file:
+# src
+#
+# # Additional arguments are passed on as options to the cmake build file generator
+# -DVRPN_BUILD_DIRECTSHOW_VIDEO_SERVER=OFF
+# -DVRPN_BUILD_HID_GUI=OFF
+# etc..
+# )
+function(ExternalProject_BuildAndInstallNow EXT_PROJECT_NAME DOWNLOAD_DIR RELPATH_TO_CMAKELISTS)
+
+ include(MessageMacros)
+ h1("BEGIN EXTERNAL PROJECT BUILD AND INSTALL (${EXT_PROJECT_NAME}).")
+
+ # any extra args to the function are interpreted as arguments for the cmake config process
+ set(CMAKE_CONFIG_OPTIONS ${ARGN})
+
+ # always set the install prefix to be the same as for the main project
+ list(APPEND CMAKE_CONFIG_OPTIONS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX})
+
+ #string (REGEX REPLACE "(^|[^\\\\]);" "\\1 " CMAKE_CONFIG_OPTIONS "${CMAKE_CONFIG_OPTIONS}")
+
+
+ set(SRC_DIR "${DOWNLOAD_DIR}/${EXT_PROJECT_NAME}/${RELPATH_TO_CMAKELISTS}")
+ set(BUILD_DIR "${CMAKE_BINARY_DIR}/external/${EXT_PROJECT_NAME}")
+
+ file(MAKE_DIRECTORY ${BUILD_DIR})
+
+ h2("Generating build files for external project ${EXT_PROJECT_NAME}.")
+ message(STATUS "Using source dir: ${SRC_DIR}")
+ message(STATUS "Using build dir: ${BUILD_DIR}")
+ message(STATUS "Config options: ${CMAKE_CONFIG_OPTIONS}")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" ${SRC_DIR} ${CMAKE_CONFIG_OPTIONS} WORKING_DIRECTORY ${BUILD_DIR})
+
+ h2("Building external project ${EXT_PROJECT_NAME}. (This may take some time...)")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build ${BUILD_DIR} --target install)
+
+ h2("Completed external build of ${EXT_PROJECT_NAME}.")
+
+endfunction()
+
diff --git a/dev/rays/cmake/MessageMacros.cmake b/dev/rays/cmake/MessageMacros.cmake
index 4628e5c..b2d08ee 100644
--- a/dev/rays/cmake/MessageMacros.cmake
+++ b/dev/rays/cmake/MessageMacros.cmake
@@ -1,17 +1,17 @@
-# This file is part of the MinVR cmake build system.
-# See the main MinVR/CMakeLists.txt file for authors, copyright, and license info.
-
-
-macro(h1 TITLE)
- string(TOUPPER ${TITLE} TITLE)
- message(STATUS "\n\n==== ${TITLE} ====")
-endmacro()
-
-macro(h2 TITLE)
- message(STATUS "\n* ${TITLE}")
-endmacro()
-
-macro(h3 TITLE)
- message(STATUS "- ${TITLE}")
-endmacro()
-
+# This file is part of the MinVR cmake build system.
+# See the main MinVR/CMakeLists.txt file for authors, copyright, and license info.
+
+
+macro(h1 TITLE)
+ string(TOUPPER ${TITLE} TITLE)
+ message(STATUS "\n\n==== ${TITLE} ====")
+endmacro()
+
+macro(h2 TITLE)
+ message(STATUS "\n* ${TITLE}")
+endmacro()
+
+macro(h3 TITLE)
+ message(STATUS "- ${TITLE}")
+endmacro()
+
diff --git a/dev/rays/cmake/UseOpenGL.cmake b/dev/rays/cmake/UseOpenGL.cmake
index 2ec5ffb..ac5f55c 100644
--- a/dev/rays/cmake/UseOpenGL.cmake
+++ b/dev/rays/cmake/UseOpenGL.cmake
@@ -1,52 +1,52 @@
-# This file is part of the MinGfx cmake build system.
-# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
-
-# Either finds a pre-installed version or complains.
-
-# Usage: In your CMakeLists.txt, somewhere after you define the target that depends
-# on the OpenGL library (typical with something like add_executable(${PROJECT_NAME} ...)
-# or add_library(${PROJECT_NAME} ...)), add the following two lines:
-
-# include(UseOpenGL)
-# UseOpenGL(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external)
-
-# The second argument can be either PUBLIC, PRIVATE, or INTERFACE, following the keyword
-# usage described here:
-# https://cmake.org/cmake/help/latest/command/target_include_directories.html
-
-# The third argument is the directory to use for downloading the external project if
-# autobuild is used.
-
-
-
-macro(UseOpenGL YOUR_TARGET INTERFACE_PUBLIC_OR_PRIVATE DOWNLOAD_DIR)
-
- message(STATUS "Searching for OpenGL...")
-
- # Check to see if the library is already installed on the system
- # CMake ships with FindOpenGL.cmake and in CMake 3.9+ it defines
- # the imported targets OpenGL::GL and OpenGL::GLU. Using these is
- # now the preferred way to link with OpenGL and all of its dependencies.
- # See https://cmake.org/cmake/help/v3.9/module/FindOpenGL.html
- find_package(OpenGL)
-
- if (NOT ${OPENGL_FOUND})
- message(FATAL_ERROR "OpenGL was not found on the system. MinGfx can auto-download and build many dependencies for you, but not OpenGL. It should come pre-installed on your system.")
- endif()
-
- message(STATUS "Ok: OpenGL Found.")
- message(STATUS "OpenGL headers: ${OPENGL_INCLUDE_DIR}")
- message(STATUS "OpenGL libs: ${OPENGL_LIBRARIES}")
-
-
- message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GL.")
- target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GL)
-
- if (${OPENGL_GLU_FOUND})
- message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GLU.")
- target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GLU)
- endif()
-
- target_compile_definitions(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} -DUSE_OPENGL)
-
-endmacro()
+# This file is part of the MinGfx cmake build system.
+# See the main MinGfx/CMakeLists.txt file for authors, copyright, and license info.
+
+# Either finds a pre-installed version or complains.
+
+# Usage: In your CMakeLists.txt, somewhere after you define the target that depends
+# on the OpenGL library (typical with something like add_executable(${PROJECT_NAME} ...)
+# or add_library(${PROJECT_NAME} ...)), add the following two lines:
+
+# include(UseOpenGL)
+# UseOpenGL(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external)
+
+# The second argument can be either PUBLIC, PRIVATE, or INTERFACE, following the keyword
+# usage described here:
+# https://cmake.org/cmake/help/latest/command/target_include_directories.html
+
+# The third argument is the directory to use for downloading the external project if
+# autobuild is used.
+
+
+
+macro(UseOpenGL YOUR_TARGET INTERFACE_PUBLIC_OR_PRIVATE DOWNLOAD_DIR)
+
+ message(STATUS "Searching for OpenGL...")
+
+ # Check to see if the library is already installed on the system
+ # CMake ships with FindOpenGL.cmake and in CMake 3.9+ it defines
+ # the imported targets OpenGL::GL and OpenGL::GLU. Using these is
+ # now the preferred way to link with OpenGL and all of its dependencies.
+ # See https://cmake.org/cmake/help/v3.9/module/FindOpenGL.html
+ find_package(OpenGL)
+
+ if (NOT ${OPENGL_FOUND})
+ message(FATAL_ERROR "OpenGL was not found on the system. MinGfx can auto-download and build many dependencies for you, but not OpenGL. It should come pre-installed on your system.")
+ endif()
+
+ message(STATUS "Ok: OpenGL Found.")
+ message(STATUS "OpenGL headers: ${OPENGL_INCLUDE_DIR}")
+ message(STATUS "OpenGL libs: ${OPENGL_LIBRARIES}")
+
+
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GL.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GL)
+
+ if (${OPENGL_GLU_FOUND})
+ message(STATUS "Linking target ${YOUR_TARGET} with ${INTERFACE_PUBLIC_OR_PRIVATE} dependency OpenGL::GLU.")
+ target_link_libraries(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} OpenGL::GLU)
+ endif()
+
+ target_compile_definitions(${YOUR_TARGET} ${INTERFACE_PUBLIC_OR_PRIVATE} -DUSE_OPENGL)
+
+endmacro()