Skip to content

Commit

Permalink
Make much less verbose builds, when not VERBOSE
Browse files Browse the repository at this point in the history
Conform to CMake convention of setting mypackage_FIND_QUIETLY.
Do some pkgconfig with QUIET.
Fix some warnings that were clutting output.

When you build with VERBOSE=1, it's still as verbose as always.
  • Loading branch information
lgritz committed Jun 6, 2015
1 parent 9cc8d50 commit 45f2b36
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 44 deletions.
50 changes: 38 additions & 12 deletions CMakeLists.txt
Expand Up @@ -14,8 +14,15 @@ cmake_minimum_required (VERSION 2.6)
if (NOT CMAKE_VERSION VERSION_LESS 2.8.4)
cmake_policy (SET CMP0017 NEW)
endif ()
if (NOT CMAKE_VERSION VERSION_LESS 3.2.2)
cmake_policy (SET CMP0042 OLD)
cmake_policy (SET CMP0046 OLD)
endif ()
set (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
message (STATUS "Project source dir = ${PROJECT_SOURCE_DIR}")

if (VERBOSE)
message (STATUS "Project source dir = ${PROJECT_SOURCE_DIR}")
endif ()
message (STATUS "Project build dir = ${CMAKE_BINARY_DIR}")

if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
Expand Down Expand Up @@ -45,24 +52,32 @@ if (CMAKE_COMPILER_IS_GNUCC)
execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message (STATUS "Using gcc ${GCC_VERSION} as the compiler")
if (VERBOSE)
message (STATUS "Using gcc ${GCC_VERSION} as the compiler")
endif ()
endif ()
message (STATUS "CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}")
message (STATUS "CMAKE_CXX_COMPILER_ID is ${CMAKE_CXX_COMPILER_ID}")
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set (CMAKE_COMPILER_IS_CLANG 1)
message (STATUS "Using clang as the compiler")
if (VERBOSE)
message (STATUS "Using clang as the compiler")
endif ()
endif ()
# Second try: for earlier versions of CMake, the CMAKE_CXX_COMPILER_ID
# appears to be unreliable and may say "GNU" despite using clang, so
# directly match against the compiler name.
if (CMAKE_CXX_COMPILER MATCHES "[Cc]lang")
set (CMAKE_COMPILER_IS_CLANG 1)
message (STATUS "The compiler seems to be clang")
if (VERBOSE)
message (STATUS "The compiler seems to be clang")
endif ()
endif ()
if (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set (CMAKE_COMPILER_IS_INTEL 1)
message (STATUS "Using Intel as the compiler")
if (VERBOSE)
message (STATUS "Using Intel as the compiler")
endif ()
endif ()

## turn on more detailed warnings and consider warnings as errors
Expand Down Expand Up @@ -149,6 +164,7 @@ if (EXISTS "/usr/lib/libc++.dylib")
set (OSL_SYSTEM_HAS_LIBCPP ON)
endif ()


set (VERBOSE OFF CACHE BOOL "Print lots of messages while compiling")
set (BUILDSTATIC OFF CACHE BOOL "Build static library instead of shared")
set (HIDE_SYMBOLS OFF CACHE BOOL "Hide symbols not in the public API")
Expand Down Expand Up @@ -205,11 +221,17 @@ if (NOT USE_SIMD STREQUAL "")
if (USE_SIMD STREQUAL "0")
add_definitions ("-DOIIO_NO_SSE=1")
else ()
if (MSVC OR CMAKE_COMPILER_IS_INTEL)
add_definitions ("/arch:${USE_SIMD}")
else ()
add_definitions ("-m${USE_SIMD}")
endif ()
string (REPLACE "," ";" SIMD_FEATURE_LIST ${USE_SIMD})
foreach (feature ${SIMD_FEATURE_LIST})
if (VERBOSE)
message (STATUS "SIMD feature: ${feature}")
endif ()
if (MSVC OR CMAKE_COMPILER_IS_INTEL)
add_definitions ("/arch:${feature}")
else ()
add_definitions ("-m${feature}")
endif ()
endforeach()
endif ()
endif ()

Expand All @@ -219,8 +241,8 @@ set (CMAKE_MODULE_PATH

include (util_macros)
include (platform)
include (oiio)
include (externalpackages)
include (oiio)
include (flexbison)
include_directories (
"${CMAKE_SOURCE_DIR}/src/include"
Expand All @@ -233,6 +255,10 @@ if (OSL_NAMESPACE)
add_definitions ("-DOSL_NAMESPACE=${OSL_NAMESPACE}")
endif ()

if (APPLE)
set (MACOSX_RPATH ON)
endif ()

# use, i.e. don't skip the full RPATH for the build tree
set (CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
Expand All @@ -242,7 +268,7 @@ set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)

message (STATUS "CMAKE_INSTALL_RPATH = ${CMAKE_INSTALL_RPATH}")

Expand Down
20 changes: 10 additions & 10 deletions Makefile
Expand Up @@ -28,7 +28,9 @@ endif

MY_MAKE_FLAGS ?=
MY_NINJA_FLAGS ?=
MY_CMAKE_FLAGS ?= -g3 -DSELF_CONTAINED_INSTALL_TREE:BOOL=TRUE
MY_CMAKE_FLAGS ?=
#-g3
#-DSELF_CONTAINED_INSTALL_TREE:BOOL=TRUE
BUILDSENTINEL ?= Makefile
NINJA ?= ninja
CMAKE ?= cmake
Expand All @@ -37,7 +39,6 @@ CMAKE ?= cmake
ifndef OSL_SITE
OSL_SITE := ${shell uname -n}
endif
$(info OSL_SITE = ${OSL_SITE})
ifneq (${shell echo ${OSL_SITE} | grep imageworks},)
include ${working_dir}/site/spi/Makefile-bits
endif
Expand All @@ -49,15 +50,14 @@ build_dir := ${top_build_dir}/${platform}${variant}
top_dist_dir := dist
dist_dir := ${top_dist_dir}/${platform}${variant}

$(info dist_dir = ${dist_dir})
$(info INSTALLDIR = ${INSTALLDIR})


VERBOSE := ${SHOWCOMMANDS}
ifneq (${VERBOSE},)
MY_MAKE_FLAGS += VERBOSE=${VERBOSE}
MY_CMAKE_FLAGS += -DVERBOSE:BOOL=1
TEST_FLAGS += -V
$(info OSL_SITE = ${OSL_SITE})
$(info dist_dir = ${dist_dir})
$(info INSTALLDIR = ${INSTALLDIR})
endif

ifneq (${LLVM_DIRECTORY},)
Expand Down Expand Up @@ -203,22 +203,22 @@ cmakesetup:

# 'make cmake' does a basic build (after first setting it up)
cmake: cmakesetup
( cd ${build_dir} ; ${RUN_BUILD} )
@ ( cd ${build_dir} ; ${RUN_BUILD} )

# 'make cmakeinstall' builds everthing and installs it in 'dist'.
# Suppress pointless output from docs installation.
cmakeinstall: cmake
( cd ${build_dir} ; ${RUN_BUILD} install | grep -v '^-- \(Installing\|Up-to-date\).*doc/html' )
@ ( cd ${build_dir} ; ${RUN_BUILD} install | grep -v '^-- \(Installing\|Up-to-date\|Set runtime path\)' )

# 'make package' builds everything and then makes an installable package
# (platform dependent -- may be .tar.gz, .sh, .dmg, .rpm, .deb. .exe)
package: cmakeinstall
( cd ${build_dir} ; ${RUN_BUILD} package )
@ ( cd ${build_dir} ; ${RUN_BUILD} package )

# 'make package_source' makes an installable source package
# (platform dependent -- may be .tar.gz, .sh, .dmg, .rpm, .deb. .exe)
package_source: cmakeinstall
( cd ${build_dir} ; ${RUN_BUILD} package_source )
@ ( cd ${build_dir} ; ${RUN_BUILD} package_source )

# 'make dist' is just a synonym for 'make cmakeinstall'
dist : cmakeinstall
Expand Down
6 changes: 4 additions & 2 deletions site/spi/Makefile-bits
Expand Up @@ -3,12 +3,12 @@
OSL_NAMESPACE ?= 'OSL_Arnold'
OPENIMAGEIO_NAMESPACE ?= 'OpenImageIO_Arnold'

MY_CMAKE_FLAGS += "-DEXTRA_CPP_DEFINITIONS=\"-DOSL_SPI=1\""
MY_CMAKE_FLAGS += -DEXTRA_CPP_ARGS="-DOSL_SPI=1"

## Generic OSX machines (including LG's laptop)
ifeq (${platform}, macosx)
MY_CMAKE_FLAGS += \
-DBUILD_WITH_INSTALL_RPATH=1 \
-DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \
-DCMAKE_INSTALL_NAME_DIR="${working_dir}/dist/${platform}${variant}/lib"
ifeq (${COMPILER}, clang)
MY_CMAKE_FLAGS += \
Expand Down Expand Up @@ -219,4 +219,6 @@ else
endif


ifneq (${VERBOSE},)
$(info MY_CMAKE_FLAGS: $(MY_CMAKE_FLAGS))
endif
36 changes: 29 additions & 7 deletions src/cmake/externalpackages.cmake
@@ -1,6 +1,24 @@
###########################################################################
# Find libraries

# When not in VERBOSE mode, try to make things as quiet as possible
if (NOT VERBOSE)
set (Bison_FIND_QUIETLY true)
set (Boost_FIND_QUIETLY true)
set (Flex_FIND_QUIETLY true)
set (IlmBase_FIND_QUIETLY true)
set (LLVM_FIND_QUIETLY true)
set (OpenImageIO_FIND_QUIETLY true)
set (Partio_FIND_QUIETLY true)
set (PkgConfig_FIND_QUIETLY true)
set (PugiXML_FIND_QUIETLY TRUE)
set (PythonInterp_FIND_QUIETLY true)
set (PythonLibs_FIND_QUIETLY true)
set (Threads_FIND_QUIETLY true)
set (ZLIB_FIND_QUIETLY true)
endif ()


setup_path (THIRD_PARTY_TOOLS_HOME
"unknown"
"Location of third party libraries in the external project")
Expand Down Expand Up @@ -49,7 +67,9 @@ endmacro ()
###########################################################################
# Boost setup

message (STATUS "BOOST_ROOT ${BOOST_ROOT}")
if (NOT Boost_FIND_QUIETLY)
message (STATUS "BOOST_ROOT ${BOOST_ROOT}")
endif ()

if (NOT DEFINED Boost_ADDITIONAL_VERSIONS)
set (Boost_ADDITIONAL_VERSIONS "1.57" "1.56"
Expand Down Expand Up @@ -77,7 +97,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND ${Boost_VERSION} GREATER 105499)
list (APPEND Boost_LIBRARIES "rt")
endif ()

if (VERBOSE)
if (NOT Boost_FIND_QUIETLY)
message (STATUS "BOOST_ROOT ${BOOST_ROOT}")
message (STATUS "Boost found ${Boost_FOUND} ")
message (STATUS "Boost version ${Boost_VERSION}")
Expand Down Expand Up @@ -108,7 +128,7 @@ if (USE_PARTIO)
set (PARTIO_FOUND TRUE)
add_definitions ("-DUSE_PARTIO=1")
include_directories ("${PARTIO_INCLUDE_DIR}")
if (VERBOSE)
if (NOT Partio_FIND_QUIETLY)
message (STATUS "Partio include = ${PARTIO_INCLUDE_DIR}")
message (STATUS "Partio library = ${PARTIO_LIBRARIES}")
endif ()
Expand Down Expand Up @@ -175,14 +195,16 @@ endif()
find_library ( LLVM_LIBRARY
NAMES LLVM-${LLVM_VERSION}
PATHS ${LLVM_LIB_DIR})
message (STATUS "LLVM version = ${LLVM_VERSION}")
message (STATUS "LLVM dir = ${LLVM_DIRECTORY}")
if (NOT LLVM_FIND_QUIETLY)
message (STATUS "LLVM version = ${LLVM_VERSION}")
message (STATUS "LLVM dir = ${LLVM_DIRECTORY}")
endif ()

find_library ( LLVM_MCJIT_LIBRARY
NAMES LLVMMCJIT
PATHS ${LLVM_LIB_DIR})

if (VERBOSE)
if (NOT LLVM_FIND_QUIETLY)
message (STATUS "LLVM includes = ${LLVM_INCLUDES}")
message (STATUS "LLVM library = ${LLVM_LIBRARY}")
message (STATUS "LLVM MCJIT library = ${LLVM_MCJIT_LIBRARY}")
Expand All @@ -208,7 +230,7 @@ if ((LLVM_LIBRARY OR LLVM_STATIC) AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_
OUTPUT_STRIP_TRAILING_WHITESPACE)
string (REPLACE " " ";" LLVM_LIBRARY ${LLVM_LIBRARY})
endif ()
if (VERBOSE)
if (NOT LLVM_FIND_QUIETLY)
message (STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}")
message (STATUS "LLVM library = ${LLVM_LIBRARY}")
endif ()
Expand Down
8 changes: 4 additions & 4 deletions src/cmake/flexbison.cmake
Expand Up @@ -15,24 +15,24 @@


IF (NOT FLEX_EXECUTABLE)
if (VERBOSE)
if (NOT Flex_FIND_QUIETLY)
MESSAGE (STATUS "Looking for flex")
endif ()
FIND_PROGRAM (FLEX_EXECUTABLE flex)
IF (FLEX_EXECUTABLE)
if (VERBOSE)
if (NOT Flex_FIND_QUIETLY)
MESSAGE (STATUS "Looking for flex -- ${FLEX_EXECUTABLE}")
endif ()
ENDIF (FLEX_EXECUTABLE)
ENDIF (NOT FLEX_EXECUTABLE)

IF (NOT BISON_EXECUTABLE)
if (VERBOSE)
if (NOT Bison_FIND_QUIETLY)
MESSAGE (STATUS "Looking for bison")
endif ()
FIND_PROGRAM (BISON_EXECUTABLE bison)
IF (BISON_EXECUTABLE)
if (VERBOSE)
if (NOT Bison_FIND_QUIETLY)
MESSAGE (STATUS "Looking for bison -- ${BISON_EXECUTABLE}")
endif ()
ENDIF (BISON_EXECUTABLE)
Expand Down
27 changes: 24 additions & 3 deletions src/cmake/modules/FindIlmBase.cmake
Expand Up @@ -26,6 +26,15 @@ include (FindPackageMessage)
include (SelectLibraryConfigurations)


if( ILMBASE_USE_STATIC_LIBS )
set( _ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
endif()
endif()

# Macro to assemble a helper state variable
macro (SET_STATE_VAR varname)
set (tmp_ilmbaselibs ${ILMBASE_CUSTOM_LIBRARIES})
Expand Down Expand Up @@ -63,8 +72,12 @@ endmacro ()
# variable names to the specified list
macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var)
string (TOUPPER ${prefix}_${libname} tmp_prefix)
# Handle new library names for OpenEXR 2.1 build via cmake
string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION})
string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION )

find_library(${tmp_prefix}_LIBRARY_RELEASE
NAMES ${libname}
NAMES ${libname} ${libname}-${_ILMBASE_VERSION}
HINTS ${${libpath_var}}
PATH_SUFFIXES lib
${ILMBASE_FIND_OPTIONS}
Expand Down Expand Up @@ -118,6 +131,7 @@ set (IlmBase_generic_library_paths
/usr/lib
/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/usr/local/lib
/usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE}
/sw/lib
/opt/local/lib)

Expand Down Expand Up @@ -152,7 +166,9 @@ if (ILMBASE_INCLUDE_DIR)
REGEX "^[ \t]*#define[ \t]+ILMBASE_VERSION_STRING[ \t]+\"[.0-9]+\".*$")

