Skip to content

Commit

Permalink
Merge pull request #87 from Esri/#85
Browse files Browse the repository at this point in the history
  • Loading branch information
mistafunk authored Apr 9, 2018
2 parents e864b79 + c323954 commit b57ef30
Show file tree
Hide file tree
Showing 32 changed files with 334 additions and 328 deletions.
24 changes: 17 additions & 7 deletions conan/cesdk/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from conans import ConanFile
from conans import tools

# usage: conan create cesdk/1.9.3786@esri-rd-zurich/stable -s compiler=gcc -s compiler.version=4.8
# usage: conan create -s compiler=gcc -s compiler.version=4.8 . cesdk/1.9.3786@esri-rd-zurich/stable


class CESDKConan(ConanFile):
name = "cesdk"
version = "1.9.3786"
settings = "os", "compiler", "arch"
name = "cesdk"
version = "1.9.3786"
settings = "os", "compiler", "arch"
description = "Develop 3D applications using the procedural geometry engine of Esri CityEngine."
url = "https://github.com/Esri/esri-cityengine-sdk"
license = "CityEngine EULA"
url = "https://github.com/Esri/esri-cityengine-sdk"
license = "CityEngine EULA"

baseURL = "https://github.com/esri/esri-cityengine-sdk/releases/download/{}/esri_ce_sdk-{}-{}-{}-x86_64-rel-opt.zip"
baseURL = "https://github.com/esri/esri-cityengine-sdk/releases/download/{}/esri_ce_sdk-{}-{}-{}-x86_64-rel-opt.zip"

def build(self):
if self.settings.os == "Windows":
Expand All @@ -24,6 +25,15 @@ def build(self):
raise Exception("Binary does not exist for this configuration")
tools.get(url)

# hack: both cesdk and houdini provide libAlembic.so which are not compatible
# the alembic library from houdini is loaded first and this prevents libcom.esri.prt.codecs.so to load
# we are using a using patchelf to rename libAlembic.so of cesdk
# note: this requires patchelf 0.9 or later (https://github.com/NixOS/patchelf)
if self.settings.os == "Linux":
self.run('cd esri_ce_sdk/lib && mv libAlembic.so libAlembicCESDK.so')
self.run('patchelf --replace-needed libAlembic.so libAlembicCESDK.so esri_ce_sdk/lib/libcom.esri.prt.codecs.so')
tools.replace_in_file('esri_ce_sdk/cmake/prtConfig.cmake', 'Alembic', 'AlembicCESDK')

def package(self):
self.copy("*", ".", "esri_ce_sdk")

Expand Down
34 changes: 20 additions & 14 deletions conan/houdini/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
from conans import ConanFile
from conans import tools
import os

# this recipe creates a houdini conan package from a locally installed houdini
# usage: conan create houdini/X.Y.Z@sidefx/stable -s compiler=gcc -s compiler.version=4.8
# usage: conan create -s compiler=gcc -s compiler.version=4.8 . houdini/X.Y.Z@sidefx/stable
# if houdini is not installed at the default location, try -e HOUDINI_INSTALL=<your installation path>


class HoudiniConan(ConanFile):
name = "houdini"
settings = "os", "compiler", "arch"
name = "houdini"
settings = "os", "compiler", "arch"
description = "Houdini is a 3D animation application software developed by Side Effects Software based in Toronto."
url = "https://www.sidefx.com"
license = "SIDE EFFECTS SOFTWARE LICENSE AGREEMENT, https://www.sidefx.com/legal/license-agreement"
url = "https://www.sidefx.com"
license = "SIDE EFFECTS SOFTWARE LICENSE AGREEMENT, https://www.sidefx.com/legal/license-agreement"
short_paths = True

houdiniDefaultInstallationPath = r'C:\Program Files\Side Effects Software\Houdini {}'

def build(self):
pass

