<p>While I too find myself sometimes wanting convenience scripts - some people find the use of '-DENABLE_<whatever>=ON' instead of --enable-<whatever>' foreign, for example - the problem with them, IMO, is that they're impossible to make crossplatform without requiring the presence of some tool - perl, python, bash, whatever - on each system in a location that can be located pre-configure, which is exactly what using cmake gets you out of.</p>
<p>Mm</p>
<div class="gmail_quote">On Feb 8, 2011 2:53 AM, "Michael Wild" <<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>> wrote:<br type="attribution">> That's not how CMake works. With CMake developers usually have many<br>
> binary trees referring to one single source tree (optimized/debug, 32/64<br>> bit, with/without some optional dependencies, etc.). There is no good<br>> way that CMake could automate the choice of suitable name of the binary<br>
> tree (and scons fails there too, IMHO). So, AFAIK, the design choice was<br>> to leave it up to the user.<br>> <br>> Some projects provide simple shell scripts or Makefiles to automate this<br>> for a few simple cases (much the way you do), but IMHO it's not worth<br>
> the hassle... If somebody is tech-savvy enough to build from source, you<br>> can assume (s)he knows how to create a directory and what the CWD is.<br>> <br>> My 2c<br>> <br>> Michael<br>> <br>> On 02/08/2011 05:50 AM, Campbell Barton wrote:<br>
>> For blender we currently support 2 build systems - SCons and CMake,<br>>> Quite a few technical users build from source on *nix just to get the<br>>> latest version and use scons, I suspect this is because scons<br>
>> configures every time and its simple just to type "scons" in the<br>>> source dir and end up with a build.<br>>> We have SCons configured to do an out-of-source build by default with<br>>> a predefined directory.<br>
>> <br>>> I wasn't aware of anything similar for CMake so I write a GNUmakefile<br>>> (included below) in the root source dir to do something similar for<br>>> CMake.<br>>> (note, we don't allow in-source builds at the moment so there is no<br>
>> conflict with possible in-source makefiles).<br>>> <br>>> This makefile creates a per-defined out-of-source build dir if<br>>> necessary and runs make, since we explicitly list source files and<br>
>> headers in the CMakeLists.txt cmake will re-configure if needed.<br>>> <br>>> So my questions are...<br>>> - Do other projects do this? is there some preferred way to do this?<br>>> - Is it possible to setup the CMakeLists.txt so the generated<br>
>> makefiles are written to a directory other then the CWD?<br>>> - Is there any way to default to our-of-source build when running<br>>> "cmake ." in the source dir? (rather then aborting which is what we do<br>
>> now).<br>>> <br>>> Probably our users should just get the hang on setting up out of<br>>> source builds but I think they like the convenience.<br>>> <br>>> # ------------<br>>> # This Makefile does an out-of-source CMake build in ../build/`OS`_`CPU`<br>
>> # eg:<br>>> # ../build/Linux_i386<br>>> # This is for users who like to configure & build blender with a single command.<br>>> <br>>> # System Vars<br>>> OS:=$(shell uname -s)<br>
>> OS_NCASE:=$(shell uname -s | tr '[A-Z]' '[a-z]')<br>>> <br>>> # Source and Build DIR's<br>>> BLENDER_DIR:=$(shell pwd -P)<br>>> BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)<br>
>> <br>>> # Get the number of cores for threaded build<br>>> NPROCS:=1<br>>> ifeq ($(OS), Linux)<br>>> NPROCS:=$(shell grep -c ^processor /proc/cpuinfo)<br>>> endif<br>>> ifeq ($(OS), Darwin)<br>
>> NPROCS:=$(shell system_profiler | awk '/Number Of CPUs/{print $4}{next;}')<br>>> endif<br>>> ifeq ($(OS), FreeBSD)<br>>> NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )<br>
>> endif<br>>> ifeq ($(OS), NetBSD)<br>>> NPROCS:=$(shell sysctl -a | grep "hw.ncpu " | cut -d" " -f3 )<br>>> endif<br>>> <br>>> <br>>> # Build Blender<br>
>> all:<br>>> @echo<br>>> @echo Configuring Blender ...<br>>> <br>>> if test ! -f $(BUILD_DIR)/CMakeCache.txt ; then \<br>>> mkdir -p $(BUILD_DIR) ; \<br>>> cd $(BUILD_DIR) ; \<br>
>> cmake $(BLENDER_DIR) -DCMAKE_BUILD_TYPE:STRING=Release ; \<br>>> fi<br>>> <br>>> @echo<br>>> @echo Building Blender ...<br>>> cd $(BUILD_DIR) ; make -s -j $(NPROCS)<br>
>> @echo<br>>> @echo run blender from "$(BUILD_DIR)/bin/blender"<br>>> @echo<br>>> <br>>> .PHONY: all<br>>> <br>>> # ------------<br>>> <br>>> - Campbell<br>
> <br>> _______________________________________________<br>> Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>> <br>> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
> <br>> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br>> <br>> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.cmake.org/mailman/listinfo/cmake">http://www.cmake.org/mailman/listinfo/cmake</a><br></div>