From 1bd0db59f4750dd9603d82544f63d89f53288a93 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 25 Jan 2011 14:43:13 +0000 Subject: use cmake defined names for jpeg, png, zlib and python libs, building on *nix with non-standard libjpeg/png/zlib locations was broken. in the case of python this makes it easier to move to find_package(PythonLibs) when 3.x is supported. --- CMakeLists.txt | 53 +++++++++++----------- build_files/cmake/macros.cmake | 6 +-- doc/build_systems/cmake.txt | 4 +- intern/audaspace/CMakeLists.txt | 2 +- intern/elbeem/CMakeLists.txt | 4 +- intern/smoke/CMakeLists.txt | 4 +- source/blender/avi/CMakeLists.txt | 2 +- source/blender/blenkernel/CMakeLists.txt | 4 +- source/blender/blenlib/CMakeLists.txt | 2 +- source/blender/blenloader/CMakeLists.txt | 2 +- source/blender/editors/space_script/CMakeLists.txt | 2 +- source/blender/editors/space_text/CMakeLists.txt | 2 +- source/blender/imbuf/CMakeLists.txt | 6 +-- source/blender/modifiers/CMakeLists.txt | 2 +- source/blender/nodes/CMakeLists.txt | 2 +- source/blender/python/generic/CMakeLists.txt | 2 +- source/blender/python/intern/CMakeLists.txt | 2 +- source/blender/windowmanager/CMakeLists.txt | 2 +- source/gameengine/CMakeLists.txt | 2 +- source/gameengine/GamePlayer/common/CMakeLists.txt | 6 +-- source/gameengine/GamePlayer/ghost/CMakeLists.txt | 2 +- source/gameengine/Physics/Bullet/CMakeLists.txt | 2 +- source/gameengine/Rasterizer/CMakeLists.txt | 2 +- 23 files changed, 59 insertions(+), 58 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bad6b878d54..92c0fae57bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,9 +166,9 @@ TEST_SSE_SUPPORT() # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g: # On Unix: -# cmake -D PYTHON_LIB=/usr/local/lib/python3.1/config/libpython3.1.so -D PYTHON_INC=/usr/local/include/python3.1 -G "Unix Makefiles" ../blender +# cmake -D PYTHON_LIBRARY=/usr/local/lib/python3.1/config/libpython3.1.so -D PYTHON_INCLUDE_DIRS=/usr/local/include/python3.1 -G "Unix Makefiles" ../blender # On Macs: -# cmake -D PYTHON_INC=/System/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/config -G Xcode ../blender +# cmake -D PYTHON_INCLUDE_DIRS=/System/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -D PYTHON_LIBPATH=/System/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/config -G Xcode ../blender # # When changing any of this remember to update the notes in doc/build_systems/cmake.txt @@ -227,11 +227,11 @@ if(UNIX AND NOT APPLE) # find_package(PythonLibs) set(PYTHON /usr) set(PYTHON_VERSION 3.1) - set(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "") - mark_as_advanced(PYTHON_INC) + set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "") + mark_as_advanced(PYTHON_INCLUDE_DIRS) # set(PYTHON_BINARY python) # not used yet - set(PYTHON_LIB python${PYTHON_VERSION} CACHE STRING "") - mark_as_advanced(PYTHON_LIB) + set(PYTHON_LIBRARY python${PYTHON_VERSION} CACHE STRING "") + mark_as_advanced(PYTHON_LIBRARY) set(PYTHON_LIBPATH ${PYTHON}/lib CACHE STRING "") mark_as_advanced(PYTHON_LIBPATH) # find_package(PythonInterp) # not used yet @@ -246,6 +246,7 @@ if(UNIX AND NOT APPLE) mark_as_advanced(SDLMAIN_LIBRARY) mark_as_advanced(SDL_INCLUDE_DIR) mark_as_advanced(SDL_LIBRARY) + mark_as_advanced(SDL_LIBRARY_TEMP) # unset(SDLMAIN_LIBRARY CACHE) if(NOT SDL_FOUND) set(WITH_SDL OFF) @@ -411,12 +412,12 @@ elseif(WIN32) endif() set(PNG "${LIBDIR}/png") - set(PNG_INC "${PNG}/include") - set(PNG_LIBPATH ${PNG}/lib) + set(PNG_INCLUDE_DIR "${PNG}/include") + set(PNG_LIBPATH ${PNG}/lib) # not cmake defined set(JPEG "${LIBDIR}/jpeg") - set(JPEG_INC "${JPEG}/include") - set(JPEG_LIBPATH ${JPEG}/lib) + set(JPEG_INCLUDE_DIR "${JPEG}/include") + set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined set(WINTAB_INC ${LIBDIR}/wintab/include) @@ -495,10 +496,10 @@ elseif(WIN32) else() set(PNG_LIBRARIES libpng_st) endif() - set(JPEG_LIBRARY libjpeg) + set(JPEG_LIBRARIES libjpeg) set(ZLIB ${LIBDIR}/zlib) - set(ZLIB_INC ${ZLIB}/include) + set(ZLIB_INCLUDE_DIRS ${ZLIB}/include) set(ZLIB_LIBPATH ${ZLIB}/lib) if(CMAKE_CL_64) set(ZLIB_LIBRARIES libz) @@ -576,9 +577,9 @@ elseif(WIN32) if(WITH_PYTHON) set(PYTHON ${LIBDIR}/python) set(PYTHON_VERSION 3.1) - set(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}") + set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}") # set(PYTHON_BINARY python) # not used yet - set(PYTHON_LIB python31) + set(PYTHON_LIBRARY python31) set(PYTHON_LIBPATH ${PYTHON}/lib) endif() @@ -613,11 +614,11 @@ elseif(WIN32) set(GETTEXT_LIB intl) endif() - set(JPEG_LIBRARY libjpeg) + set(JPEG_LIBRARIES libjpeg) set(PNG_LIBRARIES png) set(ZLIB ${LIBDIR}/zlib) - set(ZLIB_INC ${ZLIB}/include) + set(ZLIB_INCLUDE_DIRS ${ZLIB}/include) set(ZLIB_LIBPATH ${ZLIB}/lib) set(ZLIB_LIBRARIES z) @@ -683,9 +684,9 @@ elseif(WIN32) if(WITH_PYTHON) set(PYTHON ${LIBDIR}/python) set(PYTHON_VERSION 3.1) - set(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}") + set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}") # set(PYTHON_BINARY python) # not used yet - set(PYTHON_LIB python31mw) + set(PYTHON_LIBRARY python31mw) set(PYTHON_LIBPATH ${PYTHON}/lib) endif() @@ -737,9 +738,9 @@ elseif(APPLE) # we use precompiled libraries for py 3.1 and up by default set(PYTHON ${LIBDIR}/python) - set(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}") + set(PYTHON_INCLUDE_DIRS "${PYTHON}/include/python${PYTHON_VERSION}") # set(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}") # not used yet - set(PYTHON_LIB python${PYTHON_VERSION}) + set(PYTHON_LIBRARY python${PYTHON_VERSION}) set(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}") # set(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled else() @@ -747,9 +748,9 @@ elseif(APPLE) set(PYTHON /System/Library/Frameworks/Python.framework/Versions/) set(PYTHON_VERSION 3.1) - set(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}") + set(PYTHON_INCLUDE_DIRS "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}") # set(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION}) # not used yet - set(PYTHON_LIB "") + set(PYTHON_LIBRARY "") set(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config) set(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python") endif() @@ -769,10 +770,10 @@ elseif(APPLE) endif() set(PNG_LIBRARIES png) - set(JPEG_LIBRARY jpeg) + set(JPEG_LIBRARIES jpeg) set(ZLIB /usr) - set(ZLIB_INC "${ZLIB}/include") + set(ZLIB_INCLUDE_DIRS "${ZLIB}/include") set(ZLIB_LIBRARIES z bz2) set(FREETYPE ${LIBDIR}/freetype) @@ -852,11 +853,11 @@ elseif(APPLE) endif() set(PNG "${LIBDIR}/png") - set(PNG_INC "${PNG}/include") + set(PNG_INCLUDE_DIR "${PNG}/include") set(PNG_LIBPATH ${PNG}/lib) set(JPEG "${LIBDIR}/jpeg") - set(JPEG_INC "${JPEG}/include") + set(JPEG_INCLUDE_DIR "${JPEG}/include") set(JPEG_LIBPATH ${JPEG}/lib) if(WITH_IMAGE_TIFF) diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 2b044e4df1f..70380a7c708 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -128,10 +128,10 @@ macro(setup_liblinks target_link_libraries(${target} ${PYTHON_LINKFLAGS}) if(WIN32 AND NOT UNIX) - target_link_libraries(${target} debug ${PYTHON_LIB}_d) - target_link_libraries(${target} optimized ${PYTHON_LIB}) + target_link_libraries(${target} debug ${PYTHON_LIBRARY}_d) + target_link_libraries(${target} optimized ${PYTHON_LIBRARY}) else() - target_link_libraries(${target} ${PYTHON_LIB}) + target_link_libraries(${target} ${PYTHON_LIBRARY}) endif() endif() diff --git a/doc/build_systems/cmake.txt b/doc/build_systems/cmake.txt index a49ff629b5b..1ff621c6e96 100644 --- a/doc/build_systems/cmake.txt +++ b/doc/build_systems/cmake.txt @@ -132,9 +132,9 @@ $Id$ The commandline can be used to override detected/default settings, e.g: On Unix: - cmake -D PYTHON_LIB=/usr/local/lib/python3.1/config/libpython3.1.so -D PYTHON_INC=/usr/local/include/python3.1 -G "Unix Makefiles" ../blender + cmake -D PYTHON_LIBRARY=/usr/local/lib/python3.1/config/libpython3.1.so -D PYTHON_INCLUDE_DIRS=/usr/local/include/python3.1 -G "Unix Makefiles" ../blender On Macs: - cmake -D PYTHON_INC=/System/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -G Xcode ../blender + cmake -D PYTHON_INCLUDE_DIRS=/System/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1 -G Xcode ../blender Mote that this should only be needed once per build directory generation because it will keep the overrides in CMakeCache.txt for subsequent runs. diff --git a/intern/audaspace/CMakeLists.txt b/intern/audaspace/CMakeLists.txt index 5748b7b03d9..74f483eab05 100644 --- a/intern/audaspace/CMakeLists.txt +++ b/intern/audaspace/CMakeLists.txt @@ -231,7 +231,7 @@ if(WITH_FFTW3 AND FALSE) endif() if(WITH_PYTHON) - list(APPEND INC Python ${PYTHON_INC}) + list(APPEND INC Python ${PYTHON_INCLUDE_DIRS}) set(PYTHONSRC Python/AUD_PyAPI.cpp diff --git a/intern/elbeem/CMakeLists.txt b/intern/elbeem/CMakeLists.txt index 44a4eb1f278..dd23e854a25 100644 --- a/intern/elbeem/CMakeLists.txt +++ b/intern/elbeem/CMakeLists.txt @@ -26,8 +26,8 @@ set(INC extern - ${PNG_INC} - ${ZLIB_INC} + ${PNG_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIRS} ) set(SRC diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt index ec4f0d4ca6d..486ef92f638 100644 --- a/intern/smoke/CMakeLists.txt +++ b/intern/smoke/CMakeLists.txt @@ -28,8 +28,8 @@ set(INC intern ../memutil ../../extern/bullet2/src - ${PNG_INC} - ${ZLIB_INC} + ${PNG_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIRS} ) set(SRC diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt index 5153cc5b68d..77a43e5560e 100644 --- a/source/blender/avi/CMakeLists.txt +++ b/source/blender/avi/CMakeLists.txt @@ -27,7 +27,7 @@ set(INC . ../../../intern/guardedalloc - ${JPEG_INC} + ${JPEG_INCLUDE_DIR} ) set(SRC diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 672ef0b6494..63214f6ee11 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -49,7 +49,7 @@ set(INC ../../../intern/opennl/extern ../../../intern/smoke/extern ../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h - ${ZLIB_INC} + ${ZLIB_INCLUDE_DIRS} ) set(SRC @@ -273,7 +273,7 @@ if(WITH_LCMS) endif() if(WITH_PYTHON) - list(APPEND INC ../python ${PYTHON_INC}) + list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS}) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 35acbe5e831..dc043c3a21e 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -31,7 +31,7 @@ set(INC ../gpu ../../../intern/ghost ../../../intern/guardedalloc - ${ZLIB_INC} + ${ZLIB_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIRS} ) diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index e51fb35a4ac..4d8ac9bc4b6 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -33,7 +33,7 @@ set(INC ../makesrna ../render/extern/include ../../../intern/guardedalloc - ${ZLIB_INC} + ${ZLIB_INCLUDE_DIRS} ) set(SRC diff --git a/source/blender/editors/space_script/CMakeLists.txt b/source/blender/editors/space_script/CMakeLists.txt index ddfd3a69d9e..1427e814b41 100644 --- a/source/blender/editors/space_script/CMakeLists.txt +++ b/source/blender/editors/space_script/CMakeLists.txt @@ -39,7 +39,7 @@ set(SRC ) if(WITH_PYTHON) - list(APPEND INC ${PYTHON_INC} ../../python) + list(APPEND INC ${PYTHON_INCLUDE_DIRS} ../../python) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/editors/space_text/CMakeLists.txt b/source/blender/editors/space_text/CMakeLists.txt index 800a18b95e1..8c18630ab7d 100644 --- a/source/blender/editors/space_text/CMakeLists.txt +++ b/source/blender/editors/space_text/CMakeLists.txt @@ -41,7 +41,7 @@ set(SRC ) if(WITH_PYTHON) - list(APPEND INC ${PYTHON_INC} ../../python) + list(APPEND INC ${PYTHON_INCLUDE_DIRS} ../../python) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index c86e786ba1e..f007305e148 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -32,9 +32,9 @@ set(INC ../makesdna ../../../intern/memutil ../../../intern/guardedalloc - ${JPEG_INC} - ${PNG_INC} - ${ZLIB_INC} + ${JPEG_INCLUDE_DIR} + ${PNG_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIRS} ) set(SRC diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 727d2289354..787c93f5b8a 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -33,7 +33,7 @@ set(INC ../render/extern/include ../../../intern/guardedalloc ../../../intern/elbeem/extern - ${ZLIB_INC} + ${ZLIB_INCLUDE_DIRS} ) set(SRC diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index ad9f9ed426c..09a627b51d4 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -149,7 +149,7 @@ set(SRC ) if(WITH_PYTHON) - set(INC ${INC} ../python ${PYTHON_INC}) + set(INC ${INC} ../python ${PYTHON_INCLUDE_DIRS}) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt index aef2438c961..58d69db4a0e 100644 --- a/source/blender/python/generic/CMakeLists.txt +++ b/source/blender/python/generic/CMakeLists.txt @@ -25,7 +25,7 @@ set(INC ../../blenkernel ../../../../intern/guardedalloc ../../../../extern/glew/include - ${PYTHON_INC} + ${PYTHON_INCLUDE_DIRS} ) set(SRC diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index dc5559a5b38..3c7804ab7e3 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -33,7 +33,7 @@ set(INC ../../editors/include ../../../../intern/guardedalloc ../../../../intern/audaspace/intern - ${PYTHON_INC} + ${PYTHON_INCLUDE_DIRS} ) set(SRC diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index ecd7f3be12c..2be62d5a8b2 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -96,7 +96,7 @@ if(WITH_CODEC_FFMPEG) endif() if(WITH_PYTHON) - list(APPEND INC ../python ${PYTHON_INC}) + list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS}) add_definitions(-DWITH_PYTHON) endif() diff --git a/source/gameengine/CMakeLists.txt b/source/gameengine/CMakeLists.txt index c3c2b95c40e..5dece449120 100644 --- a/source/gameengine/CMakeLists.txt +++ b/source/gameengine/CMakeLists.txt @@ -27,7 +27,7 @@ # there are too many inter-includes so best define here if(WITH_PYTHON) - blender_include_dirs("${PYTHON_INC}") + blender_include_dirs("${PYTHON_INCLUDE_DIRS}") add_definitions(-DWITH_PYTHON) endif() diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt index 9bab870ccd5..0bd8a0dd9a3 100644 --- a/source/gameengine/GamePlayer/common/CMakeLists.txt +++ b/source/gameengine/GamePlayer/common/CMakeLists.txt @@ -52,9 +52,9 @@ set(INC ../../../../source/blender/blenloader ../../../../source/blender/gpu ../../../../extern/glew/include - ${PYTHON_INC} - ${PNG_INC} - ${ZLIB_INC} + ${PYTHON_INCLUDE_DIRS} + ${PNG_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIRS} ) set(SRC diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index e72f2d53f77..dc137861745 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -54,7 +54,7 @@ set(INC ../../../../source/blender/blenloader ../../../../source/blender/gpu ../../../../extern/glew/include - ${PYTHON_INC} + ${PYTHON_INCLUDE_DIRS} ) set(SRC diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt index 8dab5194619..c677685de49 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -44,7 +44,7 @@ set(INC ../../../../source/blender/makesdna ../../../../source/blender/blenlib ../../../../source/blender/blenkernel - ${PYTHON_INC} + ${PYTHON_INCLUDE_DIRS} ) set(SRC diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt index b18020ab17e..d899fc38162 100644 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/CMakeLists.txt @@ -35,7 +35,7 @@ set(INC ../../../extern/glew/include ../../../intern/guardedalloc ../Expressions - ${PYTHON_INC} + ${PYTHON_INCLUDE_DIRS} ) set(SRC -- cgit v1.2.3