Skip to content

Commit 03d4b59

Browse files
Merge pull request #154 from Longwater1234/dev
CMAKE enhancements
2 parents ee85bce + 9d5bd68 commit 03d4b59

File tree

8 files changed

+40
-10
lines changed

8 files changed

+40
-10
lines changed

CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,22 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
77

88
set(CMAKE_CXX_STANDARD 17)
99
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
10+
set(CMAKE_CXX_EXTENSIONS OFF)
11+
1012
if (NOT APPLE)
1113
set(SFML_STATIC_LIBRARIES TRUE)
1214
endif()
1315

16+
# write app version ONCE into Header
17+
configure_file(
18+
${CMAKE_CURRENT_SOURCE_DIR}/src/proto_schema/AppVersion.hpp.in
19+
${CMAKE_CURRENT_SOURCE_DIR}/src/AppVersion.hpp
20+
)
21+
1422
# ==== UPDATE ME HERE ===========
1523
# Absolute path where you installed SFML (Required on Windows)
1624
set(SFML_HOME "C:/SFML/SFML-2.6.1")
17-
set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML)
25+
set(SFML_DIR ${SFML_HOME}/lib/cmake/SFML)
1826
# ==========================
1927

2028
# Collect all sources
@@ -40,7 +48,7 @@ target_link_libraries(SpaceCheckers PRIVATE sfml-graphics sfml-window sfml-syste
4048
ixwebsocket spdlog::spdlog cpr::cpr simdjson::simdjson protobuf::libprotobuf)
4149

4250
# include SFML headers
43-
include_directories(${SFML_HOME}/include)
51+
target_include_directories(SpaceCheckers PUBLIC ${SFML_HOME}/include)
4452

4553
# show warnings (depending on C++ compiler)
4654
if (MSVC)
@@ -56,4 +64,4 @@ if (NOT APPLE)
5664
POST_BUILD
5765
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/resources
5866
$<TARGET_FILE_DIR:SpaceCheckers>/resources)
59-
endif()
67+
endif()

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This game can connect to both Private and Public game servers. The Server projec
2626
- MS Visual Studio 2022 or newer (NOT vscode), with "**Desktop C++ Development**" bundle.
2727
- Please download "Visual C++ 64bit" edition of SFML; ignore others.
2828
- Move your unzipped `SFML-2.6.x` folder to its own home, example: `C:/SFML/SFML-2.6.1`.
29-
- Edit **line 16** in [CMakeLists.txt](CMakeLists.txt), to set value `SFML_HOME` to folder path you moved SFML into (seeprevious step)
29+
- Edit **line 25** in [CMakeLists.txt](CMakeLists.txt), to set value `SFML_HOME` to folder path you moved SFML into (see previous step)
3030

3131
### For macOS (x64 & arm64)
3232

@@ -38,7 +38,7 @@ This game can connect to both Private and Public game servers. The Server projec
3838
sudo xcode-select --install
3939
```
4040

41-
- After installing the CMake GUI, add its accompanying CLI to PATH by simply run the following command:
41+
- After installing the CMake GUI, add its accompanying CLI to PATH, simply run the following command:
4242

4343
```bash
4444
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install

dependencies/libcpr.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
SET(SSL_OPTION "CPR_FORCE_OPENSSL_BACKEND TRUE")
44
if(WIN32)
55
SET(SSL_OPTION "CPR_FORCE_WINSSL_BACKEND TRUE")
6-
elseif(APPLE)
7-
SET(SSL_OPTION "CPR_FORCE_DARWINSSL_BACKEND TRUE")
6+
# elseif(APPLE)
7+
# SET(SSL_OPTION "CPR_FORCE_DARWINSSL_BACKEND TRUE")
88
endif()
99

1010
CPMAddPackage(

dependencies/protobuf.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ CPMAddPackage(
1414
VERSION 30.1
1515
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
1616
OPTIONS "protobuf_BUILD_TESTS OFF" "protobuf_INSTALL OFF" "protobuf_BUILD_PROTOBUF_BINARIES ON"
17-
"protobuf_BUILD_LIBUPB OFF" "protobuf_WITH_ZLIB OFF" "protobuf_BUILD_PROTOC_BINARIES OFF"
18-
"protobuf_MSVC_STATIC_RUNTIME OFF"
17+
"protobuf_BUILD_LIBUPB OFF" "protobuf_BUILD_PROTOC_BINARIES OFF" "protobuf_MSVC_STATIC_RUNTIME OFF"
1918
)

src/AppVersion.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef APP_VERSION_HPP
2+
#define APP_VERSION_HPP
3+
4+
// clang-format off
5+
namespace chk {
6+
constexpr const char* APP_VERSION = "1.0.10";
7+
}
8+
9+
#endif // APP_VERSION_HPP
10+
// clang-format on

src/MainMenu.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Created by Davis 2024-04-09
33
//
44
#pragma once
5+
#include "AppVersion.hpp"
56
#include "Piece.hpp"
67
#include "utils/ResourcePath.hpp"
78
#include <SFML/Graphics/Color.hpp>
@@ -19,7 +20,6 @@ namespace chk
1920
{
2021
constexpr auto ICON_PATH = "win-icon-16.png";
2122
constexpr auto FONT_PATH = "notosans-regular.ttf";
22-
constexpr auto APP_VERSION = "v1.0.10";
2323

2424
enum class UserChoice
2525
{

src/proto_schema/AppVersion.hpp.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef APP_VERSION_HPP
2+
#define APP_VERSION_HPP
3+
4+
// clang-format off
5+
namespace chk {
6+
constexpr const char* APP_VERSION = "@PROJECT_VERSION@";
7+
}
8+
9+
#endif // APP_VERSION_HPP
10+
// clang-format on

src/proto_schema/base_payload.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ syntax = "proto3";
22
package chk.payload;
33

44
option go_package = "checkers-backend/game";
5+
option java_multiple_files = true;
6+
option java_package = "com.davistiba.checkers.payloads";
7+
58

69
message BasePayload {
710
// GUI display text from server to client

0 commit comments

Comments
 (0)