Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
build: update build system
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenMian committed Jul 7, 2023
1 parent d57129f commit 1c94cd7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ jobs:
with:
submodules: recursive

- name: Setup enviroment (Windows)
if: matrix.os == 'windows-latest'
run: |
pip install conan
conan profile detect
- name: Setup enviroment (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
pip install conan
conan profile detect
sudo apt update
sudo apt install libudev-dev libx11-dev libxrandr-dev libgl1-mesa-dev libalut-dev libvorbis-dev libsndfile1-dev libsfml-dev
Expand Down
11 changes: 4 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ project(gomoku CXX)

set(BUILD_SHARED_LIBS FALSE)

include(FetchContent)
FetchContent_Declare(SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 2.5.1)
FetchContent_MakeAvailable(SFML)

add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE src/main.cpp src/gomoku.hpp src/board.hpp)
target_link_libraries(${PROJECT_NAME} PRIVATE sfml-graphics sfml-network)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)

find_package(SFML CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE sfml-graphics sfml-network)
target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_STATIC)

if (WIN32 AND BUILD_SHARED_LIBS)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${PROJECT_NAME}> $<TARGET_FILE_DIR:${PROJECT_NAME}> COMMAND_EXPAND_LISTS)
Expand Down
6 changes: 6 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[requires]
sfml/2.5.1

[generators]
CMakeDeps
CMakeToolchain

0 comments on commit 1c94cd7

Please sign in to comment.