Commit e00d8a09 authored by LAMBERT Jean-charles's avatar LAMBERT Jean-charles

add working RPATH to macosx

parent 7ab559a5
......@@ -12,7 +12,7 @@
# CMakeListst.txt file to compile UNSIO library
# ============================================================================
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
# project name
project (UNSIO2)
......@@ -54,13 +54,17 @@ MESSAGE( STATUS "OSX detected =" ${OSX} )
MESSAGE( STATUS "BUILD_TYPE =" ${RELEASE} )
FIND_PACKAGE(SQLITE3)
#set (HDF5_USE_STATIC_LIBRARIES TRUE)
if (APPLE)
set (HDF5_USE_STATIC_LIBRARIES TRUE)
endif(APPLE)
FIND_PACKAGE(HDF5 COMPONENTS CXX REQUIRED)
MESSAGE( STATUS "1) HDF5_CXX_LIBRARIES=" ${HDF5_CXX_LIBRARIES})
if(LINUX_ISSUE MATCHES "Mageia")
SET(HDF5_CXX_LIBRARIES hdf5_hl_cpp.a hdf5_cpp.a hdf5.a) # use this trick to compile against hdf5 static libs, to keep compatibility between hdf5 libs, works only on mageia...
endif()
MESSAGE( STATUS "2) HDF5_CXX_LIBRARIES=" ${HDF5_CXX_LIBRARIES})
MESSAGE(STATUS "NEMO LIGHT will be build")
......@@ -92,6 +96,10 @@ STRING(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}
# create library "uns"
add_library (unsio ${LIBTYPE} ${LIBSOURCES})
if (APPLE)
SET_TARGET_PROPERTIES(unsio PROPERTIES MACOSX_RPATH TRUE)
endif (APPLE)
# special flags for MacOSX
if (OSX)
set(CMAKE_MACOSX_RPATH ON)
......@@ -173,7 +181,14 @@ FOREACH(exe_cpp ${execpp_sources})
get_filename_component(exe ${exe_cpp} NAME_WE)
MESSAGE( STATUS "New executable ==> " ${exe})
add_executable (${exe} ${exe_cpp})
if (APPLE)
SET_TARGET_PROPERTIES(${exe} PROPERTIES MACOSX_RPATH TRUE)
#SET_TARGET_PROPERTIES(${exe} PROPERTIES CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#SET_TARGET_PROPERTIES(${exe} PROPERTIES CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
SET_TARGET_PROPERTIES(${exe} PROPERTIES CMAKE_INSTALL_NAME_DIR "@rpath")
#SET_TARGET_PROPERTIES(${exe} PROPERTIES CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib)
#message ( status "MACOSX rpath handling...." ${CMAKE_INSTALL_PREFIX}/lib)
endif(APPLE)
# Link the executable to the Hello library.
target_link_libraries (${exe} unsio ) # ${FC_GFORT_LIB} ${FC_G77_LIB} stdc++)
IF (${exe} STREQUAL "uns_info")
......@@ -317,7 +332,9 @@ set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_RPM_PACKAGE_DESCRIPTION})
set(CPACK_DEBIAN_PACKAGE_PROVIDES "unsio, libunsio")
if (APPLE)
set(CMAKE_INSTALL_PREFIX "/Applications")
#set(CMAKE_INSTALL_PREFIX "/Applications")
#set(CMAKE_INSTALL_PREFIX "/")
#set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON)
set(CPACK_GENERATOR "DragNDrop")
set(CPACK_DMG_FORMAT "UDBZ")
set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}")
......
......@@ -29,6 +29,10 @@ set(SPECIFIC_SYSTEM_PREFERED_CPACK_GENERATOR "")
set(LINUX_NAME "")
set(MY_OS "")
if (OSX)
set(LIB_SUFFIX "lib")
endif (OSX)
if(UNIX)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(SPECIFIC_SYSTEM_VERSION_NAME "${CMAKE_SYSTEM_NAME}")
......
......@@ -8,6 +8,15 @@ python3 setup.py bdist_rpm --release 1mga6
To build deb package
python3 setup.py --command-packages=stdeb.command bdist_deb sdist_dsc --with-python2=True --with-python3=True --dist-dir=my_deb --debian-version 0ubuntu16.04
To build MacOSX
1) use clang compiler
export CXX=/usr/bin/c++
2) build
python setup.py build_ext -L ${HOME}/local/unsio/lib -R ${HOME}/local/unsio/lib
3) install locally
python setup.py install --user
"""
#from distutils.core import setup, Extension
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment