Skip to content

Commit eec4e70

Browse files
committed
CMake changes for Ninja
1 parent b38e449 commit eec4e70

File tree

7 files changed

+25
-7
lines changed

7 files changed

+25
-7
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
22
PROJECT(ARRAYFIRE)
33

44
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
5+
if(POLICY CMP0058)
6+
CMAKE_POLICY(SET CMP0058 NEW)
7+
endif(POLICY CMP0058)
58

69
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
710
INCLUDE(UploadCoveralls)

CMakeModules/build_cl2hpp.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@ INCLUDE(ExternalProject)
22

33
SET(prefix ${PROJECT_BINARY_DIR}/third_party/cl2hpp)
44

5+
IF(CMAKE_VERSION VERSION_LESS 3.2)
6+
IF(CMAKE_GENERATOR MATCHES "Ninja")
7+
MESSAGE(WARNING "Building forge with Ninja has known issues with CMake older than 3.2")
8+
endif()
9+
SET(byproducts)
10+
ELSE()
11+
SET(byproducts BUILD_BYPRODUCTS "${prefix}/package/CL/cl2.hpp")
12+
ENDIF()
13+
514
ExternalProject_Add(
615
cl2hpp-ext
716
GIT_REPOSITORY https://github.com/KhronosGroup/OpenCL-CLHPP.git
17+
${byproducts}
818
GIT_TAG 75bb7d0d8b2ffc6aac0a3dcaa22f6622cab81f7c
919
PREFIX "${prefix}"
1020
INSTALL_DIR "${prefix}/package"

CMakeModules/build_clBLAS.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ IF(CMAKE_VERSION VERSION_LESS 3.2)
88
endif()
99
SET(byproducts)
1010
ELSE()
11-
SET(byproducts BYPRODUCTS ${clBLAS_location})
11+
SET(byproducts BUILD_BYPRODUCTS ${clBLAS_location})
1212
ENDIF()
1313

1414
ExternalProject_Add(
1515
clBLAS-ext
1616
GIT_REPOSITORY https://github.com/arrayfire/clBLAS.git
1717
GIT_TAG arrayfire-release
18+
${byproducts}
1819
PREFIX "${prefix}"
1920
INSTALL_DIR "${prefix}"
2021
UPDATE_COMMAND ""
@@ -30,7 +31,6 @@ ExternalProject_Add(
3031
-DBUILD_TEST:BOOL=OFF
3132
-DBUILD_KTEST:BOOL=OFF
3233
-DSUFFIX_LIB:STRING=
33-
${byproducts}
3434
)
3535

3636
ExternalProject_Get_Property(clBLAS-ext install_dir)

CMakeModules/build_clFFT.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ IF(CMAKE_VERSION VERSION_LESS 3.2)
88
endif()
99
SET(byproducts)
1010
ELSE()
11-
SET(byproducts BYPRODUCTS ${clFFT_location})
11+
SET(byproducts BUILD_BYPRODUCTS ${clFFT_location})
1212
ENDIF()
1313

1414
ExternalProject_Add(

CMakeModules/build_forge.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ELSE(USE_SYSTEM_GLBINDING)
66
SET(GLBINDING_TARGET glbinding)
77
ENDIF(USE_SYSTEM_GLBINDING)
88

9-
SET(prefix ${PROJECT_BINARY_DIR}/third_party/forge)
9+
SET(prefix ${CMAKE_BINARY_DIR}/third_party/forge)
1010

1111
# FIXME: Cannot use $<CONFIG> generator expression here because add_custom_command
1212
# does not yet support it for the OUTPUT argument, see also:
@@ -39,7 +39,11 @@ IF(CMAKE_VERSION VERSION_LESS 3.2)
3939
endif()
4040
SET(byproducts)
4141
ELSE()
42-
SET(byproducts BYPRODUCTS ${forge_location})
42+
IF (WIN32)
43+
SET(byproducts BUILD_BYPRODUCTS third_party/forge/lib/forge${CMAKE_STATIC_LIBRARY_SUFFIX})
44+
ELSE (WIN32)
45+
SET(byproducts BUILD_BYPRODUCTS ${forge_location})
46+
ENDIF(WIN32)
4347
ENDIF()
4448

4549
SET(FORGE_VERSION 0.9.2)
@@ -49,6 +53,7 @@ ExternalProject_Add(
4953
forge-ext
5054
GIT_REPOSITORY https://github.com/arrayfire/forge.git
5155
GIT_TAG v${FORGE_VERSION}
56+
${byproducts}
5257
PREFIX "${prefix}"
5358
INSTALL_DIR "${prefix}"
5459
UPDATE_COMMAND ""
@@ -69,7 +74,6 @@ ExternalProject_Add(
6974
-DFREEIMAGE_STATIC_LIBRARY:PATH=${FREEIMAGE_STATIC_LIBRARY}
7075
-DUSE_FREEIMAGE_STATIC:BOOL=${USE_FREEIMAGE_STATIC}
7176
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${forge_lib_config}
72-
${byproducts}
7377
)
7478

7579
ExternalProject_Get_Property(forge-ext binary_dir)

CMakeModules/build_glbinding.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ IF(CMAKE_VERSION VERSION_LESS 3.2)
1515
endif()
1616
SET(byproducts)
1717
ELSE()
18-
SET(byproducts BYPRODUCTS ${glbinding_location})
18+
SET(byproducts BUILD_BYPRODUCTS ${glbinding_location})
1919
ENDIF()
2020

2121
IF(UNIX)

src/backend/cpu/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ IF(DEFINED BLAS_SYM_FILE)
191191
TARGET_LINK_LIBRARIES(afcpu PUBLIC $<TARGET_FILE:afcpu_static>)
192192
ELSE(APPLE)
193193
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/afcpu_static.renamed
194+
BYPRODUCTS ${PROJECT_BINARY_DIR}/afcpu_static.renamed
194195
COMMAND objcopy --redefine-syms ${BLAS_SYM_FILE} $<TARGET_FILE:afcpu_static> ${PROJECT_BINARY_DIR}/afcpu_static.renamed
195196
DEPENDS $<TARGET_FILE:afcpu_static>)
196197
TARGET_LINK_LIBRARIES(afcpu PUBLIC ${PROJECT_BINARY_DIR}/afcpu_static.renamed)

0 commit comments

Comments
 (0)