Skip to content

Commit b379401

Browse files
author
Kent Knox
committed
First attempt at changing install suffixes based upon cmake cache variables
1 parent 07a668e commit b379401

File tree

6 files changed

+37
-73
lines changed

6 files changed

+37
-73
lines changed

src/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ else()
8080
endif()
8181

8282
if( MSVC_IDE )
83-
set( BUILD64 ${CMAKE_CL_64} )
8483
set_property( GLOBAL PROPERTY USE_FOLDERS TRUE )
84+
85+
set( BUILD64 ${CMAKE_CL_64} )
8586
else()
8687
option( BUILD64 "Build a 64-bit product" ON )
8788

@@ -93,15 +94,25 @@ else()
9394
endif()
9495
endif()
9596

97+
# These variables are meant to contain string which should be appended to the installation paths
98+
# of library and executable binaries, respectively. They are meant to be user configurable/overridable.
99+
set( SUFFIX_LIB_DEFAULT "" )
100+
set( SUFFIX_BIN_DEFAULT "" )
101+
96102
# Modify the global find property to help us find libraries like Boost in the correct paths for 64-bit
97103
# Essentially, find_library calls will look for /lib64 instead of /lib; works for windows and linux
98104
if( BUILD64 )
99105
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE )
100106
message( STATUS "64bit build - FIND_LIBRARY_USE_LIB64_PATHS TRUE" )
101-
else()
107+
108+
set( SUFFIX_LIB_DEFAULT "64" )
109+
else( )
102110
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE )
103111
message( STATUS "32bit build - FIND_LIBRARY_USE_LIB64_PATHS FALSE" )
104-
endif()
112+
endif( )
113+
114+
set( SUFFIX_LIB ${SUFFIX_LIB_DEFAULT} CACHE STRING "String to append to 'lib' install path" )
115+
set( SUFFIX_BIN ${SUFFIX_BIN_DEFAULT} CACHE STRING "String to append to 'bin' install path" )
105116

106117
# Client is built only if boost is found; on windows, we need vs10 or higher
107118
# Find Boost on the system, and configure the type of boost build we want

src/client/CMakeLists.txt

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,9 @@ target_link_libraries( Client clFFT ${Boost_LIBRARIES} ${OPENCL_LIBRARIES} ${DL_
4848
set_target_properties( Client PROPERTIES VERSION ${CLFFT_VERSION} )
4949
set_target_properties( Client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" )
5050

51-
if( BUILD64 )
52-
# CPack configuration; include the executable into the package
53-
install( TARGETS Client
54-
RUNTIME DESTINATION bin64
55-
LIBRARY DESTINATION lib64
56-
ARCHIVE DESTINATION lib64/import
57-
)
58-
59-
else()
60-
# CPack configuration; include the executable into the package
61-
install( TARGETS Client
62-
RUNTIME DESTINATION bin32
63-
LIBRARY DESTINATION lib32
64-
ARCHIVE DESTINATION lib32/import
65-
)
66-
endif()
67-
68-
# configure_file( "${PROJECT_SOURCE_DIR}/client/CMakeLists.pack"
69-
# "${PROJECT_BINARY_DIR}/samples/CMakeLists.txt" COPYONLY )
51+
# CPack configuration; include the executable into the package
52+
install( TARGETS Client
53+
RUNTIME DESTINATION bin${SUFFIX_BIN}
54+
LIBRARY DESTINATION lib${SUFFIX_LIB}
55+
ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
56+
)

src/library/CMakeLists.txt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,9 @@ if( UNIX )
8585
# set_target_properties( clFFT PROPERTIES COMPILE_FLAGS "-frtti" )
8686
endif( )
8787

88-
if( BUILD64 )
89-
# CPack configuration; include the executable into the package
90-
install( TARGETS clFFT
91-
RUNTIME DESTINATION bin64
92-
LIBRARY DESTINATION lib64
93-
ARCHIVE DESTINATION lib64/import
94-
)
95-
else()
96-
# CPack configuration; include the executable into the package
97-
install( TARGETS clFFT
98-
RUNTIME DESTINATION bin32
99-
LIBRARY DESTINATION lib32
100-
ARCHIVE DESTINATION lib32/import
101-
)
102-
endif()
88+
# CPack configuration; include the executable into the package
89+
install( TARGETS clFFT
90+
RUNTIME DESTINATION bin${SUFFIX_BIN}
91+
LIBRARY DESTINATION lib${SUFFIX_LIB}
92+
ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
93+
)

src/scripts/perf/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,4 @@ set(GRAPHING_SCRIPTS measurePerformance.py
2121
performanceUtility.py
2222
)
2323

24-
if( BUILD64 )
25-
set( BIN_DIR bin64 )
26-
else()
27-
set( BIN_DIR bin32 )
28-
endif()
29-
30-
install( FILES ${GRAPHING_SCRIPTS} DESTINATION ${BIN_DIR} )
24+
install( FILES ${GRAPHING_SCRIPTS} DESTINATION bin${SUFFIX_BIN} )

src/statTimer/CMakeLists.txt

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,9 @@ if( UNIX )
7373
target_link_libraries( StatTimer -lrt )
7474
endif( )
7575

76-
if( BUILD64 )
77-
# CPack configuration; include the executable into the package
78-
install( TARGETS StatTimer
79-
RUNTIME DESTINATION bin64
80-
LIBRARY DESTINATION lib64
81-
ARCHIVE DESTINATION lib64/import
82-
)
83-
else()
84-
# CPack configuration; include the executable into the package
85-
install( TARGETS StatTimer
86-
RUNTIME DESTINATION bin32
87-
LIBRARY DESTINATION lib32
88-
ARCHIVE DESTINATION lib32/import
89-
)
90-
endif()
76+
# CPack configuration; include the executable into the package
77+
install( TARGETS StatTimer
78+
RUNTIME DESTINATION bin${SUFFIX_BIN}
79+
LIBRARY DESTINATION lib${SUFFIX_LIB}
80+
ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
81+
)

src/tests/CMakeLists.txt

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ set( clFFT.Test.Headers
4949

5050
set( clFFT.Test.Files ${clFFT.Test.Source} ${clFFT.Test.Headers} )
5151

52-
53-
54-
if( BUILD64 )
55-
set( BIN_DIR bin64 )
56-
set( LIB_DIR lib64 )
57-
else()
58-
set( BIN_DIR bin32 )
59-
set( LIB_DIR lib32 )
60-
endif()
61-
6252
set( LD_PTHREAD "" )
6353
if( CMAKE_COMPILER_IS_GNUCXX )
6454
set( CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}" )
@@ -103,7 +93,7 @@ set_target_properties( Test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINAR
10393

10494
# CPack configuration; include the executable into the package
10595
install( TARGETS Test
106-
RUNTIME DESTINATION ${BIN_DIR}
107-
LIBRARY DESTINATION ${LIB_DIR}
108-
ARCHIVE DESTINATION ${LIB_DIR}/import
109-
)
96+
RUNTIME DESTINATION bin${SUFFIX_BIN}
97+
LIBRARY DESTINATION lib${SUFFIX_LIB}
98+
ARCHIVE DESTINATION lib${SUFFIX_LIB}/import
99+
)

0 commit comments

Comments
 (0)