Skip to content

Commit 571cec5

Browse files
committed
brew install path has changed in newer macos
[skip_build]
1 parent 97afad2 commit 571cec5

File tree

2 files changed

+73
-44
lines changed

2 files changed

+73
-44
lines changed

.github/workflows/ci-macos.yml

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,36 +14,38 @@ concurrency:
1414
jobs:
1515
macos:
1616
runs-on: ${{ matrix.os }}
17-
if: "!contains(github.event.head_commit.message, '[skip_build]')"
17+
if: "!contains(github.event.head_commit.message, '[skip_build_mac]')"
1818
strategy:
1919
matrix:
2020
os: [macOS-latest]
2121
steps:
2222
- uses: actions/checkout@v4
2323
- name: Install dependencies
2424
run: |
25-
#brew unlink bazel
26-
brew install ossp-uuid libmemcached boost jsoncpp apr apr-util httpd ninja
25+
brew install openssl ossp-uuid libmemcached boost jsoncpp apr apr-util httpd ninja unixodbc mongo-c-driver
26+
ls -ltr /usr/local/opt/
27+
ls -ltr /opt/homebrew/include
28+
ls -ltr /opt/homebrew/lib
2729
pushd /tmp
28-
wget -q https://ftp.osuosl.org/pub/blfs/conglomeration/unixODBC/unixODBC-2.3.12.tar.gz
29-
tar zxf unixODBC-2.3.12.tar.gz
30-
cd unixODBC-2.3.12
31-
./configure && make && sudo make install
32-
cd /tmp
33-
rm -rf unixODBC-2.3.12
34-
VERSION=1.26.2
35-
wget "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/$VERSION.tar.gz" --output-document="mongo-c-driver-$VERSION.tar.gz"
36-
tar xf "mongo-c-driver-$VERSION.tar.gz"
37-
rm -f "mongo-c-driver-$VERSION.tar.gz"
38-
cd mongo-c-driver-$VERSION/ && mkdir _build && cmake -S . -B _build \
39-
-D ENABLE_EXTRA_ALIGNMENT=OFF \
40-
-D ENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -D ENABLE_TESTS=OFF -D ENABLE_EXAMPLES=OFF \
41-
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
42-
-D BUILD_VERSION="$VERSION" \
43-
-D ENABLE_SSL=OFF \
44-
-D ENABLE_SASL=OFF \
45-
-D ENABLE_MONGOC=ON && cmake --build _build --config RelWithDebInfo --parallel && sudo cmake --install _build
46-
rm -rf "mongo-c-driver-$VERSION"
30+
#wget -q https://ftp.osuosl.org/pub/blfs/conglomeration/unixODBC/unixODBC-2.3.12.tar.gz
31+
#tar zxf unixODBC-2.3.12.tar.gz
32+
#cd unixODBC-2.3.12
33+
#./configure && make && sudo make install
34+
#cd /tmp
35+
#rm -rf unixODBC-2.3.12
36+
#VERSION=1.26.2
37+
#wget "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/$VERSION.tar.gz" --output-document="mongo-c-driver-$VERSION.tar.gz"
38+
#tar xf "mongo-c-driver-$VERSION.tar.gz"
39+
#rm -f "mongo-c-driver-$VERSION.tar.gz"
40+
#cd mongo-c-driver-$VERSION/ && mkdir _build && cmake -S . -B _build \
41+
#-D ENABLE_EXTRA_ALIGNMENT=OFF \
42+
#-D ENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -D ENABLE_TESTS=OFF -D ENABLE_EXAMPLES=OFF \
43+
#-D CMAKE_BUILD_TYPE=RelWithDebInfo \
44+
#-D BUILD_VERSION="$VERSION" \
45+
#-D ENABLE_SSL=OFF \
46+
#-D ENABLE_SASL=OFF \
47+
#-D ENABLE_MONGOC=ON && cmake --build _build --config RelWithDebInfo --parallel && sudo cmake --install _build
48+
#rm -rf "mongo-c-driver-$VERSION"
4749
#if [ -f /usr/local/lib/libssl.dylib ]; then
4850
# sudo mv /usr/local/lib/libssl.dylib /usr/local/lib/libssl_bak.dylib
4951
#fi

