Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building on Windows with vcpkg #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ CMakeLists.txt.user*
*.suo
*.user

#-- vs & vscode
.vs*

*.lnk
#-- binaries
StuntRally*.*
Expand Down
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project(StuntRally CXX C)
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.16)
project(StuntRally)

# Allows disabling building of components
option(BUILD_GAME "Build the game binary." ON)
Expand Down Expand Up @@ -34,13 +34,13 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()



# Include path for additional CMake library finding scripts
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")

# We want the binaries to be easily accessible
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)


# Data installation path
Expand Down Expand Up @@ -113,7 +113,7 @@ if(BUILD_GAME OR BUILD_EDITOR)
link_directories(${SDL2_LIBRARY_DIRS})
list(APPEND LIBS ${SDL2_LIBRARY})

find_package(MyGUI REQUIRED QUIET)
find_package(MyGUI REQUIRED)
include_directories(${MYGUI_INCLUDE_DIRS})
include_directories(${MYGUI_PLATFORM_INCLUDE_DIRS})
link_directories(${MYGUI_LIB_DIR})
Expand Down
87 changes: 0 additions & 87 deletions cmake/FindBullet.cmake

This file was deleted.

29 changes: 28 additions & 1 deletion cmake/FindMyGUI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,31 @@ IF (WIN32) #Windows
SET(MYGUI_LIB_DIR ${OGRESOURCE}/lib)
SET(MYGUI_LIBRARIES debug Debug/MyGUIEngine_d optimized Release/MyGUIEngine)
ENDIF (OGRESOURCE)
IF (VCPKG_TOOLCHAIN)
# The MyGUIConfig.cmake file isn't installed by vcpkg and
# find_path() has trouble finding MyGUI.h for some reason, so
# manually specify the required paths here. This doesn't do
# much detection, so if MyGUI was not installed, configuration
# might proceed as normal, but the build will fail.
message(STATUS "Using MyGUI from vcpkg")
add_library(MyGUIStaticLinkage INTERFACE)
target_compile_definitions(MyGUIStaticLinkage INTERFACE MYGUI_STATIC)
find_package(Freetype REQUIRED QUIET)
target_link_libraries(MyGUIStaticLinkage INTERFACE Freetype::Freetype)
find_library(MYGUI_LIBRARIES_REL NAMES MyGUIEngineStatic)
if(MYGUI_LIBRARIES_REL)
set(MYGUI_LIBRARIES_REL optimized ${MYGUI_LIBRARIES_REL})
endif()
find_library(MYGUI_LIBRARIES_DBG NAMES MyGUIEngineStatic_d)
if(MYGUI_LIBRARIES_DBG)
set(MYGUI_LIBRARIES_DBG debug ${MYGUI_LIBRARIES_DBG})
endif()
target_link_libraries(MyGUIStaticLinkage INTERFACE ${MYGUI_LIBRARIES_REL} ${MYGUI_LIBRARIES_DBG})
set(MYGUI_INCLUDE_DIRS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/MYGUI")
# MYGUI_LIB_DIR is handled by above library, so just put anything here
set(MYGUI_LIB_DIR ${CMAKE_BINARY_DIR})
set(MYGUI_LIBRARIES MyGUIStaticLinkage)
ENDIF (VCPKG_TOOLCHAIN)
ELSE (WIN32) #Unix
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
FIND_PACKAGE(PkgConfig)
Expand All @@ -97,7 +122,9 @@ ELSE (WIN32) #Unix
ENDIF (WIN32)

#Do some preparation
SEPARATE_ARGUMENTS(MYGUI_INCLUDE_DIRS)
IF (NOT VCPKG_TOOLCHAIN)
SEPARATE_ARGUMENTS(MYGUI_INCLUDE_DIRS)
ENDIF (NOT VCPKG_TOOLCHAIN)
SEPARATE_ARGUMENTS(MYGUI_LIBRARIES)
SEPARATE_ARGUMENTS(MYGUI_PLATFORM_LIBRARIES)

Expand Down
17 changes: 17 additions & 0 deletions data/gui/MyGUI_Ogre_FP.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version 130

precision highp int;
precision highp float;

uniform sampler2D sampleTexture;

in vec4 outUV0;
in vec4 outColor;

out vec4 fragColor;

// Texturing fragment program for GLSL
void main()
{
fragColor = outColor * texture(sampleTexture, outUV0.xy);
}
15 changes: 15 additions & 0 deletions data/gui/MyGUI_Ogre_FP.glsles
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 100

precision highp int;
precision highp float;

uniform sampler2D sampleTexture;

varying vec4 outUV0;
varying vec4 outColor;

// Texturing fragment program for GLSL ES
void main()
{
gl_FragColor = outColor * texture2D(sampleTexture, outUV0.xy);
}
9 changes: 9 additions & 0 deletions data/gui/MyGUI_Ogre_FP.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
void main(
uniform sampler2D sampleTexture : register(s0),
in float4 inPosition : POSITION,
in float4 inColor : TEXCOORD0,
in float2 inTexcoord : TEXCOORD1,
out float4 Out : COLOR )
{
Out = tex2D(sampleTexture, inTexcoord) * inColor;
}
20 changes: 20 additions & 0 deletions data/gui/MyGUI_Ogre_VP.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#version 130

precision highp int;
precision highp float;

in vec4 position;
in vec4 uv0;
in vec4 colour;
uniform mat4 worldViewProj;

out vec4 outUV0;
out vec4 outColor;

// Texturing vertex program for GLSL
void main()
{
gl_Position = worldViewProj * position;
outUV0 = uv0;
outColor = colour;
}
20 changes: 20 additions & 0 deletions data/gui/MyGUI_Ogre_VP.glsles
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#version 100

precision highp int;
precision highp float;

attribute vec4 position;
attribute vec4 uv0;
attribute vec4 colour;
uniform mat4 worldViewProj;

varying vec4 outUV0;
varying vec4 outColor;

// Texturing vertex program for GLSL ES
void main()
{
gl_Position = worldViewProj * position;
outUV0 = uv0;
outColor = colour;
}
13 changes: 13 additions & 0 deletions data/gui/MyGUI_Ogre_VP.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
void main(
in float4 inPosition : POSITION0,
in float4 inColor : COLOR0,
in float2 inTexcoord : TEXCOORD0,
uniform float4x4 worldViewProj,
out float4 outPosition : SV_POSITION,
out float4 outColor : TEXCOORD0,
out float2 outTexcoord : TEXCOORD1 )
{
outPosition = mul(worldViewProj, inPosition);
outColor = inColor;
outTexcoord = inTexcoord;
}
15 changes: 15 additions & 0 deletions source/BulletFileLoader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
add_library(BulletFileLoader STATIC
bChunk.cpp
bChunk.h
bCommon.h
bDefines.h
bDNA.cpp
bDNA.h
bFile.cpp
bFile.h
btBulletFile.cpp
btBulletFile.h)

target_include_directories(BulletFileLoader PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(BulletFileLoader PRIVATE ${BULLET_LIBRARIES})
target_include_directories(BulletFileLoader PUBLIC ./)
75 changes: 75 additions & 0 deletions source/BulletFileLoader/bChunk.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
bParse
Copyright (c) 2006-2009 Charlie C & Erwin Coumans http://gamekit.googlecode.com

This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/

#include "bChunk.h"
#include "bDefines.h"
#include "bFile.h"

#if !defined( __CELLOS_LV2__) && !defined(__MWERKS__)
#include <memory.h>
#endif
#include <string.h>


using namespace bParse;


// ----------------------------------------------------- //
short ChunkUtils::swapShort(short sht)
{
SWITCH_SHORT(sht);
return sht;
}

// ----------------------------------------------------- //
int ChunkUtils::swapInt(int inte)
{
SWITCH_INT(inte);
return inte;
}

// ----------------------------------------------------- //
long64 ChunkUtils::swapLong64(long64 lng)
{
SWITCH_LONGINT(lng);
return lng;
}

// ----------------------------------------------------- //
int ChunkUtils::getOffset(int flags)
{
// if the file is saved in a
// different format, get the
// file's chunk size
int res = CHUNK_HEADER_LEN;

if (VOID_IS_8)
{
if (flags &FD_BITS_VARIES)
res = sizeof(bChunkPtr4);
}
else
{
if (flags &FD_BITS_VARIES)
res = sizeof(bChunkPtr8);
}
return res;
}





//eof