Skip to content

Commit 5df1093

Browse files
author
pradeep
committed
Remove conditional graphics build support
Going forward from commit where graphics dependencies are loaded at runtime, all builds can be built with graphics code enabled since it is not a link time dependency. If graphics library Forge & OpenGL, and their respective dependencies are loaded successfully at runtime, then the user will be able to use graphics. Hence, the option to build with or without graphics is not needed from now on. However, a new cmake option `AF_BUILD_FORGE`, which is disabled by default, is provided to enable building forge(submodule) along with arrayfire code to help in cases where a developer chooses to use graphics functionality either for testing, debugging or packaging.
1 parent 48d10de commit 5df1093

61 files changed

Lines changed: 68 additions & 1200 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ option(AF_BUILD_OPENCL "Build ArrayFire with a OpenCL backend" ${OpenCL_FO
4242
option(AF_BUILD_UNIFIED "Build Backend-Independent ArrayFire API" ON)
4343
option(AF_BUILD_DOCS "Create ArrayFire Documentation" ${DOXYGEN_FOUND})
4444
option(AF_BUILD_EXAMPLES "Build Examples" ON)
45+
option(AF_BUILD_FORGE
46+
"Forge libs are not built by default as it is not link time dependency" OFF)
4547

46-
option(AF_WITH_GRAPHICS "Build ArrayFire with Forge Graphics" ${OPENGL_FOUND})
4748
option(AF_WITH_NONFREE "Build ArrayFire nonfree algorithms" OFF)
4849
option(AF_WITH_LOGGING "Build ArrayFire with logging support" ON)
4950

@@ -65,7 +66,6 @@ af_deprecate(BUILD_CPU AF_BUILD_CPU)
6566
af_deprecate(BUILD_CUDA AF_BUILD_CUDA)
6667
af_deprecate(BUILD_OPENCL AF_BUILD_OPENCL)
6768
af_deprecate(BUILD_UNIFIED AF_BUILD_UNIFIED)
68-
af_deprecate(BUILD_GRAPHICS AF_WITH_GRAPHICS)
6969
af_deprecate(BUILD_DOCS AF_BUILD_DOCS)
7070
af_deprecate(BUILD_NONFREE AF_WITH_NONFREE)
7171
af_deprecate(BUILD_EXAMPLES AF_BUILD_EXAMPLES)
@@ -83,11 +83,10 @@ mark_as_advanced(
8383
SPDLOG_BUILD_EXAMPLES
8484
SPDLOG_BUILD_TESTING)
8585

86-
87-
88-
if(AF_WITH_GRAPHICS)
89-
include(AFconfigure_forge_submodule)
90-
endif()
86+
#Configure forge submodule
87+
#forge is included in ALL target if AF_BUILD_FORGE is ON
88+
#otherwise, forge is not built at all
89+
include(AFconfigure_forge_submodule)
9190

9291
configure_file(
9392
${ArrayFire_SOURCE_DIR}/CMakeModules/version.hpp.in

CMakeModules/AFconfigure_forge_submodule.cmake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ set(CMAKE_BUILD_TYPE Release)
1212
set(FG_BUILD_EXAMPLES OFF CACHE BOOL "Used to build Forge examples")
1313
set(FG_BUILD_DOCS OFF CACHE BOOL "Used to build Forge documentation")
1414
set(FG_WITH_FREEIMAGE OFF CACHE BOOL "Turn on usage of freeimage dependency")
15-
add_subdirectory(extern/forge EXCLUDE_FROM_ALL)
15+
if (AF_BUILD_FORGE)
16+
add_subdirectory(extern/forge)
17+
else (AF_BUILD_FORGE)
18+
add_subdirectory(extern/forge EXCLUDE_FROM_ALL)
19+
endif (AF_BUILD_FORGE)
1620
mark_as_advanced(
1721
FG_BUILD_EXAMPLES
1822
FG_BUILD_DOCS
@@ -26,3 +30,11 @@ mark_as_advanced(
2630
)
2731
set(CMAKE_BUILD_TYPE ${ArrayFireBuildType})
2832
set(CMAKE_INSTALL_PREFIX ${ArrayFireInstallPrefix})
33+
34+
if (AF_BUILD_FORGE)
35+
install(FILES
36+
$<TARGET_FILE:forge>
37+
$<TARGET_SONAME_FILE:forge>
38+
DESTINATION "${AF_INSTALL_LIB_DIR}"
39+
COMPONENT common_backend_dependencies)
40+
endif (AF_BUILD_FORGE)

CMakeModules/CPackConfig.cmake

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ if (WIN32)
6262
set(inst_pkg_hash "-${GIT_COMMIT_HASH}")
6363
endif ()
6464

65-
if(AF_WITH_GRAPHICS)
66-
set(CPACK_PACKAGE_FILE_NAME "${inst_pkg_name}${inst_pkg_hash}")
67-
else()
68-
set(CPACK_PACKAGE_FILE_NAME "${inst_pkg_name}-no-gl${inst_pkg_hash}")
69-
endif()
65+
set(CPACK_PACKAGE_FILE_NAME "${inst_pkg_name}${inst_pkg_hash}")
7066

7167
# Platform specific settings for CPACK generators
7268
# - OSX specific
@@ -317,7 +313,7 @@ set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
317313
set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
318314
set(CPACK_RPM_PACKAGE_LICENSE "BSD")
319315
set(CPACK_RPM_PACKAGE_URL "${SITE_URL}")
320-
if(AF_WITH_GRAPHICS)
316+
if(AF_BUILD_FORGE)
321317
set(CPACK_RPM_PACKAGE_REQUIRES "fontconfig-devel, libX11, libXrandr, libXinerama, libXxf86vm, libXcursor, mesa-libGL-devel")
322318
endif()
323319

CMakeModules/osx_install/InstallTool.cmake

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)