CMakeLists.txt

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,31 @@ endif()
5858
if(NOT CINATRA_INCLUDES)
5959
set(CINATRA_INCLUDES "/cinatra/include")
6060
endif()
61-
if(NOT SSL_INC_DIR)
62-
set(SSL_INC_DIR "/usr/local/opt/openssl/include")
63-
endif()
64-
if(NOT SSL_LIB)
65-
set(SSL_LIB "/usr/local/opt/openssl/lib/libssl.dylib")
66-
endif()
67-
if(NOT CRYPTO_LIB)
68-
set(CRYPTO_LIB "/usr/local/opt/openssl/lib/libcrypto.dylib")
69-
endif()
61+
#if(NOT SSL_INC_DIR)
62+
# set(SSL_INC_DIR "/usr/local/opt/openssl/include")
63+
#endif()
64+
#if(NOT SSL_LIB)
65+
# set(SSL_LIB "/usr/local/opt/openssl/lib/libssl.dylib")
66+
#endif()
67+
#if(NOT CRYPTO_LIB)
68+
# set(CRYPTO_LIB "/usr/local/opt/openssl/lib/libcrypto.dylib")
69+
#endif()
7070

7171
set(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)
7272
set(CMAKE_VERBOSE_MAKEFILE off)
7373
set(CMAKE_CXX_STANDARD 17)
7474
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7575
set(CMAKE_CXX_EXTENSIONS OFF)
7676
if(CMAKE_INC_PATH)
77+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_INC_PATH}/include")
7778
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CMAKE_INC_PATH}/include")
7879
else()
80+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/local/include")
7981
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/local/include")
82+
if(APPLE)
83+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/opt/homebrew/include")
84+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/opt/homebrew/include")
85+
endif()
8086
endif()
8187
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
8288

@@ -158,9 +164,9 @@ set(HAVE_WINREGEX "")
158164

159165
if(APPLE)
160166
set(OS_DARWIN 1)
161-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${SSL_INC_DIR}")
162-
set(CMAKE_REQUIRED_INCLUDES "${SSL_INC_DIR}" "/usr/local/include")
163-
include_directories("${SSL_INC_DIR}" "/usr/local/include")
167+
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${SSL_INC_DIR}")
168+
set(CMAKE_REQUIRED_INCLUDES "/usr/local/include" "/opt/homebrew/include")
169+
include_directories("/usr/local/include" "/opt/homebrew/include")
164170
elseif(MINGW)
165171
set(OS_MINGW 1)
166172
set(USE_WIN_IOCP 1)
@@ -222,7 +228,11 @@ endif()
222228
if(CMAKE_INC_PATH)
223229
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_INC_PATH}/lib")
224230
else()
225-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
231+
if(APPLE)
232+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib -L/opt/homebrew/lib")
233+
else()
234+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
235+
endif()
226236
endif()
227237

228238
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
@@ -344,10 +354,10 @@ endif()
344354
#if(NOT HAVE_SSLINC)
345355
# message(FATAL_ERROR "openssl includes not found")
346356
#endif()
347-
if (APPLE)
348-
set(HAVE_SSLLIB ${SSL_LIB})
349-
set(HAVE_CRYPTOLIB ${CRYPTO_LIB})
350-
else()
357+
#if (APPLE)
358+
# set(HAVE_SSLLIB ${SSL_LIB})
359+
# set(HAVE_CRYPTOLIB ${CRYPTO_LIB})
360+
#else()
351361
if(NOT BUILD_SHARED_LIBS)
352362
FIND_LIBRARY(HAVE_SSLLIB NAMES libssl.a ssl)
353363
else()
@@ -372,7 +382,7 @@ else()
372382
# if(NOT HAVE_CRYPTOLIB)
373383
# message(FATAL_ERROR "crypto library not found")
374384
# endif()
375-
endif()
385+
#endif()
376386

