Skip to content

Commit

Permalink
Merge pull request #13793 from jaimergp/smina
Browse files Browse the repository at this point in the history
add smina
  • Loading branch information
chrisburr authored Jan 30, 2021
2 parents 00a5b7e + a9c9c62 commit 80821c6
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 0 deletions.
31 changes: 31 additions & 0 deletions recipes/smina/build_smina.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@echo on

SETLOCAL EnableDelayedExpansion

rmdir build /S /Q
mkdir build
cd build

:: Patch version.cpp
echo const char* GIT_REV="%GIT_HASH%"; > version.cpp
echo const char* GIT_TAG="%PKG_VERSION%"; >> version.cpp
echo const char* GIT_BRANCH="conda-forge"; >> version.cpp

cmake %SRC_DIR% %CMAKE_ARGS% ^
-GNinja ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
-DOPENBABEL_DIR="%LIBRARY_PREFIX%" ^
-DOPENBABEL3_LIBRARIES="%LIBRARY_PREFIX%/bin/openbabel-3.lib" ^
|| goto :error

cmake --build . || goto :error

copy smina.exe %LIBRARY_PREFIX%\bin || goto :error

goto :EOF

:error
set errorcode=!errorlevel!
echo Failed with error !errorcode!
exit !errorcode!
20 changes: 20 additions & 0 deletions recipes/smina/build_smina.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -euxo pipefail

mkdir build
cd build

# Patch version.cpp
echo "const char* GIT_REV=\"${GIT_HASH}\";" > version.cpp
echo "const char* GIT_TAG=\"${PKG_VERSION}\";" >> version.cpp
echo "const char* GIT_BRANCH=\"conda-forge\";" >> version.cpp

cmake ${SRC_DIR} ${CMAKE_ARGS} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DOPENBABEL_DIR="${PREFIX}"

make -j${CPU_COUNT}

cp smina ${PREFIX}/bin
62 changes: 62 additions & 0 deletions recipes/smina/cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be1354e..b369f94 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 3.5)
project(smina)

+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
@@ -13,26 +17,31 @@ file(GLOB sminasrc
)
list(APPEND sminasrc "${CMAKE_CURRENT_BINARY_DIR}/version.cpp")

-message(${CMAKE_CURRENT_BINARY_DIR})
-# Add a custom command that produces version.cpp, plus
-# a dummy output that's not actually produced, in order
-# to force version.cmake to always be re-run before the build
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_version.cpp
- BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
- COMMAND ${CMAKE_COMMAND} -P
- ${CMAKE_SOURCE_DIR}/CMake/version.cmake)
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_version.cpp)
-set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/_version.cpp PROPERTIES SYMBOLIC TRUE)
+# message(${CMAKE_CURRENT_BINARY_DIR})
+# # Add a custom command that produces version.cpp, plus
+# # a dummy output that's not actually produced, in order
+# # to force version.cmake to always be re-run before the build
+# add_custom_command(
+# OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_version.cpp
+# BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
+# COMMAND ${CMAKE_COMMAND} -P
+# ${CMAKE_SOURCE_DIR}/CMake/version.cmake)
+# add_custom_command(
+# OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
+# DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_version.cpp)
+# set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/_version.cpp PROPERTIES SYMBOLIC TRUE)

add_library(libsmina
${sminasrc}
)
-set_target_properties(libsmina PROPERTIES OUTPUT_NAME "smina")
+
+# from https://sourceforge.net/p/openbabel/mailman/message/29256777/
+if(WIN32)
+ target_compile_definitions(libsmina PUBLIC USING_DYNAMIC_LIBS)
+endif(WIN32)
+
target_include_directories(libsmina PUBLIC src/lib/)
-set(Boost_NO_BOOST_CMAKE ON) #apparently required for newer boosts?
+# set(Boost_NO_BOOST_CMAKE ON) #apparently required for newer boosts?
find_package(Boost REQUIRED COMPONENTS
iostreams
timer
57 changes: 57 additions & 0 deletions recipes/smina/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% set name = "smina" %}
{% set version = "2020.12.10" %}
{% set commit = "b08c07c" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
- url: https://github.com/jaimergp/smina/archive/{{ version }}.tar.gz
sha256: 4b99cdec7972994d7700cfe39a44824f21af5e7c6efc54d2725df785adc9cfbd
patches:
- cmake.patch

build:
number: 0
script:
- env GIT_HASH={{ commit }} bash {{ RECIPE_DIR }}/build_smina.sh # [unix]
- set GIT_HASH={{ commit }} && {{ RECIPE_DIR }}\build_smina.bat # [win]

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- cmake
- make # [unix]
- ninja # [win]
host:
- boost-cpp
- eigen
- openbabel
run:
- boost-cpp
- openbabel

test:
commands:
- smina --help
- smina --version

about:
home: https://sourceforge.net/projects/smina/
license: Apache-2.0
license_family: Apache
license_file: LICENSE.APACHE
summary: 'A fork of AutoDock Vina that is customized to better support scoring function development and high-performance energy minimization'
description: |
A fork of AutoDock Vina that is customized to better support scoring
function development and high-performance energy minimization. smina
is maintained by David Koes at the University of Pittsburgh and
is not directly affiliated with the AutoDock project.
doc_url: https://sourceforge.net/p/smina/discussion/
dev_url: https://sourceforge.net/p/smina/code/ci/master/tree/

extra:
recipe-maintainers:
- jaimergp

0 comments on commit 80821c6

Please sign in to comment.