Skip to content

Commit

Permalink
CMake: Add x64 support and update libs from TaystJK
Browse files Browse the repository at this point in the history
**IMPORTANT** This will break your excisting build folder, please backup the files you added to **Debug** and **Release** folders. For example symlink to base, or other mod folders.
The way the project is compiled and the file structure in **build** folder has been changed
  • Loading branch information
JKSunny committed Jul 11, 2024
1 parent 8556a5c commit 8b004a8
Show file tree
Hide file tree
Showing 169 changed files with 20,235 additions and 9,171 deletions.
294 changes: 186 additions & 108 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

23 changes: 21 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ local.properties
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

.vs

# User-specific files
*.suo
*.user
Expand All @@ -61,11 +63,9 @@ local.properties
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
*.dotCover
.vs

winquake.res

Expand Down Expand Up @@ -121,6 +121,8 @@ _UpgradeReport_Files/
Backup*/
UpgradeLog*.XML

# Visual Studio Code
.vscode


############
Expand Down Expand Up @@ -175,4 +177,21 @@ pip-log.txt
## Unix
#############
*.o
*.so

#############
## clangd
#############
.clangd
compile_commands.json

#############
## CLion
#############
.idea

#############
## CMake Builds
#############
[Bb]uild*/
cmake-build-*
45 changes: 28 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,18 @@ set(UseInternalPNGDefault OFF)
set(UseInternalJPEGDefault OFF)
set(UseInternalSDL2Default OFF)

if(WIN32)
set(UseInternalOpenALDefault ON)
set(UseInternalZlibDefault ON)
set(UseInternalPNGDefault ON)
set(UseInternalJPEGDefault ON)
set(UseInternalSDL2Default ON)
endif()

if(APPLE)
set(UseInternalJPEGDefault ON)
set(UseInternalOpenALDefault ON)
set(UseInternalPNGDefault ON)
if(UseInternalLibs OR WIN32 OR APPLE)
if(WIN32)
set(UseInternalOpenALDefault ON)
set(UseInternalZlibDefault ON)
set(UseInternalPNGDefault ON)
set(UseInternalJPEGDefault ON)
set(UseInternalSDL2Default ON)
else()
set(UseInternalJPEGDefault ON)
set(UseInternalPNGDefault ON)
set(UseInternalZlibDefault ON)
endif()
endif()

if(CMAKE_SYSTEM_NAME MATCHES "BSD")
Expand All @@ -92,7 +92,7 @@ if(APPLE)
endif()

# Custom CMake Modules needed
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/CMakeModules")
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake/Modules")

Include(CheckTypeSize)
check_type_size("void*" CMAKE_SIZEOF_VOID_P)
Expand All @@ -112,7 +112,10 @@ if(WIN32)
endif()
else()
set(X86 OFF)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$")
set(Architecture "arm64")
add_definitions(-DPNG_ARM_NEON_OPT=0)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
set(Architecture "arm")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
set(X86 ON)
Expand Down Expand Up @@ -195,9 +198,17 @@ if(MSVC)
set(SharedDefines ${SharedDefines} "_SCL_SECURE_NO_WARNINGS")
set(SharedDefines ${SharedDefines} "_CRT_NONSTDC_NO_DEPRECATE")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /EHsc /arch:SSE2")
# Warnings
# 4244 = conversion' conversion from 'type1' to 'type2', possible loss of data
# 4996 = 'function': was declared deprecated
# 4267 = 'var' : conversion from 'size_t' to 'type', possible loss of data
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4996 /wd4267")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4996 /wd4267")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
if (Architecture STREQUAL "x86")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /arch:SSE2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
endif()

# Configure MSVC Runtime
include(MSVCRuntime)
Expand Down Expand Up @@ -341,7 +352,7 @@ set(SharedCommonSafeFiles


if(UseInternalJPEG)
add_subdirectory(lib/jpeg-9a)
add_subdirectory(lib/jpeg-9c)
else()
find_package(JPEG REQUIRED)
endif()
Expand Down
18 changes: 0 additions & 18 deletions CreateVisualStudio2015Projects.bat

This file was deleted.

18 changes: 0 additions & 18 deletions CreateVisualStudio2017Projects.bat

This file was deleted.

18 changes: 0 additions & 18 deletions CreateVisualStudio2019Projects.bat

This file was deleted.

18 changes: 0 additions & 18 deletions CreateVisualStudio2022Projects.bat

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ COPY . /usr/src/openjk
# Build i386 arch
RUN mkdir /usr/src/openjk/build.i386 &&\
cd /usr/src/openjk/build.i386 &&\
cmake -DCMAKE_TOOLCHAIN_FILE=CMakeModules/Toolchains/linux-i686.cmake \
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/linux-i686.cmake \
-DCMAKE_INSTALL_PREFIX=/opt \
-DBuildMPCGame=OFF -DBuildMPEngine=OFF -DBuildMPRdVanilla=OFF -DBuildMPUI=OFF \
-DBuildSPEngine=OFF -DBuildSPGame=OFF -DBuildSPRdVanilla=OFF \
Expand Down
9 changes: 9 additions & 0 deletions build/build-unix-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

type cmake >/dev/null 2>&1 || { echo >&2 "Can't find cmake."; exit 1; }

BUILD_DIR="`uname`-`uname -m`-debug"
mkdir "$BUILD_DIR"
cd "$BUILD_DIR"
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ../..
make
9 changes: 9 additions & 0 deletions build/build-unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

type cmake >/dev/null 2>&1 || { echo >&2 "Can't find cmake."; exit 1; }

BUILD_DIR="`uname`-`uname -m`"
mkdir "$BUILD_DIR"
cd "$BUILD_DIR"
cmake -G "Unix Makefiles" ../..
make
Loading

0 comments on commit 8b004a8

Please sign in to comment.