Skip to content

Commit bde51a5

Browse files
authored
Merge pull request #243 from MoeMod/QindieGL
Qindie gl
2 parents 171d509 + 640d389 commit bde51a5

27 files changed

Lines changed: 517 additions & 98 deletions

.gitmodules

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
[submodule "nanogl"]
55
path = nanogl
66
url = https://github.com/MoeMod/nanogl
7-
[submodule "cmake/CMakePCHCompiler"]
8-
path = cmake/CMakePCHCompiler
9-
url = https://github.com/nanoant/CMakePCHCompiler
107
[submodule "gl-wes-v2"]
118
path = gl-wes-v2
129
url = https://github.com/MoeMod/gl-wes-v2
1310
[submodule "imgui"]
1411
path = imgui
15-
url = https://github.com/ocornut/imgui
12+
url = https://github.com/MoeMod/imgui
13+
[submodule "3rdparty/QindieGL"]
14+
path = 3rdparty/QindieGL
15+
url = https://github.com/MoeMod/QindieGL

3rdparty/QindieGL

Submodule QindieGL added at 9dfe5f3

CMakeLists.txt

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project(csmoe)
2-
cmake_minimum_required(VERSION 2.8.0)
2+
cmake_minimum_required(VERSION 3.10.2)
33

44
# Install custom module path
55
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
@@ -8,17 +8,22 @@ option(XASH_STATIC_GAMELIB "Build static game library" ON)
88

99
option(XASH_DEDICATED "Enable dedicated build. Servers must choose this." OFF) # Servers must choose this
1010

11-
option(XASH_PCH "Enable PCH support." ON)
11+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
12+
option(XASH_PCH "Enable PCH support." ON)
13+
endif()
1214

1315
option(XASH_VCPKG "Enable VCPKG support." OFF)
1416

15-
if(XASH_PCH)
16-
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/CMakePCHCompiler/")
17-
include(CMakePCHCompiler)
17+
if(XASH_DEDICATED)
18+
option(XASH_SDL "Enable SDL." OFF) # Dedicated servers still can use SDL
19+
else()
20+
option(XASH_SDL "Enable SDL." ON)
1821
endif()
1922

20-
if(XASH_PCH AND XASH_VCPKG)
21-
message(FATAL_ERROR "XASH_PCH and XASH_VCPKG are not compatible")
23+
if(XASH_PCH)
24+
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
25+
message(FATAL_ERROR "PCH is not supported. Please update to CMake 3.16 or higher.")
26+
endif()
2227
endif()
2328

2429
if(XASH_STATIC_GAMELIB)
@@ -120,7 +125,6 @@ else()
120125
endif()
121126

122127
set(XASH_BUILD_COMMIT "${CMAKE_BUILD_POSTFIX}")
123-
set(SDL_SHARED true)
124128
set(XASH_LIBDL true)
125129

126130
set(CMAKE_CXX_STANDARD 17)
@@ -150,6 +154,35 @@ if(XASH_IMGUI)
150154
target_link_libraries(imgui_ext PUBLIC imgui)
151155
endif()
152156

157+
if(XASH_SDL)
158+
add_library(sdl2 INTERFACE)
159+
if(XASH_VCPKG)
160+
find_package(SDL2 CONFIG REQUIRED)
161+
target_link_libraries(sdl2 INTERFACE SDL2::SDL2)
162+
elseif(IOS)
163+
target_include_directories(sdl2 INTERFACE "${CMAKE_SOURCE_DIR}/SDL2/include")
164+
else()
165+
find_package(SDL2 QUIET)
166+
167+
if(SDL2_FOUND)
168+
target_link_libraries(sdl2 INTERFACE ${SDL2_LIBRARY})
169+
target_include_directories(sdl2 INTERFACE ${SDL2_INCLUDE_DIR})
170+
if(MSVC)
171+
string(REGEX REPLACE "lib$" "dll" SDL2_DLL "${SDL2_LIBRARY}")
172+
install(FILES ${SDL2_DLL} DESTINATION "." OPTIONAL)
173+
endif()
174+
else()
175+
if(MSVC)
176+
add_definitions(-D_ftol2_sse=SDL_ftol2_sse) # fix x86 compile
177+
endif()
178+
set(DIRECTX OFF CACHE BOOL "" FORCE) # win10 arm dont have dx8
179+
add_subdirectory(SDL2 EXCLUDE_FROM_ALL)
180+
target_link_libraries(sdl2 INTERFACE SDL2-static)
181+
endif()
182+
endif()
183+
184+
endif()
185+
153186
if(NOT XASH_DEDICATED)
154187
ADD_SUBDIRECTORY(cl_dll)
155188
ADD_SUBDIRECTORY(mainui_cpp)

