From b37940112f2b05a88d9df16437a88908e89a228d Mon Sep 17 00:00:00 2001 From: Kent Knox Date: Sun, 25 Aug 2013 23:54:14 -0500 Subject: [PATCH 1/2] First attempt at changing install suffixes based upon cmake cache variables --- src/CMakeLists.txt | 17 ++++++++++++++--- src/client/CMakeLists.txt | 25 ++++++------------------- src/library/CMakeLists.txt | 21 ++++++--------------- src/scripts/perf/CMakeLists.txt | 8 +------- src/statTimer/CMakeLists.txt | 21 ++++++--------------- src/tests/CMakeLists.txt | 18 ++++-------------- 6 files changed, 37 insertions(+), 73 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 549590e0..30e341df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -80,8 +80,9 @@ else() endif() if( MSVC_IDE ) - set( BUILD64 ${CMAKE_CL_64} ) set_property( GLOBAL PROPERTY USE_FOLDERS TRUE ) + + set( BUILD64 ${CMAKE_CL_64} ) else() option( BUILD64 "Build a 64-bit product" ON ) @@ -93,15 +94,25 @@ else() endif() endif() +# These variables are meant to contain string which should be appended to the installation paths +# of library and executable binaries, respectively. They are meant to be user configurable/overridable. +set( SUFFIX_LIB_DEFAULT "" ) +set( SUFFIX_BIN_DEFAULT "" ) + # Modify the global find property to help us find libraries like Boost in the correct paths for 64-bit # Essentially, find_library calls will look for /lib64 instead of /lib; works for windows and linux if( BUILD64 ) set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE ) message( STATUS "64bit build - FIND_LIBRARY_USE_LIB64_PATHS TRUE" ) -else() + + set( SUFFIX_LIB_DEFAULT "64" ) +else( ) set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE ) message( STATUS "32bit build - FIND_LIBRARY_USE_LIB64_PATHS FALSE" ) -endif() +endif( ) + +set( SUFFIX_LIB ${SUFFIX_LIB_DEFAULT} CACHE STRING "String to append to 'lib' install path" ) +set( SUFFIX_BIN ${SUFFIX_BIN_DEFAULT} CACHE STRING "String to append to 'bin' install path" ) # Client is built only if boost is found; on windows, we need vs10 or higher # Find Boost on the system, and configure the type of boost build we want diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index d9609cca..99a89d31 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -48,22 +48,9 @@ target_link_libraries( Client clFFT ${Boost_LIBRARIES} ${OPENCL_LIBRARIES} ${DL_ set_target_properties( Client PROPERTIES VERSION ${CLFFT_VERSION} ) set_target_properties( Client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/staging" ) -if( BUILD64 ) - # CPack configuration; include the executable into the package - install( TARGETS Client - RUNTIME DESTINATION bin64 - LIBRARY DESTINATION lib64 - ARCHIVE DESTINATION lib64/import - ) - -else() - # CPack configuration; include the executable into the package - install( TARGETS Client - RUNTIME DESTINATION bin32 - LIBRARY DESTINATION lib32 - ARCHIVE DESTINATION lib32/import - ) -endif() - -# configure_file( "${PROJECT_SOURCE_DIR}/client/CMakeLists.pack" - # "${PROJECT_BINARY_DIR}/samples/CMakeLists.txt" COPYONLY ) +# CPack configuration; include the executable into the package +install( TARGETS Client + RUNTIME DESTINATION bin${SUFFIX_BIN} + LIBRARY DESTINATION lib${SUFFIX_LIB} + ARCHIVE DESTINATION lib${SUFFIX_LIB}/import + ) diff --git a/src/library/CMakeLists.txt b/src/library/CMakeLists.txt index ea7637bf..2bd83c6e 100644 --- a/src/library/CMakeLists.txt +++ b/src/library/CMakeLists.txt @@ -85,18 +85,9 @@ if( UNIX ) # set_target_properties( clFFT PROPERTIES COMPILE_FLAGS "-frtti" ) endif( ) -if( BUILD64 ) - # CPack configuration; include the executable into the package - install( TARGETS clFFT - RUNTIME DESTINATION bin64 - LIBRARY DESTINATION lib64 - ARCHIVE DESTINATION lib64/import - ) -else() - # CPack configuration; include the executable into the package - install( TARGETS clFFT - RUNTIME DESTINATION bin32 - LIBRARY DESTINATION lib32 - ARCHIVE DESTINATION lib32/import - ) -endif() +# CPack configuration; include the executable into the package +install( TARGETS clFFT + RUNTIME DESTINATION bin${SUFFIX_BIN} + LIBRARY DESTINATION lib${SUFFIX_LIB} + ARCHIVE DESTINATION lib${SUFFIX_LIB}/import + ) diff --git a/src/scripts/perf/CMakeLists.txt b/src/scripts/perf/CMakeLists.txt index 95add5a7..37337893 100644 --- a/src/scripts/perf/CMakeLists.txt +++ b/src/scripts/perf/CMakeLists.txt @@ -21,10 +21,4 @@ set(GRAPHING_SCRIPTS measurePerformance.py performanceUtility.py ) -if( BUILD64 ) - set( BIN_DIR bin64 ) -else() - set( BIN_DIR bin32 ) -endif() - -install( FILES ${GRAPHING_SCRIPTS} DESTINATION ${BIN_DIR} ) \ No newline at end of file +install( FILES ${GRAPHING_SCRIPTS} DESTINATION bin${SUFFIX_BIN} ) \ No newline at end of file diff --git a/src/statTimer/CMakeLists.txt b/src/statTimer/CMakeLists.txt index 0b5d75f8..c2d55bb3 100644 --- a/src/statTimer/CMakeLists.txt +++ b/src/statTimer/CMakeLists.txt @@ -73,18 +73,9 @@ if( UNIX ) target_link_libraries( StatTimer -lrt ) endif( ) -if( BUILD64 ) - # CPack configuration; include the executable into the package - install( TARGETS StatTimer - RUNTIME DESTINATION bin64 - LIBRARY DESTINATION lib64 - ARCHIVE DESTINATION lib64/import - ) -else() - # CPack configuration; include the executable into the package - install( TARGETS StatTimer - RUNTIME DESTINATION bin32 - LIBRARY DESTINATION lib32 - ARCHIVE DESTINATION lib32/import - ) -endif() +# CPack configuration; include the executable into the package +install( TARGETS StatTimer + RUNTIME DESTINATION bin${SUFFIX_BIN} + LIBRARY DESTINATION lib${SUFFIX_LIB} + ARCHIVE DESTINATION lib${SUFFIX_LIB}/import + ) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 87510efb..29e9bf86 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -49,16 +49,6 @@ set( clFFT.Test.Headers set( clFFT.Test.Files ${clFFT.Test.Source} ${clFFT.Test.Headers} ) - - -if( BUILD64 ) - set( BIN_DIR bin64 ) - set( LIB_DIR lib64 ) -else() - set( BIN_DIR bin32 ) - set( LIB_DIR lib32 ) -endif() - set( LD_PTHREAD "" ) if( CMAKE_COMPILER_IS_GNUCXX ) set( CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}" ) @@ -103,7 +93,7 @@ set_target_properties( Test PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINAR # CPack configuration; include the executable into the package install( TARGETS Test - RUNTIME DESTINATION ${BIN_DIR} - LIBRARY DESTINATION ${LIB_DIR} - ARCHIVE DESTINATION ${LIB_DIR}/import - ) + RUNTIME DESTINATION bin${SUFFIX_BIN} + LIBRARY DESTINATION lib${SUFFIX_LIB} + ARCHIVE DESTINATION lib${SUFFIX_LIB}/import + ) From 4a22f0b75671de190b990c1635e6034e5d96696b Mon Sep 17 00:00:00 2001 From: Kent Knox Date: Mon, 26 Aug 2013 14:49:52 -0500 Subject: [PATCH 2/2] Removing /stack from windows builds; adding printscreen support for nmake builds --- src/CMakeLists.txt | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 30e341df..446988ab 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,6 +22,15 @@ else( ) cmake_minimum_required( VERSION 2.6 ) endif( ) +if( CMAKE_GENERATOR MATCHES "NMake" ) + option( NMAKE_COMPILE_VERBOSE "Print compile and link strings to the console" OFF ) + if( NMAKE_COMPILE_VERBOSE ) + set( CMAKE_START_TEMP_FILE "" ) + set( CMAKE_END_TEMP_FILE "" ) + set( CMAKE_VERBOSE_MAKEFILE 1 ) + endif( ) +endif( ) + # This becomes the name of the solution file project( clFFT ) @@ -30,11 +39,6 @@ set( CLFFT_VERSION_MAJOR 2 ) set( CLFFT_VERSION_MINOR 1 ) set( CLFFT_VERSION_PATCH 0 ) set( CLFFT_VERSION "${CLFFT_VERSION_MAJOR}.${CLFFT_VERSION_MINOR}.${CLFFT_VERSION_PATCH}") - -# uncomment these to debug nmake and borland makefiles -#SET(CMAKE_START_TEMP_FILE "") -#SET(CMAKE_END_TEMP_FILE "") -#SET(CMAKE_VERBOSE_MAKEFILE 1) set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR} ) @@ -173,19 +177,11 @@ get_filename_component( C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME_WE ) if( C_COMPILER_NAME STREQUAL "cl" ) # Following options for nMake message( STATUS "Detected MSVS Ver: " ${MSVC_VERSION} ) - if( NOT MSVC_IDE ) - message( STATUS "Using an nMake environment to build" ) - - # I can't get nmake to work because of faulty /machine:, not sure that this isn't a cmake bug - # if( BUILD64 ) - # set( CMAKE_EXE_LINKER_FLAGS "/machine:amd64 ${CMAKE_EXE_LINKER_FLAGS}" ) - # set( CMAKE_SHARED_LINKER_FLAGS "/machine:amd64 ${CMAKE_SHARED_LINKER_FLAGS}" ) - # set( CMAKE_MODULE_LINKER_FLAGS "/machine:amd64 ${CMAKE_MODULE_LINKER_FLAGS }" ) - # else( ) - # set( CMAKE_EXE_LINKER_FLAGS "/machine:i386 ${CMAKE_EXE_LINKER_FLAGS}" ) - # endif( ) - endif( ) + # CMake sets huge stack frames for windows, for whatever reason. We go with compiler default. + string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}" ) + string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" ) + string( REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}" ) elseif( C_COMPILER_NAME STREQUAL "gcc" ) message( STATUS "Detected GNU fortran compiler." )