This commit is contained in:
Ian Bell
2014-08-06 22:32:47 +02:00
3 changed files with 94 additions and 11 deletions

View File

@@ -505,6 +505,27 @@ if (COOLPROP_PYTHON_PYPI)
)
endif()
if (COOLPROP_JAVASCRIPT_MODULE)
# cmake -DCOOLPROP_JAVASCRIPT_MODULE=ON
# -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Platform/Emscripten.cmake
# ../..
# Toolchain MUST be defined in the call to CMake
add_definitions(-s DISABLE_EXCEPTION_CATCHING=0)
add_definitions(-s ASSERTIONS=1)
add_definitions(-DEXTERNC)
set(CMAKE_EXE_LINKER_FLAGS "-DEXTERNC -s EXPORTED_FUNCTIONS=\"['_main','_F2K','_Props1SI','_PropsSI','_get_global_param_string','_HAProps']\"")
set(CMAKE_BUILD_TYPE Release)
list(APPEND APP_SOURCES "${CMAKE_SOURCE_DIR}/src/CoolPropLib.cpp")
include_directories(${APP_INCLUDE_DIRS})
add_executable(coolprop ${APP_SOURCES})
add_dependencies (coolprop generate_headers)
SET_TARGET_PROPERTIES(coolprop PROPERTIES PREFIX "" SUFFIX .js)
install (TARGETS coolprop DESTINATION ${CMAKE_INSTALL_PREFIX}/Javascript)
endif()
# NOT WORKING!
if (COOLPROP_MATHEMATICA_MODULE)
@@ -524,6 +545,9 @@ if (COOLPROP_MAIN_MODULE)
list(APPEND APP_SOURCES "${CMAKE_SOURCE_DIR}/src/main.cxx")
add_executable (Main ${APP_SOURCES})
add_dependencies (Main generate_headers)
if(UNIX)
target_link_libraries (Main ${CMAKE_DL_LIBS})
endif()
endif()
### COOLPROP TESTING APP ###
@@ -592,6 +616,21 @@ if (COOLPROP_SNIPPETS)
endif()
if()
endif()
if (COOLPROP_COVERAGE)
if(CMAKE_COMPILER_IS_GNUCXX)
# See also http://stackoverflow.com/a/16536401 (detailed guide on using gcov with cmake)
include(CodeCoverage)
SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
setup_target_for_coverage(CoolProp_coverage Main coverage)
endif()
endif()
# TODO: check relevance of http://www.cmake.org/Wiki/BuildingWinDLL

View File

@@ -18,20 +18,35 @@ Precompiled binaries
Developers
==========
On linux, but binaries generated are cross-platform, follow the instructions from `emscripten.org <http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html>`_ - download the portable emscripten SDK `emsdk` for linux.
On linux, but binaries generated are cross-platform. We are following the instructions from `emscripten.org <http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html>`_ - download the portable emscripten SDK `emsdk` for linux.
1. Expand the SDK zip file
2. At the console in the folder that contains the file emsdk run the commands
1. First download node.js, clang++ and llvm using
sudo apt-get install nodejs clang++ llvm
2. Expand the SDK zip file linked above
3. At the console in the folder that contains the file emsdk run the commands
emsdk update # This will fetch the list of things to download
emsdk install latest # This will download and install the full toolchain
3. Go enjoy a nice walk or a cup of coffee - it could be a while
4. Set the environmental variable ``EMSCRIPTEN`` to point to the root of the toolchain. For instance in your /etc/rc.local file you can add the line
export EMSCRIPTEN=/path/to/folder/containing/emsdk
5.
4. Go enjoy a nice walk or a cup of coffee - it will be a while
5. Activate the SDK just compiled
emsdk activate latest # This will make the file ~/.emscripten with the paths to most of the binaries compiled in SDK
6. Modify the file ``~/.emscripten`` to make NODE_JS path equal to `which nodejs`
7. Check out coolprop
git clone https://github.com/CoolProp/CoolProp
8. Folder creating
mkdir -p build/JS && cd build/JS
9. cmake ../..

View File

@@ -60,7 +60,29 @@ def sphinx_slave(git_mode = 'incremental'):
# Upload the generated files
factory.addStep(DirectoryUpload(slavesrc="Web/_build/html",masterdest="public_html/sphinx",url="sphinx",compress="bz2"))
return factory
def javascript_slave(cmake_args = [], cmake_env = {}, build_args = [], git_mode = 'incremental'):
factory = BuildFactory()
working_folder = "build/Javascript"
# Check out sources
factory.addStep(Git(repourl='git://github.com/CoolProp/CoolProp', mode=git_mode, submodules = True, progress=True, haltOnFailure = True))
# Remove the temporary folder for installs
factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = True))
factory.addStep(ShellCommand(command=["cmake",
"..",
"-DCOOLPROP_JAVASCRIPT_MODULE=ON",
"-DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Platform/Emscripten.cmake",
]+cmake_args,
env = {'EMSCRIPTEN','${EMSCRIPTEN}'},
workdir= working_folder,
haltOnFailure = True))
factory.addStep(ShellCommand(command=["cmake", "--build", ".", "--target", "install"]+build_args, workdir = working_folder, haltOnFailure = True))
factory.addStep(DirectoryUpload(slavesrc="install_root", masterdest="public_html/binaries", url="binaries", compress="bz2"))
return factory
def python_slave(key, cmake_args = [], cmake_env = {}, build_args = [], git_mode = 'incremental'):
factory = BuildFactory()
working_folder = "build/Python_" + key
@@ -142,7 +164,14 @@ c['builders'].append(
factory = python_slave("PYPI")
)
)
c['builders'].append(
BuilderConfig(name="Javascript-linux",
slavenames=["linux-slave"],
factory = javascript_slave()
)
)
for platform in ['OSX','windows']:
c['builders'].append(
BuilderConfig(name="Python-binaries-" + platform,