Skip to content

Commit

Permalink
Build on linux without vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
frmdstryr committed Dec 14, 2024
1 parent f2166ff commit ef63b6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,26 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT)

file(GLOB source_files "src/*.cpp" "src/*/*.cpp" "src/*/*.hpp" "include/*.h" "include/*/*.h" "include/*/*/*.h" "include/*.hpp" "include/*/*.hpp" "include/*/*/*.hpp")
find_package(httplib CONFIG REQUIRED)

find_package(nlohmann_json CONFIG REQUIRED)
find_package(CURL REQUIRED)

add_executable(${PROJECT_NAME} ${source_files})
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "BeamMP-Launcher")

if (WIN32)
find_package(httplib CONFIG REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE
ZLIB::ZLIB OpenSSL::SSL OpenSSL::Crypto ws2_32 httplib::httplib nlohmann_json::nlohmann_json CURL::libcurl)
elseif (UNIX)
find_package(PkgConfig REQUIRED)
pkg_check_modules(cpp-httplib REQUIRED cpp-httplib)
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE
ZLIB::ZLIB OpenSSL::SSL OpenSSL::Crypto CURL::libcurl)
ZLIB::ZLIB OpenSSL::SSL OpenSSL::Crypto CURL::libcurl cpp-httplib)
else(WIN32) #MINGW
add_definitions("-D_WIN32_WINNT=0x0600")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -s --static")
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@ Remember to change `C:/vcpkg` to wherever you have vcpkg installed.

Make sure you have the necessary development tools installed

- Debian: `sudo apt install build-essential`
- Debian: `sudo apt install build-essential libcpp-httplib-dev nlohmann-json3-dev libcurlpp-dev`
- Fedora: `sudo dnf groupinstall "Development Tools"`
- Arch: `sudo pacman -S base-devel`
- openSUSE: `zypper in -t pattern devel-basis`

### Release

In the root directory of the project,
1. `cmake -DCMAKE_BUILD_TYPE=Release . -B bin -DCMAKE_TOOLCHAIN_FILE=/~/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux`
1. `cmake -DCMAKE_BUILD_TYPE=Release . -B bin -DCMAKE_INSTALL_PREFIX=~/.local`
2. `cmake --build bin --parallel --config Release`

Remember to change `/~/vcpkg` to wherever you have vcpkg installed.

### Debug

Expand Down

0 comments on commit ef63b6f

Please sign in to comment.