Skip to content

Commit b580c96

Browse files
committed
Add build for MacOS X
1 parent 29d12ec commit b580c96

File tree

3 files changed

+48
-5
lines changed

3 files changed

+48
-5
lines changed

.github/workflows/debug.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,23 @@ jobs:
2828
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Werror" ..
2929
make
3030
/home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test
31+
32+
build-macos:
33+
runs-on: macos-latest
34+
steps:
35+
- name: Download, configure and install gtest
36+
run: |
37+
wget https://github.com/google/googletest/archive/release-1.10.0.tar.gz
38+
tar xf release-1.10.0.tar.gz
39+
cd googletest-release-1.10.0
40+
cmake -DBUILD_SHARED_LIBS=OFF .
41+
sudo make install
42+
- name: Checkout the project
43+
uses: actions/checkout@v1
44+
- name: Do some tests
45+
run: |
46+
mkdir build
47+
cd build
48+
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Werror" ..
49+
VERBOSE=1 make
50+
/home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test

.github/workflows/release.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
steps:
1515
- name: Download, configure and install gtest
1616
run: |
17-
wget https://github.com/google/googletest/archive/release-1.10.0.tar.gz
18-
tar xf release-1.10.0.tar.gz
19-
cd googletest-release-1.10.0
17+
wget https://github.com/google/googletest/archive/release-1.11.0.tar.gz
18+
tar xf release-1.11.0.tar.gz
19+
cd googletest-release-1.11.0
2020
cmake -DBUILD_SHARED_LIBS=OFF .
2121
sudo make install
2222
- name: Checkout the project
@@ -28,3 +28,23 @@ jobs:
2828
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" ..
2929
make
3030
/home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test
31+
32+
build-macos:
33+
runs-on: macos-latest
34+
steps:
35+
- name: Download, configure and install gtest
36+
run: |
37+
wget https://github.com/google/googletest/archive/release-1.11.0.tar.gz
38+
tar xf release-1.11.0.tar.gz
39+
cd googletest-release-1.11.0
40+
cmake -DBUILD_SHARED_LIBS=OFF .
41+
sudo make install
42+
- name: Checkout the project
43+
uses: actions/checkout@v1
44+
- name: Do some tests
45+
run: |
46+
mkdir build
47+
cd build
48+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Werror" ..
49+
VERBOSE=1 make
50+
/home/runner/work/github_actions_gtest_example/github_actions_gtest_example/build/test/github_actions_gtest_example.test

test/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ add_executable(${PROJECT_NAME}.test
22
AllTests.cpp
33
${PROJECT_NAME}Test.cpp)
44
target_link_libraries(${PROJECT_NAME}.test
5-
${PROJECT_NAME} gtest pthread)
5+
${PROJECT_NAME} gtest gmock pthread)
66
target_compile_definitions(${PROJECT_NAME}.test
77
PRIVATE TEST_DIR="${CMAKE_CURRENT_LIST_DIR}/test")
8-
98
install(TARGETS ${PROJECT_NAME}.test
109
DESTINATION "${tool_dest}")
10+
11+
# Mac OS X does not look at these paths
12+
target_include_directories(${PROJECT_NAME}.test PRIVATE "/usr/local/include/")
13+
set(CMAKE_LIBRARY_PATH "/usr/local/lib/")

0 commit comments

Comments
 (0)