if(ILMBASE_BUILD_SPECIFICATION)
message(STATUS "${ILMBASE_BUILD_SPECIFICATION}")
if (NOT IlmBase_FIND_QUIETLY)
message(STATUS "${ILMBASE_BUILD_SPECIFICATION}")
endif ()
string(REGEX REPLACE ".*#define[ \t]+ILMBASE_VERSION_STRING[ \t]+\"([.0-9]+)\".*"
"\\1" XYZ ${ILMBASE_BUILD_SPECIFICATION})
set("ILMBASE_VERSION" ${XYZ} CACHE STRING "Version of ILMBase lib")
Expand Down Expand Up @@ -220,14 +236,19 @@ if (ILMBASE_FOUND)
list (APPEND ILMBASE_LIBRARIES ${${tmplib}})
endforeach ()
list (APPEND ILMBASE_LIBRARIES ${ILMBASE_PTHREADS})
if (VERBOSE)
if (NOT IlmBase_FIND_QUIETLY)
FIND_PACKAGE_MESSAGE (ILMBASE
"Found IlmBase: ${ILMBASE_LIBRARIES}"
"[${ILMBASE_INCLUDE_DIR}][${ILMBASE_LIBRARIES}][${ILMBASE_CURRENT_STATE}]"
)
endif ()
endif ()

# Restore the original find library ordering
if( ILMBASE_USE_STATIC_LIBS )
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()

# Unset the helper variables to avoid pollution
unset (ILMBASE_CURRENT_STATE)
unset (IlmBase_include_paths)
Expand Down
6 changes: 4 additions & 2 deletions src/cmake/modules/FindPugiXML.cmake
Expand Up @@ -20,8 +20,10 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS (PugiXML DEFAULT_MSG PUGIXML_LIBRARY

if (PUGIXML_FOUND)
set (PUGIXML_LIBRARIES ${PUGIXML_LIBRARY})
message (STATUS "PugiXML include = ${PUGIXML_INCLUDE_DIR}")
message (STATUS "PugiXML library = ${PUGIXML_LIBRARY}")
if (NOT PugiXML_FIND_QUIETLY)
message (STATUS "PugiXML include = ${PUGIXML_INCLUDE_DIR}")
message (STATUS "PugiXML library = ${PUGIXML_LIBRARY}")
endif ()
else ()
message (STATUS "No PugiXML found")
endif()
Expand Down

0 comments on commit 45f2b36

Please sign in to comment.