-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathpremake
More file actions
93 lines (80 loc) · 3.37 KB
/
Copy pathpremake
File metadata and controls
93 lines (80 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/sh
#
# This script allows the sketcher repo to be built using buildinger
# (the Schrodinger internal build system)
#
# Parse command line arguments
BUILD_TYPE="Release"
while [ $# -gt 0 ]; do
case "$1" in
-g) BUILD_TYPE="Debug"; shift ;;
*) echo "Unrecognized option $1"; exit 1 ;;
esac
done
# Source build environment and set error handling
. $SCHRODINGER_SRC/mmshare/build_env
set -euo pipefail
# Define directory paths
SRC_DIR=$SCHRODINGER_SRC/sketcher
BUILD_DIR=$SCHRODINGER/sketcher
PF_DIR=$SCHRODINGER/schrodinger_buildenv_packages/.pixi/envs/schrodinger
ZLIB_DIR=$(ls -d $PF_DIR/zlib-*)
EIGEN_DIR=$(ls -d $PF_DIR/share/eigen3)
COORDGEN_DIR=$(ls -d $PF_DIR/coordgenlibs-*/lib/cmake)
MAEPARSER_DIR=$(ls -d $PF_DIR/maeparser-*/lib/cmake)
SQLITE_DIR=$(ls -d $PF_DIR/sqlite-*)
# Build CMake prefix path
CMAKE_PREFIX_PATH="$PF_DIR;$ZLIB_DIR;$EIGEN_DIR;$COORDGEN_DIR;$MAEPARSER_DIR;$SQLITE_DIR"
# Configure compiler for Windows
CXX_COMPILER=""
if [[ "$OSTYPE" == "msys" ]]; then
CXX_COMPILER=$(cygpath `which cl.exe`)
fi
# Ensure build directory exists
mkdir -p "$BUILD_DIR"
# Update rpaths for shared libraries on MacOS
POST_BUILD_COMMANDS=""
if [[ "$OSTYPE" == darwin* ]]; then
POST_BUILD_COMMANDS="@find $BUILD_DIR \\( -name '*.dylib' -o -type f -perm +111 \\) ! -type l | while read target; do install_name_tool -change /Users/localbuildbot/builds/software/lib/Darwin-x86_64/sqlite-3.42.0/lib/libsqlite3.0.dylib /usr/lib/libsqlite3.0.dylib \"\$\$target\"; install_name_tool -change /software/lib/Darwin-x86_64/zlib-1.2.11/lib/libz.1.dylib /usr/lib/libz.1.dylib \"\$\$target\"; done"
fi
# Start with a fresh CMake cache if the compiler has moved, since CMake
# considers the compiler immutable after the build tree has been configured.
# Without this, incremental Windows builds will fail whenever mmshare's
# dependencies change, as that causes buildinger to create a new buildvenv
# with a slightly different path, meaning that the path to MSVC will change.
ADDITIONAL_CMAKE_CONFIGURE_ARGS=""
if [ -n "$CXX_COMPILER" ]; then
CACHED_CXX_COMPILER=$(sed -n 's/^CMAKE_CXX_COMPILER:[^=]*=//p' \
"$BUILD_DIR/CMakeCache.txt" 2>/dev/null || true)
NORMALIZED_CXX_COMPILER=$(cygpath -m "$CXX_COMPILER")
NORMALIZED_CACHED_CXX_COMPILER=""
if [ -n "$CACHED_CXX_COMPILER" ]; then
NORMALIZED_CACHED_CXX_COMPILER=$(cygpath -m "$CACHED_CXX_COMPILER")
fi
if [ "$NORMALIZED_CACHED_CXX_COMPILER" != "$NORMALIZED_CXX_COMPILER" ]; then
ADDITIONAL_CMAKE_CONFIGURE_ARGS="--fresh"
fi
fi
# Generate Makefile wrapper
cat > "$BUILD_DIR/Makefile" << EOF
.PHONY: all test memtest
all:
cmake -B "$BUILD_DIR" \\
-S "$SRC_DIR" \\
-G Ninja \\
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \\
-DENFORCE_DEPENDENCY_VERSIONS=OFF \\
-DBUILD_SHARED_LIBS=ON \\
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \\
${CXX_COMPILER:+-DCMAKE_CXX_COMPILER="$CXX_COMPILER"} \\
$ADDITIONAL_CMAKE_CONFIGURE_ARGS
cmake --build $BUILD_DIR --config $BUILD_TYPE
cmake --install $BUILD_DIR --config $BUILD_TYPE --prefix $BUILD_DIR
$POST_BUILD_COMMANDS
test:
SKETCHER_SOURCE_DIR=$SRC_DIR $SCHRODINGER/run pytest --rootdir=$BUILD_DIR -n auto \$(TEST_ARGS)
memtest:
$SCHRODINGER/run ctest --build-config $BUILD_TYPE --test-dir $SCHRODINGER/sketcher -L memtest --output-on-failure
EOF
# buildinger expects stdout to define variables
echo "BUILD_DIR: $BUILD_DIR"