377387
#FIND_LIBRARY(HAVE_TBBLIB tbb)
378388
#if(NOT HAVE_TBBLIB)
@@ -532,6 +542,11 @@ if(MOD_SDORM_SQL)
532542
if(MINGW)
533543
set(CMAKE_REQUIRED_INCLUDES "/usr/include/unixodbc")
534544
include_directories("/usr/include/unixodbc")
545+
elseif(APPLE)
546+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/opt/homebrew/include/postgresql -I/opt/homebrew/include/pgsql")
547+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/opt/homebrew/include/postgresql -I/opt/homebrew/include/pgsql")
548+
set(CMAKE_REQUIRED_INCLUDES "/opt/homebrew/include/postgresql" "/opt/homebrew/include/pgsql")
549+
include_directories("/opt/homebrew/include/postgresql" "/opt/homebrew/include/pgsql")
535550
endif()
536551
endif()
537552
CHECK_INCLUDE_FILE("sql.h" HAVE_SQLINC)
@@ -591,6 +606,12 @@ if(MOD_SDORM_MONGO)
591606
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0")
592607
set(CMAKE_REQUIRED_INCLUDES "/usr/include/libmongoc-1.0" "/usr/include/libbson-1.0" "/usr/local/include/libmongoc-1.0" "/usr/local/include/libbson-1.0")
593608
include_directories("/usr/include/libmongoc-1.0" "/usr/include/libbson-1.0" "/usr/local/include/libmongoc-1.0" "/usr/local/include/libbson-1.0")
609+
if(APPLE)
610+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/opt/homebrew/include/libmongoc-1.0 -I/opt/homebrew/include/libbson-1.0 ")
611+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I/opt/homebrew/include/libmongoc-1.0 -I/opt/homebrew/include/libbson-1.0")
612+
set(CMAKE_REQUIRED_INCLUDES "/opt/homebrew/include/libmongoc-1.0" "/opt/homebrew/include/libbson-1.0")
613+
include_directories("/opt/homebrew/include/libmongoc-1.0" "/opt/homebrew/include/libbson-1.0")
614+
endif()
594615
endif()
595616
CHECK_INCLUDE_FILE("mongoc.h" HAVE_MONGOINC)
596617
if(NOT HAVE_MONGOINC)
@@ -664,6 +685,9 @@ if(SRV_ALL)
664685
set(CMAKE_JSONCPP_INC "${CMAKE_INC_PATH}/include/jsoncpp")
665686
else()
666687
set(CMAKE_JSONCPP_INC "/usr/local/include/jsoncpp" "/usr/include/jsoncpp")
688+
if(APPLE)
689+
set(CMAKE_JSONCPP_INC "/opt/homebrew/include/jsoncpp")
690+
endif()
667691
endif()
668692
FIND_LIBRARY(HAVE_JSONCPP jsoncpp)
669693
if(NOT HAVE_JSONCPP)
@@ -736,6 +760,9 @@ elseif(SRV_DROGON)
736760
set(CMAKE_JSONCPP_INC "${CMAKE_INC_PATH}/include/jsoncpp")
737761
else()
738762
set(CMAKE_JSONCPP_INC "/usr/local/include/jsoncpp" "/usr/include/jsoncpp")
763+
if(APPLE)
764+
set(CMAKE_JSONCPP_INC "/opt/homebrew/include/jsoncpp")
765+
endif()
739766
endif()
740767
FIND_LIBRARY(HAVE_JSONCPP jsoncpp)
741768
if(NOT HAVE_JSONCPP)
@@ -927,10 +954,10 @@ if(SRV_CINATRA)
927954
elseif (SRV_ALL)
928955
MESSAGE( STATUS "CINATRA_INCLUDES: " ${CINATRA_INCLUDES} )
929956
endif()
930-
if (APPLE)
931-
MESSAGE( STATUS "SSL_LIB: " ${SSL_LIB} )
932-
MESSAGE( STATUS "CRYPTO_LIB: " ${CRYPTO_LIB} )
933-
endif()
957+
#if (APPLE)
958+
# MESSAGE( STATUS "SSL_LIB: " ${SSL_LIB} )
959+
# MESSAGE( STATUS "CRYPTO_LIB: " ${CRYPTO_LIB} )
960+
#endif()
934961

935962
file(REMOVE_RECURSE ${PROJECT_NAME}-bin)
936963
install(DIRECTORY DESTINATION "${PROJECT_NAME}-bin")

0 commit comments

Comments
 (0)