diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2020-01-23 07:17:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-23 07:17:36 +0000 |
commit | fecff8ded735d309aba43d30226c0bb51386c905 (patch) | |
tree | 7913ed05278f4922cc9854041ef81c5ddbee6bb8 | |
parent | c2cb31c0432dadf9f0257c6ad4a87a669a6fa6b2 (diff) | |
download | framework-fecff8ded735d309aba43d30226c0bb51386c905.tar.gz framework-fecff8ded735d309aba43d30226c0bb51386c905.tar.bz2 framework-fecff8ded735d309aba43d30226c0bb51386c905.tar.xz framework-fecff8ded735d309aba43d30226c0bb51386c905.zip |
working osx build (#491)
* working osx build
* correct omp lib name
* add cache parameter
closes #470
-rwxr-xr-x | CMakeLists.txt | 2 | ||||
-rw-r--r-- | recipe/build.sh | 19 | ||||
-rw-r--r-- | recipe/meta.yaml | 4 | ||||
-rw-r--r-- | src/Core/CMakeLists.txt | 30 |
4 files changed, 39 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2df50b5..52c15fa 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.4) -project (cil LANGUAGES C CXX) +project (cil LANGUAGES C) set(CIL_VERSION $ENV{CIL_VERSION}) add_subdirectory(src/Core) diff --git a/recipe/build.sh b/recipe/build.sh index 22cfae8..3ac547e 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -14,11 +14,26 @@ mkdir ${SRC_DIR}/build_framework #cp -r "${RECIPE_DIR}/../" ${SRC_DIR}/build_framework cd ${SRC_DIR}/build_framework -cmake ${RECIPE_DIR}/../ -DCONDA_BUILD=ON \ + +if [ `python -c "from __future__ import print_function; import platform; print (platform.system())"` == "Darwin" ] ; +then + echo "Darwin"; + cmake ${RECIPE_DIR}/../ -DCONDA_BUILD=ON \ + -DCMAKE_BUILD_TYPE="Release"\ + -DLIBRARY_LIB=$CONDA_PREFIX/lib \ + -DLIBRARY_INC=$CONDA_PREFIX \ + -DCMAKE_INSTALL_PREFIX=$PREFIX\ + -DOPENMP_INCLUDES=${CONDA_PREFIX}/include \ + -DOPENMP_LIBRARIES=${CONDA_PREFIX}/lib +else + echo "something else"; + + cmake ${RECIPE_DIR}/../ -DCONDA_BUILD=ON \ -DCMAKE_BUILD_TYPE="Release"\ -DLIBRARY_LIB=$CONDA_PREFIX/lib \ -DLIBRARY_INC=$CONDA_PREFIX \ -DCMAKE_INSTALL_PREFIX=$PREFIX -make install +fi +make install VERBOSE=1 # $PYTHON setup.py install diff --git a/recipe/meta.yaml b/recipe/meta.yaml index fee8e87..4fe7150 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -28,6 +28,7 @@ requirements: - python - setuptools - cmake + - openmp # [osx] run: - {{ pin_compatible('numpy', max_pin='x.x') }} @@ -37,7 +38,8 @@ requirements: - matplotlib - h5py - pillow - - libgcc-ng # [not win] + - libgcc-ng # [linux] + - openmp # [osx] about: home: http://www.ccpi.ac.uk diff --git a/src/Core/CMakeLists.txt b/src/Core/CMakeLists.txt index a527289..741b985 100644 --- a/src/Core/CMakeLists.txt +++ b/src/Core/CMakeLists.txt @@ -10,12 +10,18 @@ if(APPLE) message(FATAL_ERROR "Need to set OPENMP_INCLUDES and OPENMP_LIBRARIES on OSX.") endif() if(CMAKE_C_COMPILER_ID MATCHES "Clang") - set(OpenMP_C "${CMAKE_C_COMPILER}") - set(OpenMP_C_FLAGS "-fopenmp=libomp -Wno-unused-command-line-argument") - set(OpenMP_C_LIB_NAMES "libomp" "libgomp" "libiomp5") - set(OpenMP_libomp_LIBRARY ${OpenMP_C_LIB_NAMES}) - set(OpenMP_libgomp_LIBRARY ${OpenMP_C_LIB_NAMES}) - set(OpenMP_libiomp5_LIBRARY ${OpenMP_C_LIB_NAMES}) + #set(OpenMP_C "${CMAKE_C_COMPILER}") + set(OpenMP_C_FLAGS "-Xclang -fopenmp -Wno-unused-command-line-argument -L${OPENMP_LIBRARIES}" CACHE STRING "C FLAGS") + #set(OpenMP_C_LIB_NAMES "omp" "libomp" "libgomp" "libiomp5") + set (OpenMP_C_LIBRARY "omp") + set (OpenMP_C_LIB_NAMES ${OpenMP_C_LIBRARY} CACHE STRING "Name of the omp lib") + set(OpenMP_omp_LIBRARY "omp") + set(OpenMP_libomp_LIBRARY "libomp") + #set(OpenMP_libgomp_LIBRARY "libgomp") + #set(OpenMP_libiomp5_LIBRARY "libiomp5") + set (OpenMP_C_LIBRARY_PATH ${OPENMP_LIBRARIES}) + set (OpenMP_LINKER_FLAGS "-L${OpenMP_C_LIBRARY_PATH}") + endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(OpenMP_CXX "${CMAKE_CXX_COMPILER}") @@ -27,11 +33,11 @@ if(APPLE) endif() endif() - +message ("OpenMP_C_FLAGS ${OpenMP_C_FLAGS}") find_package(OpenMP REQUIRED) - -add_definitions(${OpenMP_CXX_FLAGS}) add_definitions(${OpenMP_C_FLAGS}) +#add_definitions(${OpenMP_CXX_FLAGS}) + if (APPLE) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") @@ -39,8 +45,8 @@ add_definitions(${OpenMP_C_FLAGS}) set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS}") set (CMAKE_STATIC_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_STATIC_LINKER_FLAGS}") - include_directories("${OPENMP_INCLUDES}") - link_directories("${OPENMP_LIBRARIES}") + include_directories(${OPENMP_INCLUDES}) + link_directories(${OPENMP_LIBRARIES}) else() if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.9.0") set (OpenMP_EXE_LINKER_FLAGS OpenMP::OpenMP_CXX) @@ -50,7 +56,7 @@ add_definitions(${OpenMP_C_FLAGS}) # need to explicitly set this. Definitely for gcc, hopefully also for other systems. # See https://gitlab.kitware.com/cmake/cmake/issues/15392 set (OpenMP_EXE_LINKER_FLAGS ${OpenMP_CXX_FLAGS}) - set (OpenMP_EXE_LINKER_FLAGS ${OpenMP_C_FLAGS}) + set (OpenMP_EXE_LINKER_FLAGS ${OpenMP_C_FLAGS} ${OpenMP_LINKER_FLAGS}) endif() endif() |