Xcode-iOS/CSMoE-iOS.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
498CCAC41E15618F00299D38 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 498CCAC31E15618F00299D38 /* SystemConfiguration.framework */; };
8787
498CCAC61E1561AD00299D38 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 498CCAC51E1561AD00299D38 /* CFNetwork.framework */; };
8888
49C4D60720781DAB00855677 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE0E9691BAF96A00098DFA4 /* GameController.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
89+
B6467524253FE21E00F557B8 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B646751B253FE21E00F557B8 /* CoreBluetooth.framework */; };
8990
FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
9091
FABA34D41D8B5E5600915323 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34D31D8B5E5600915323 /* AVFoundation.framework */; };
9192
FDB96EE00DEFC9DC00FAF19F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDB96EDF0DEFC9DC00FAF19F /* QuartzCore.framework */; };
@@ -226,6 +227,7 @@
226227
495E1A191E13199A0022E4AA /* launchdialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = launchdialog.m; sourceTree = "<group>"; };
227228
498CCAC31E15618F00299D38 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
228229
498CCAC51E1561AD00299D38 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
230+
B646751B253FE21E00F557B8 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; };
229231
FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
230232
FABA34D31D8B5E5600915323 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
231233
FAE0E9691BAF96A00098DFA4 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
@@ -240,6 +242,7 @@
240242
isa = PBXFrameworksBuildPhase;
241243
buildActionMask = 2147483647;
242244
files = (
245+
B6467524253FE21E00F557B8 /* CoreBluetooth.framework in Frameworks */,
243246
3D4DAA0B23BCEE1900F575C1 /* libSDL2.a in Frameworks */,
244247
3D8777C624A26838006806BF /* libimgui_ext.a in Frameworks */,
245248
3DF2719E23D45158005D151E /* libimgui.a in Frameworks */,
@@ -317,6 +320,7 @@
317320
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
318321
isa = PBXGroup;
319322
children = (
323+
B646751B253FE21E00F557B8 /* CoreBluetooth.framework */,
320324
3D37322E229488AA00713C9C /* GLKit.framework */,
321325
3D0FC1DB2278310100D9A961 /* libc++.tbd */,
322326
3D525D7722252AAB00DD9932 /* Metal.framework */,

Xcode-iOS/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
<string>UIInterfaceOrientationPortrait</string>
5555
<string>UIInterfaceOrientationPortraitUpsideDown</string>
5656
</array>
57+
<key>NSBluetoothAlwaysUsageDescription</key>
58+
<string>CSMoE requires bluetooth permission for built-in SDL2 library.</string>
5759
<key>UISupportsDocumentBrowser</key>
5860
<true/>
5961
</dict>

cl_dll/CMakeLists.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,9 @@
2020
# SOFTWARE.
2121
#
2222

23-
cmake_minimum_required(VERSION 3.1.3)
23+
cmake_minimum_required(VERSION 3.10.2)
2424

25-
if(XASH_PCH)
26-
project (client CXX CXXPCH)
27-
else()
28-
project (client)
29-
endif()
25+
project (client)
3026

3127
set(CMAKE_CXX_STANDARD 14)
3228

@@ -371,10 +367,5 @@ if(NOT XASH_STATIC_GAMELIB)
371367
endif()
372368

373369
if(XASH_PCH)
374-
target_precompiled_header(${CLIENT_LIBRARY} stdafx.h)
375-
set_target_properties(${CLIENT_LIBRARY} PROPERTIES
376-
CXX_STANDARD ${CMAKE_CXX_STANDARD}
377-
CXX_STANDARD_REQUIRED YES
378-
CXX_EXTENSIONS NO
379-
)
370+
target_precompile_headers(${CLIENT_LIBRARY} PRIVATE stdafx.h)
380371
endif()

cmake/CMakePCHCompiler

Lines changed: 0 additions & 1 deletion
This file was deleted.

cmake/FindDirectX.cmake

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#-------------------------------------------------------------------
2+
# This file is part of the CMake build system for OGRE
3+
# (Object-oriented Graphics Rendering Engine)
4+
# For the latest info, see http://www.ogre3d.org/
5+
#
6+
# The contents of this file are placed in the public domain. Feel
7+
# free to make use of it in any way you like.
8+
#-------------------------------------------------------------------
9+
10+
# -----------------------------------------------------------------------------
11+
# Find DirectX9 SDK
12+
# Define:
13+
# DirectX9_FOUND
14+
# DirectX9_INCLUDE_DIR
15+
# DirectX9_LIBRARY
16+
# DirectX9_ROOT_DIR
17+
18+
if(WIN32) # The only platform it makes sense to check for DirectX9 SDK
19+
include(FindPkgMacros)
20+
findpkg_begin(DirectX9)
21+
22+
# Get path, convert backslashes as ${ENV_DXSDK_DIR}
23+
getenv_path(DXSDK_DIR)
24+
getenv_path(DirectX_HOME)
25+
getenv_path(DirectX_ROOT)
26+
getenv_path(DirectX_BASE)
27+
28+
# construct search paths
29+
set(DirectX9_PREFIX_PATH
30+
"${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
31+
"${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
32+
"${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
33+
"${DIRECTX_BASE}" "${ENV_DIRECTX_BASE}"
34+
"C:/apps_x86/Microsoft DirectX SDK*"
35+
"C:/Program Files (x86)/Microsoft DirectX SDK*"
36+
"C:/apps/Microsoft DirectX SDK*"
37+
"C:/Program Files/Microsoft DirectX SDK*"
38+
"$ENV{ProgramFiles}/Microsoft DirectX SDK*"
39+
)
40+
41+
create_search_paths(DirectX9)
42+
43+
# redo search if prefix path changed
44+
clear_if_changed(DirectX9_PREFIX_PATH
45+
DirectX9_LIBRARY
46+
DirectX9_INCLUDE_DIR
47+
)
48+
49+
find_path(DirectX9_INCLUDE_DIR NAMES d3dx9.h DxErr.h HINTS ${DirectX9_INC_SEARCH_PATH})
50+
# dlls are in DirectX9_ROOT_DIR/Developer Runtime/x64|x86
51+
# lib files are in DirectX9_ROOT_DIR/Lib/x64|x86
52+
if(CMAKE_CL_64)
53+
set(DirectX9_LIBPATH_SUFFIX "x64")
54+
else(CMAKE_CL_64)
55+
set(DirectX9_LIBPATH_SUFFIX "x86")
56+
endif(CMAKE_CL_64)
57+
find_library(DirectX9_LIBRARY NAMES d3d9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
58+
find_library(DirectX9_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
59+
find_library(DirectX9_DXERR_LIBRARY NAMES DxErr dxerr9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
60+
find_library(DirectX9_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
61+
62+
findpkg_finish(DirectX9)
63+
set(DirectX9_LIBRARIES ${DirectX9_LIBRARIES}
64+
${DirectX9_D3DX9_LIBRARY}
65+
${DirectX9_DXERR_LIBRARY}
66+
${DirectX9_DXGUID_LIBRARY}
67+
)
68+
69+
mark_as_advanced(DirectX9_D3DX9_LIBRARY DirectX9_DXERR_LIBRARY DirectX9_DXGUID_LIBRARY
70+
DirectX9_DXGI_LIBRARY DirectX9_D3DCOMPILER_LIBRARY)
71+
72+
endif(WIN32)

0 commit comments

Comments
 (0)