@@ -36,39 +36,51 @@ find_package(MKL)
3636find_package (glbinding QUIET )
3737include (boost_package )
3838
39- option (BUILD_CPU "Build ArrayFire with a CPU backend" ON )
40- option (BUILD_CUDA "Build ArrayFire with a CUDA backend" ${CUDA_FOUND} )
41- option (BUILD_OPENCL "Build ArrayFire with a OpenCL backend" ${OpenCL_FOUND} )
42- option (BUILD_UNIFIED "Build Backend-Independent ArrayFire API" ON )
39+ option (AF_BUILD_CPU "Build ArrayFire with a CPU backend" ON )
40+ option (AF_BUILD_CUDA "Build ArrayFire with a CUDA backend" ${CUDA_FOUND} )
41+ option (AF_BUILD_OPENCL "Build ArrayFire with a OpenCL backend" ${OpenCL_FOUND} )
42+ option (AF_BUILD_UNIFIED "Build Backend-Independent ArrayFire API" ON )
43+ option (AF_BUILD_DOCS "Create ArrayFire Documentation" ${DOXYGEN_FOUND} )
44+ option (AF_BUILD_EXAMPLES "Build Examples" ON )
4345
44- option (BUILD_GRAPHICS "Build ArrayFire with Forge Graphics" $<AND :${OPENGL_FOUND} ,${Forge_FOUND} ,${glbinding_FOUND} >)
45- option (BUILD_DOCS "Create ArrayFire Documentation" ${DOXYGEN_FOUND} )
46- option (BUILD_NONFREE "Build ArrayFire nonfree algorithms" OFF )
46+ option (AF_WITH_GRAPHICS "Build ArrayFire with Forge Graphics" $<AND :${OPENGL_FOUND} ,${Forge_FOUND} ,${glbinding_FOUND} >)
47+ option (AF_WITH_NONFREE "Build ArrayFire nonfree algorithms" OFF )
4748
48- option (BUILD_EXAMPLES "Build Examples" ON )
49- cmake_dependent_option (USE_RELATIVE_TEST_DIR "Use relative paths for the test data directory(For continious integration(CI) purposes only)" OFF
49+ cmake_dependent_option (AF_WITH_RELATIVE_TEST_DIR "Use relative paths for the test data directory(For continious integration(CI) purposes only)" OFF
5050 "BUILD_TESTING" OFF )
5151
52- cmake_dependent_option (USE_SYSTEM_FORGE "Use system Forge" OFF
53- "BUILD_GRAPHICS" OFF )
54- cmake_dependent_option (WITH_IMAGEIO "Build ArrayFire with Image IO support" ${FreeImage_FOUND}
55- "FreeImage_FOUND" OFF )
56- cmake_dependent_option (BUILD_FRAMEWORK "Build an ArrayFire framework for Apple platforms.(Experimental)" OFF
57- "APPLE" OFF )
58- option (USE_FREEIMAGE_STATIC "Use Static FreeImage Lib" OFF )
59-
60- set (USE_CPUID ON CACHE BOOL "Build with CPUID integration" )
52+ cmake_dependent_option (AF_USE_SYSTEM_FORGE "Use system Forge" OFF
53+ "AF_WITH_GRAPHICS" OFF )
54+ cmake_dependent_option (AF_WITH_IMAGEIO "Build ArrayFire with Image IO support" ${FreeImage_FOUND}
55+ "FreeImage_FOUND" OFF )
56+ cmake_dependent_option (AF_BUILD_FRAMEWORK "Build an ArrayFire framework for Apple platforms.(Experimental)" OFF
57+ "APPLE" OFF )
58+ option (AF_WITH_STATIC_FREEIMAGE "Use Static FreeImage Lib" OFF )
59+
60+ set (AF_WITH_CPUID ON CACHE BOOL "Build with CPUID integration" )
61+
62+ af_deprecate (BUILD_CPU AF_BUILD_CPU )
63+ af_deprecate (BUILD_CUDA AF_BUILD_CUDA )
64+ af_deprecate (BUILD_OPENCL AF_BUILD_OPENCL )
65+ af_deprecate (BUILD_UNIFIED AF_BUILD_UNIFIED )
66+ af_deprecate (BUILD_GRAPHICS AF_WITH_GRAPHICS )
67+ af_deprecate (BUILD_DOCS AF_BUILD_DOCS )
68+ af_deprecate (BUILD_NONFREE AF_WITH_NONFREE )
69+ af_deprecate (BUILD_EXAMPLES AF_WITH_EXAMPLES )
70+ af_deprecate (USE_RELATIVE_TEST_DIR AF_WITH_RELATIVE_TEST_DIR )
71+ af_deprecate (USE_FREEIMAGE_STATIC AF_WITH_STATIC_FREEIMAGE )
72+ af_deprecate (USE_CPUID AF_WITH_CPUID )
6173
6274mark_as_advanced (
63- BUILD_FRAMEWORK
64- USE_SYSTEM_FORGE
65- USE_CPUID )
75+ AF_BUILD_FRAMEWORK
76+ AF_USE_SYSTEM_FORGE
77+ AF_WITH_CPUID )
6678
6779# TODO(umar): Add definitions should not be used. Instead use
6880arrayfire_get_platform_definitions (platform_definitions )
6981add_definitions (${platform_definitions} )
7082
71- if (BUILD_GRAPHICS )
83+ if (AF_WITH_GRAPHICS )
7284 include (build_forge )
7385endif ()
7486
@@ -77,7 +89,7 @@ configure_file(
7789 ${ArrayFire_BINARY_DIR} /version.hpp
7890)
7991
80- if (BUILD_NONFREE )
92+ if (AF_WITH_NONFREE )
8193 message ("Building with NONFREE requires the following patents" )
8294 message ("Method and apparatus for identifying scale invariant features\n "
8395 "in an image and use of same for locating an object in an image, David\n "
@@ -105,10 +117,10 @@ add_subdirectory(src/backend/common)
105117add_subdirectory (src/api/c )
106118add_subdirectory (src/api/cpp )
107119
108- conditional_directory (BUILD_CPU src/backend/cpu )
109- conditional_directory (BUILD_CUDA src/backend/cuda )
110- conditional_directory (BUILD_OPENCL src/backend/opencl )
111- conditional_directory (BUILD_UNIFIED src/api/unified )
120+ conditional_directory (AF_BUILD_CPU src/backend/cpu )
121+ conditional_directory (AF_BUILD_CUDA src/backend/cuda )
122+ conditional_directory (AF_BUILD_OPENCL src/backend/opencl )
123+ conditional_directory (AF_BUILD_UNIFIED src/api/unified )
112124
113125if (TARGET af)
114126 list (APPEND built_backends af)
@@ -134,7 +146,7 @@ foreach(backend ${built_backends})
134146 target_compile_definitions (${backend} PRIVATE AFDLL )
135147endforeach ()
136148
137- if (BUILD_FRAMEWORK )
149+ if (AF_BUILD_FRAMEWORK )
138150 set_target_properties (${built_backends}
139151 PROPERTIES
140152 FRAMEWORK TRUE
@@ -161,7 +173,7 @@ install(FILES
161173 COMPONENT headers
162174)
163175
164- if (Forge_FOUND AND NOT USE_SYSTEM_FORGE )
176+ if (Forge_FOUND AND NOT AF_USE_SYSTEM_FORGE )
165177 option (INSTALL_FORGE_DEV "Install Forge Header and Share Files with ArrayFire" OFF )
166178 install (DIRECTORY "${ArrayFire_BINARY_DIR} /third_party/forge/lib/"
167179 DESTINATION "${AF_INSTALL_LIB_DIR} "
@@ -179,10 +191,10 @@ if(Forge_FOUND AND NOT USE_SYSTEM_FORGE)
179191 endif ()
180192endif ()
181193
182- # install the examples irrespective of the BUILD_EXAMPLES value
194+ # install the examples irrespective of the AF_BUILD_EXAMPLES value
183195# only the examples source files are installed, so the installation of these
184- # source files does not depend on BUILD_EXAMPLES
185- # when BUILD_EXAMPLES is OFF, the examples source is installed without
196+ # source files does not depend on AF_BUILD_EXAMPLES
197+ # when AF_BUILD_EXAMPLES is OFF, the examples source is installed without
186198# building the example executables
187199install (DIRECTORY examples/ #NOTE The slash at the end is important
188200 DESTINATION ${AF_INSTALL_EXAMPLE_DIR}
@@ -194,7 +206,7 @@ install(DIRECTORY assets/examples/ #NOTE The slash at the end is important
194206
195207foreach (backend CPU CUDA OpenCL Unified)
196208 string (TOUPPER ${backend} upper_backend)
197- if (BUILD_ ${upper_backend} )
209+ if (AF_BUILD_ ${upper_backend} )
198210 install (EXPORT ArrayFire${backend} Targets
199211 NAMESPACE ArrayFire::
200212 DESTINATION ${AF_INSTALL_CMAKE_DIR}
@@ -278,5 +290,5 @@ endif()
278290conditional_directory (BUILD_TESTING test )
279291
280292set (ASSETS_DIR "${ArrayFire_SOURCE_DIR} /assets" )
281- conditional_directory (BUILD_EXAMPLES examples )
282- conditional_directory (BUILD_DOCS docs )
293+ conditional_directory (AF_BUILD_EXAMPLES examples )
294+ conditional_directory (AF_BUILD_DOCS docs )
0 commit comments