Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
terasakisatoshi committed May 6, 2024
1 parent d34682f commit 91494f1
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cxxwrap1/build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
# Detect operating system
OS_TYPE=$(uname -s)

# Set shared library extension based on OS
if [[ $OS_TYPE == "Linux" ]]; then
SHARED_LIB_EXT=".so"
elif [[ $OS_TYPE == "Darwin" ]]; then
SHARED_LIB_EXT=".dylib"
else
echo "Unsupported operating system: $OS_TYPE"
exit 1
fi

# Get Julia installation paths
JL=`julia -e 'joinpath(Sys.BINDIR, "..") |> abspath |> print'`
PREFIX=`julia -e 'using CxxWrap; CxxWrap.prefix_path() |> print'`

# Build shared library with appropriate extension
g++ -fPIC -shared -std=c++17 \
-I${PREFIX}/include/ \
-L${PREFIX}/lib/ \
-I${JL}/include/julia \
-L${JL}/lib \
hello.cpp -o libhello.so
-ljulia -lcxxwrap_julia hello.cpp -o libhello${SHARED_LIB_EXT}

0 comments on commit 91494f1

Please sign in to comment.