Skip to content

Commit bba631a

Browse files
author
Timmy
committed
Merge pull request #12 from kknox/develop
Adding SUFFIX_BIN/SUFFIX_LIB user settable cmake cache variables
2 parents 07a668e + 4a22f0b commit bba631a

File tree

6 files changed

+50
-90
lines changed

6 files changed

+50
-90
lines changed

src/CMakeLists.txt

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ else( )
2222
cmake_minimum_required( VERSION 2.6 )
2323
endif( )
2424

25+
if( CMAKE_GENERATOR MATCHES "NMake" )
26+
option( NMAKE_COMPILE_VERBOSE "Print compile and link strings to the console" OFF )
27+
if( NMAKE_COMPILE_VERBOSE )
28+
set( CMAKE_START_TEMP_FILE "" )
29+
set( CMAKE_END_TEMP_FILE "" )
30+
set( CMAKE_VERBOSE_MAKEFILE 1 )
31+
endif( )
32+
endif( )
33+
2534
# This becomes the name of the solution file
2635
project( clFFT )
2736

@@ -30,11 +39,6 @@ set( CLFFT_VERSION_MAJOR 2 )
3039
set( CLFFT_VERSION_MINOR 1 )
3140
set( CLFFT_VERSION_PATCH 0 )
3241
set( CLFFT_VERSION "${CLFFT_VERSION_MAJOR}.${CLFFT_VERSION_MINOR}.${CLFFT_VERSION_PATCH}")
33-
34-
# uncomment these to debug nmake and borland makefiles
35-
#SET(CMAKE_START_TEMP_FILE "")
36-
#SET(CMAKE_END_TEMP_FILE "")
37-
#SET(CMAKE_VERBOSE_MAKEFILE 1)
3842

3943
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} )
4044

@@ -80,8 +84,9 @@ else()
8084
endif()
8185

8286
if( MSVC_IDE )
83-
set( BUILD64 ${CMAKE_CL_64} )
8487
set_property( GLOBAL PROPERTY USE_FOLDERS TRUE )
88+
89+
set( BUILD64 ${CMAKE_CL_64} )
8590
else()
8691
option( BUILD64 "Build a 64-bit product" ON )
8792

@@ -93,15 +98,25 @@ else()
9398
endif()
9499
endif()
95100

101+
# These variables are meant to contain string which should be appended to the installation paths
102+
# of library and executable binaries, respectively. They are meant to be user configurable/overridable.
103+
set( SUFFIX_LIB_DEFAULT "" )
104+
set( SUFFIX_BIN_DEFAULT "" )
105+
96106
# Modify the global find property to help us find libraries like Boost in the correct paths for 64-bit
97107
# Essentially, find_library calls will look for /lib64 instead of /lib; works for windows and linux
98108
if( BUILD64 )
99109
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE )
100110
message( STATUS "64bit build - FIND_LIBRARY_USE_LIB64_PATHS TRUE" )
101-
else()
111+
112+
set( SUFFIX_LIB_DEFAULT "64" )
113+
else( )
102114
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE )
103115
message( STATUS "32bit build - FIND_LIBRARY_USE_LIB64_PATHS FALSE" )
104-
endif()
116+
endif( )
117+
118+
set( SUFFIX_LIB ${SUFFIX_LIB_DEFAULT} CACHE STRING "String to append to 'lib' install path" )
119+
set( SUFFIX_BIN ${SUFFIX_BIN_DEFAULT} CACHE STRING "String to append to 'bin' install path" )
105120

106121
# Client is built only if boost is found; on windows, we need vs10 or higher
107122
# Find Boost on the system, and configure the type of boost build we want
@@ -162,19 +177,11 @@ get_filename_component( C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME_WE )
162177
if( C_COMPILER_NAME STREQUAL "cl" )
163178
# Following options for nMake
164179
message( STATUS "Detected MSVS Ver: " ${MSVC_VERSION} )
165-
if( NOT MSVC_IDE )
166-
message( STATUS "Using an nMake environment to build" )
167-
168-
# I can't get nmake to work because of faulty /machine:, not sure that this isn't a cmake bug
169-
# if( BUILD64 )
170-
# set( CMAKE_EXE_LINKER_FLAGS "/machine:amd64 ${CMAKE_EXE_LINKER_FLAGS}" )
171-
# set( CMAKE_SHARED_LINKER_FLAGS "/machine:amd64 ${CMAKE_SHARED_LINKER_FLAGS}" )
172-
# set( CMAKE_MODULE_LINKER_FLAGS "/machine:amd64 ${CMAKE_MODULE_LINKER_FLAGS }" )
173-
# else( )
174-
# set( CMAKE_EXE_LINKER_FLAGS "/machine:i386 ${CMAKE_EXE_LINKER_FLAGS}" )
175-
# endif( )
176180

177-
endif( )
181+
# CMake sets huge stack frames for windows, for whatever reason. We go with compiler default.
182+
string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" )
183+
string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" )
184+
string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}" )
178185

179186
elseif( C_COMPILER_NAME STREQUAL "gcc" )
180187
message( STATUS "Detected GNU fortran compiler." )

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)