def package(self):
if self.settings.os == "Windows":
# TODO
pass
local_install = os.getenv('HOUDINI_INSTALL')\
if 'HOUDINI_INSTALL' in os.environ\
else self.houdiniDefaultInstallationPath.format(self.version)
self.copy("*", ".", local_install)
elif self.settings.os == "Linux":
local_install = os.getenv('HOUDINI_INSTALL') if 'HOUDINI_INSTALL' in os.environ else "/opt/hfs{}".format(self.version)
local_install = os.getenv('HOUDINI_INSTALL')\
if 'HOUDINI_INSTALL' in os.environ\
else "/opt/hfs{}".format(self.version)
# the python exclude is a workaround: houdini installs some
# files in the python subdir as only readable by root
self.copy("*", ".", local_install, symlinks=True, excludes="python/*")
# the python exclude is a hacky workaround: houdini installs some files in the python subdir as only readable by root
elif self.settings.os == "Macos":
# TODO
pass
Expand All @@ -32,7 +40,5 @@ def package(self):

def package_info(self):
self.cpp_info.libdirs = ['dsolib']
self.cpp_info.libs = [ 'HoudiniUI', 'HoudiniOPZ', 'HoudiniOP3', 'HoudiniOP2', 'HoudiniOP1', 'HoudiniGEO', 'HoudiniPRM', 'HoudiniUT']
# TODO: provide cpp flags required by houdini
# TODO: raise conan github issue to get version info by default
self.user_info.version = self.version
self.cpp_info.libs = ['HoudiniUI', 'HoudiniOPZ', 'HoudiniOP3', 'HoudiniOP2',
'HoudiniOP1', 'HoudiniGEO', 'HoudiniPRM', 'HoudiniUT']
66 changes: 56 additions & 10 deletions doc/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,80 @@

