diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c8bcd627..832d9f1d 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -69,7 +69,7 @@ jobs: platform: x64 - name: Configure CMake - run: cmake -B ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} -G"Ninja" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DNUI_BUILD_EXAMPLES=off -DCMAKE_CXX_EXTENSIONS=on -DCMAKE_CXX_COMPILER=c++ -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_STANDARD=20 + run: cmake -B ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} -G"Ninja" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_EXTENSIONS=on -DCMAKE_CXX_COMPILER=c++ -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_STANDARD=20 env: BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} @@ -94,7 +94,7 @@ jobs: run: echo "WSPACE=$(cygpath '${{github.workspace}}')" >> $GITHUB_ENV - name: Configure CMake - run: cmake -B ${{env.WSPACE}}/build/clang_${{env.BUILD_TYPE}} -G"Ninja" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DNUI_BUILD_EXAMPLES=off -DCMAKE_CXX_EXTENSIONS=on -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER=lld -DCMAKE_CXX_STANDARD=20 + run: cmake -B ${{env.WSPACE}}/build/clang_${{env.BUILD_TYPE}} -G"Ninja" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_EXTENSIONS=on -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER=lld -DCMAKE_CXX_STANDARD=20 - name: Build run: cmake --build ${{env.WSPACE}}/build/clang_${{env.BUILD_TYPE}} --config ${{env.BUILD_TYPE}} @@ -103,15 +103,32 @@ jobs: runs-on: macos-13 steps: + - uses: actions/checkout@v3 + - run: brew install ninja boost cryptopp curl llvm@16 + - name: Get Brew Prefix + run: | + echo "BREW_PREFIX=$(brew --prefix)" >> $GITHUB_ENV + - name: Set Env Vars run: | - echo "export LDFLAGS=-L/opt/homebrew/lib" >> $GITHUB_ENV - echo "export CPPFLAGS=-I/opt/homebrew/include" >> $GITHUB_ENV + echo "export LDFLAGS=-L$BREW_PREFIX/lib" >> $GITHUB_ENV + echo "export CPPFLAGS=-I$BREW_PREFIX/include" >> $GITHUB_ENV - name: Configure CMake - run: cmake -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm@16/bin/clang -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm@16/bin/clang++ -DCMAKE_LINKER=/opt/homebrew/opt/llvm@16/bin/lld -B ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} -G"Ninja" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DNUI_BUILD_EXAMPLES=off -DCMAKE_CXX_EXTENSIONS=on -DCMAKE_CXX_STANDARD=20 + run: > + cmake + -DCMAKE_C_COMPILER=$BREW_PREFIX/opt/llvm@16/bin/clang + -DCMAKE_CXX_COMPILER=$BREW_PREFIX/opt/llvm@16/bin/clang++ + -DCMAKE_LINKER=$BREW_PREFIX/opt/llvm@16/bin/lld + -S ${{github.workspace}} + -B ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} + -G"Ninja" + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + -DBREW_PREFIX="$BREW_PREFIX" + -DCMAKE_CXX_EXTENSIONS=on + -DCMAKE_CXX_STANDARD=20 - name: Build run: cmake --build ${{github.workspace}}/build/clang_${{env.BUILD_TYPE}} --config ${{env.BUILD_TYPE}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 08184763..10ffc3f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ endif() include(./cmake/warnings.cmake) include(./cmake/example_target.cmake) include(./cmake/options.cmake) +include(./cmake/brew.cmake) # Deps include(./cmake/dependencies/boost.cmake) diff --git a/README.md b/README.md index 03afb640..77a8f9fa 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,15 @@ This is a network library that has: - cryptopp - libcurl +### MacOS + +Dependencies are expected to be installed via brew. +If this does not work for you, please open an issue. + +brew install ninja boost cryptopp curl llvm@16 + +### Windows + Use vcpkg on windows for these dependencies when building with Visual Studio & cmake. https://vcpkg.io/en/getting-started.html diff --git a/cmake/brew.cmake b/cmake/brew.cmake new file mode 100644 index 00000000..43ff32a7 --- /dev/null +++ b/cmake/brew.cmake @@ -0,0 +1 @@ +set(BREW_PREFIX "/opt/homebrew" CACHE STRING "Homebrew install prefix") \ No newline at end of file diff --git a/cmake/dependencies/cryptopp.cmake b/cmake/dependencies/cryptopp.cmake index dbc4ac64..dcc84fcc 100644 --- a/cmake/dependencies/cryptopp.cmake +++ b/cmake/dependencies/cryptopp.cmake @@ -12,8 +12,8 @@ if (WIN32) target_link_libraries(roar-cryptopp INTERFACE cryptopp-static) endif() elseif(APPLE) - find_library(CRYPTOPP_LIB libcryptopp.a HINTS /opt/homebrew/lib) - target_include_directories(roar-cryptopp INTERFACE /opt/homebrew/include) + find_library(CRYPTOPP_LIB libcryptopp.a HINTS ${BREW_PREFIX}/lib) + target_include_directories(roar-cryptopp INTERFACE ${BREW_PREFIX}/include) target_link_libraries(roar-cryptopp INTERFACE ${CRYPTOPP_LIB}) elseif(UNIX) pkg_check_modules(cryptopp IMPORTED_TARGET libcrypto++)