## Build Requirements
- RHEL/CentOS 6/7 (or compatible) with GCC 4.8
- Installation of [Houdini 16.0](https://sidefx.com/download)
- or Windows 7/8.1/10 with Visual Studio 2015 (MSVC 14.0)
- Installation of [Houdini 16.5](https://sidefx.com/download)
- [cmake 3.8 or later](https://cmake.org/download)
- [conan 1.0.1 or later](https://www.conan.io/downloads)
- [conan 1.1 or later](https://www.conan.io/downloads)

The bootstrap step below will take care of these additional dependencies:
- SideFX Houdini HDK 16
The bootstrap steps below will take care of these additional dependencies:
- SideFX Houdini HDK 16.5
- [Esri CityEngine SDK 1.9](https://github.com/Esri/esri-cityengine-sdk)
- Boost

## Build Instructions

### Bootstrap

The below steps will populate your local Conan repository with dependencies for the Palladio build system. You only need to work through this section once (or if you want to upgrade one of the dependencies).

#### Linux
1. Checkout Palladio:```git clone git@github.com:esri/palladio.git && cd palladio```
1. Download (from github) and package CityEngine SDK: ```cd conan/cesdk && conan create . cesdk/1.9.3786@esri-rd-zurich/stable -s compiler=gcc -s compiler.version=4.8```
1. Extract and package the HDK from your local Houdini installation (adjust X.Y.Z): ```cd conan/houdini && conan create . houdini/X.Y.Z@sidefx/stable -s compiler=gcc -s compiler.version=4.8``` (Note: use the option ``-e HOUDINI_INSTALL=/path/to/your/hfsX.Y.Z``, if Houdini is not installed at the standard location, e.g. at ``/opt/hfsX.Y.Z`` for Linux).
1. Download CityEngine SDK: ```conan create -s compiler=gcc -s compiler.version=4.8 conan/cesdk cesdk/1.9.3786@esri-rd-zurich/stable ```
1. Extract and package the HDK from your local Houdini installation (adjust Z to your Houdini version): ```conan create -s compiler=gcc -s compiler.version=4.8 conan/houdini houdini/16.5.Z@sidefx/stable``` (Note: use the option ``-e HOUDINI_INSTALL=/path/to/your/hfs16.5.Z``, if Houdini is not installed at the standard location, e.g. at ``/opt/hfs16.5.Z`` for Linux).

#### Windows
1. Checkout Palladio git repository
1. Open a MSVC 14.0 x64 shell (Visual Studio 2015) and `cd` to the Palladio git repository
1. Download CityEngine SDK: ```conan create conan/cesdk cesdk/1.9.3786@esri-rd-zurich/stable ```
1. Extract and package the HDK from your local Houdini installation (adjust Z to your Houdini version): ```conan create conan/houdini houdini/16.5.Z@sidefx/stable``` (Note: use the option ``-e HOUDINI_INSTALL=C:/path/to/your/houdini/installation``, if Houdini is not installed at the standard location for Windows).

### Building Palladio

#### Linux
1. `cd` into your Palladio git repository
1. ```mkdir -p build/release && cd build/release```
1. ```cmake -DCMAKE_BUILD_TYPE=Release ../../src```
1. ```make install``` (the plugin is installed into your ~/houdiniX.Y/dso directory)
1. ```make install``` (the plugin will be installed into your ~/houdini16.5/dso directory)

Note: the `Debug` build type should also work out of the box. If you want to use the `RelWithDebInfo` build type you need to edit your `~/.conan/settings.yml` file and append `RelWithDebInfo` to the `build_type` array at the bottom.

#### Windows
1. Open a MSVC 14.0 x64 shell (Visual Studio 2015) and `cd` to the Palladio git repository
1. ```mkdir build/release```
1. ```cd build/release```
1. ```cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ../../src```
1. ```nmake install``` (the plugin will be installed into your ~/houdini16.5/dso directory)

Note: if you run Visual Studio 2017 you can enable the MSVC 14.0 (VS2015) toolchain as follows:
1. Use the Visual Studio Installer to install `VC++ 2015.3 v140 toolset for Desktop` (see `Individual Components`)
1. Open a cmd shell and run `%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64 8.1 -vcvars_ver=14.0`
1. `cl.exe` should now have version `19.00.xxx`

### Running Palladio
See [Quick Start](usage.md) how to launch Houdini with Palladio.

### Building and Running Unit Tests

#### Linux
1. `cd` into your Palladio git repository
1. ```mkdir -p build/relTest && cd build/relTest```
1. ```cmake -DCMAKE_BUILD_TYPE=Release -DPLD_TEST=1 ../../src```
1. ```make palladio_test```
1. run `bin/palladio_test`

#### Windows
1. Open a MSVC 14.0 x64 shell (Visual Studio 2015) and `cd` to the Palladio git repository
1. ```mkdir build/relTest```
1. ```cd build/relTest```
1. ```cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DPLD_TEST=1 ../../src```
1. ```nmake palladio_test```
1. ensure that the `bin` subdirectory of your Houdini installation is in the `PATH`
1. run `bin\palladio_test`


## Environment Variables

- CITYENGINE_LOG_LEVEL: controls global (minimal) log level for all assign and generate nodes. valid values are "debug", "info", "warning", "error", "fatal"
- CITYENGINE_LICENSE_SERVER: specify how CityEngine license is acquired. an empty string specifies a node-locked license while "<port>@<host>" indicates a network license server, e.g. "27000@my.server.org".
- HOUDINI_DSO_ERROR: useful to debug loading issues, see http://www.sidefx.com/docs/houdini/ref/env
- `CITYENGINE_LOG_LEVEL`: controls global (minimal) log level for all assign and generate nodes. Valid values are "debug", "info", "warning", "error", "fatal"
- `CITYENGINE_LICENSE_SERVER`: specifies how the CityEngine license is acquired. An empty string specifies a node-locked license while `<port>@<host>` indicates a network license server, e.g. `27000@my.server.org`.
- `HOUDINI_DSO_ERROR`: useful to debug loading issues, see http://www.sidefx.com/docs/houdini/ref/env

5 changes: 5 additions & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Palladio ChangeLog

## v1.1 (Apr 7, 2018)
* Added support for Windows (#85).
* Raised minimal Houdini version to 16.5.x (#85).
* Added support to reload RPKs (#58).

## v1.0 (Jan 26, 2018)
* Renamed project to "Palladio" (#68).
* Updated documentation (#38).
Expand Down
12 changes: 8 additions & 4 deletions doc/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

## Prerequisites
* RHEL/CentOS 6/7 (or a compatible distribution)
* Houdini 16.0.x (Apprentice edition is fine)
* or Windows 7/8.1/10
* Houdini 16.5.x (including Apprentice edition)
* CityEngine 2017.x with valid Advanced license (node-locked or network)

## Execute a simple CityEngine Rule

1. Verify that Palladio is installed and all necessary files are present in ``$HOME/houdiniXX/dso``:
1. [Build](build.md) Palladio
1. Verify that Palladio is installed and all necessary files are present in ``<User Home>/houdini16.5/dso``:

![](img/installation01.png)

1. Windows only: ensure that the ``<User Home>/houdini16.5/dso`` and the `bin` subdirectory of your Houdini installation are on the `PATH`
1. In CityEngine, create the following rule file and share it as a rule package (RPK) to disk somewhere:
```
attr height = 1
Expand All @@ -24,9 +28,9 @@
```
1. Start Houdini in a bash console (adapt to your Houdini installation location):
```
LD_LIBRARY_PATH=pt/hfs16.0/dsolib /opt/hfs16.0/bin/houdini
/opt/hfs16.5/bin/houdini
```
(Use ``happrentice`` or ``hindie`` instead of ``houdini``, depending on our license. You might want to create a ``start-houdini`` script or alias with this line.)
(Use ``happrentice`` or ``hindie`` instead of ``houdini``, depending on our license.)
1. In a new scene, add a ``grid`` node.
1. Enter the ``grid`` node and add the two Palladio nodes ``pldAssign`` and ``pldGenerate``. Connect them like this: ![](img/extrude01.png)
1. In the ``pldAssign`` node, set the ``Rule Package`` parameter to the path of the previously exported RPK.
Expand Down
100 changes: 53 additions & 47 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,90 +3,81 @@ cmake_minimum_required(VERSION 3.8)
project(palladio_root CXX)


### versioning

set(PLD_VERSION_MAJOR 1)
set(PLD_VERSION_MINOR 0)
set(PLD_VERSION_PATCH 0)
if(NOT PLD_VERSION_BUILD)
set(PLD_VERSION_BUILD DEV)
endif()

# versioning follows semver.org, Semantic Versioning 2.0.0
# i.e. <major>.<minor>.<patch>+b<buildnr>
# TODO: include houdini/prt version into semver metadata? eg. append ".h16.0.705.ce1.9.1234"
set(PLD_VERSION "${PLD_VERSION_MAJOR}.${PLD_VERSION_MINOR}.${PLD_VERSION_PATCH}+b${PLD_VERSION_BUILD}")


### platform configuration

message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(PLD_WINDOWS 1)
set(PLD_OS "win32")
add_definitions(-DPLD_WINDOWS)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(PLD_LINUX 1)
set(PLD_OS "rhel6")
add_definitions(-DPLD_LINUX)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(PLD_MACOS 1)
set(PLD_OS "macos")
endif()
set(PLD_ARCH "x86_64")


### toolchain configuration

if(PLD_WINDOWS)
set(PLD_TC "vc110")
add_definitions(-DPLD_TC_VC) # TODO
elseif(PLD_LINUX)
set(PLD_TC "gcc48")
add_definitions(-DPLD_TC_GCC) # TODO
elseif(PLD_MACOS)
set(PLD_TC "ac73")
add_definitions(-DPLD_TC_CLANG) # TODO
endif()
function(add_toolchain_definition TGT)
if(PLD_WINDOWS)
target_compile_definitions(${TGT} PRIVATE -DPLD_WINDOWS=1 -DPLD_TC_VC=1)
elseif(PLD_LINUX)
target_compile_definitions(${TGT} PRIVATE -DPLD_LINUX=1 -DPLD_TC_GCC=1)
elseif(PLD_MACOS)
target_compile_definitions(${TGT} PRIVATE -DPLD_MACOS=1 -DPLD_TC_CLANG=1)
endif()
endfunction()


### dependencies

include(${CMAKE_CURRENT_LIST_DIR}/dependencies.cmake)


### versioning

set(PLD_VERSION_MAJOR 1)
set(PLD_VERSION_MINOR 1)
set(PLD_VERSION_PATCH 0)
if(NOT PLD_VERSION_BUILD)
set(PLD_VERSION_BUILD DEV)
endif()

# we use semver.org, Semantic Versioning 2.0.0
# i.e. <major>.<minor>.<patch>+b<buildnr>.hdn<houdini ver>.prt<prt ver>
set(PLD_VERSION "${PLD_VERSION_MAJOR}.${PLD_VERSION_MINOR}.${PLD_VERSION_PATCH}\
+b${PLD_VERSION_BUILD}\
.hdn${Houdini_VERSION_MAJOR}-${Houdini_VERSION_MINOR}-${Houdini_VERSION_PATCH}\
.prt${PRT_VERSION_MAJOR}-${PRT_VERSION_MINOR}-${PRT_VERSION_MICRO}")
message(STATUS "Using PLD_VERSION = ${PLD_VERSION}")


### setup sub-projects

add_subdirectory(codec)
add_subdirectory(palladio)
add_subdirectory(test)

add_dependencies(palladio palladio_codec)

add_subdirectory(test EXCLUDE_FROM_ALL)


### setup installation target

if (NOT HOUDINI_DSO_PATH)
if(PLD_WINDOWS)
set(HOUDINI_DSO_PATH "$ENV{HOMEDRIVE}$ENV{HOMEPATH}/Documents/houdini${HOUDINI_MAJOR_VERSION}.${HOUDINI_MINOR_VERSION}/dso")
set(HOUDINI_DSO_PATH "$ENV{HOMEDRIVE}$ENV{HOMEPATH}/Documents/houdini${Houdini_VERSION_MAJOR}.${Houdini_VERSION_MINOR}/dso")
else()
set(HOUDINI_DSO_PATH "$ENV{HOME}/houdini${HOUDINI_MAJOR_VERSION}.${HOUDINI_MINOR_VERSION}/dso")
set(HOUDINI_DSO_PATH "$ENV{HOME}/houdini${Houdini_VERSION_MAJOR}.${Houdini_VERSION_MINOR}/dso")
endif()
endif()
message(STATUS "HOUDINI_DSO_PATH = ${HOUDINI_DSO_PATH}")

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "${HOUDINI_DSO_PATH}" CACHE PATH "default install path" FORCE )
message(STATUS "set default install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Set default install prefix: ${CMAKE_INSTALL_PREFIX}")
endif()

add_custom_target(install_palladio
make install
DEPENDS palladio
COMMENT "Installing palladio")


### package targets
### setup package target

set(CPACK_PACKAGE_NAME "palladio")
set(CPACK_PACKAGE_VENDOR "Esri R&D Zurich / VRBN")
Expand All @@ -95,7 +86,15 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${PLD_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PLD_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PLD_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "palladio-${PLD_VERSION}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PLD_VERSION}-${PLD_OS}-h${HOUDINI_VERSION}")

if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(PLD_PKG_OS "windows")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(PLD_PKG_OS "linux")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(PLD_PKG_OS "macos")
endif()
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${PLD_VERSION}-${PLD_PKG_OS}")

if(PLD_WINDOWS)
set(CPACK_GENERATOR ZIP)
Expand All @@ -105,7 +104,14 @@ endif()

include(CPack)

add_custom_target(package_palladio
make package
DEPENDS install_palladio
COMMENT "Packaging palladio")
# not strictly necessary, useful for IDEs like CLion without direct support to run "make package"
add_custom_target(palladio_package
${CMAKE_MAKE_PROGRAM} package
DEPENDS palladio
COMMENT "Packaging Palladio")


### setup test target

enable_testing ()
add_test (NAME palladio_test COMMAND palladio_test)
Loading

0 comments on commit b57ef30

Please # to comment.