cmake can generate vs.net sln

cmake generates:
- iceball
- iceball-soft (no opengl)
- iceded (dedi server)
removed old project files
This commit is contained in:
learn_more 2013-02-16 16:45:37 +01:00
parent 689404504a
commit ded5a5c45e
12 changed files with 149 additions and 334 deletions

17
.gitignore vendored
View File

@ -30,6 +30,17 @@ gmon.out
*.ncb *.ncb
*.user *.user
msvc/Debug build/*
msvc/Release
build/msvc #cmake cache files
CMakeFiles
CmakeCache.txt
cmake_install.cmake
src/iceball.dir
src/iceball-soft.dir
src/iceded.dir
ZERO_CHECK.dir
#some cmake generated shit that will vs.net notify of cmake file changes.
ALL_BUILD.vcproj
ZERO_CHECK.vcproj

41
CMakeLists.txt Normal file
View File

@ -0,0 +1,41 @@
#/CMakeLists.txt
cmake_minimum_required (VERSION 2.8)
project (iceball)
#set(CMAKE_BINARY_DIR build)
set(CMAKE_SOURCE_DIR src)
set(OUTDIR ../build)
# First for the generic no-config case (e.g. with mingw)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTDIR} )
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTDIR} )
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTDIR} )
# Second, for multi-config builds (e.g. msvc)
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTDIR} )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTDIR} )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${OUTDIR} )
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
IF(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake)")
add_definitions(/W4) # warning level
add_definitions(/TP) # compile as c++
ELSEIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-Wall -g) # keep debugging symbols even in Release builds
ENDIF()
include_directories(include)
if (WIN32)
if (MSVC)
set_source_files_properties(filename.c PROPERTIES LANGUAGE CXX )
endif (MSVC)
LINK_DIRECTORIES(../winlibs)
include_directories(winlibs/glew)
include_directories(winlibs/lua)
include_directories(winlibs/SDL)
include_directories(winlibs/zlib)
endif (WIN32)
add_subdirectory(src)

View File

@ -70,4 +70,12 @@ MSVC readme (wip):
'-c iceballga.me 20737' (connect to srv) '-c iceballga.me 20737' (connect to srv)
'-s 0 pkg/base' (make local srv) '-s 0 pkg/base' (make local srv)
- edit clsave/pub/user.json - edit clsave/pub/user.json
- now run it from vs.net debugger :) - now run it from vs.net debugger :)
for the git starters:
- git update-index --assume-unchanged clsave\pub\user.json
and to get updates from the main repo:
- git remote add upstream git://github.com/iamgreaser/buldthensnip.git
- git pull --rebase upstream master
- git push origin master

7
buildenv/vs2k10.bat Normal file
View File

@ -0,0 +1,7 @@
@echo off
cls
echo Generating Visual Studio 2010 files...
echo .
pushd ..
cmake -Wno-dev -G "Visual Studio 10" .
popd

7
buildenv/vs2k8.bat Normal file
View File

@ -0,0 +1,7 @@
@echo off
cls
echo Generating Visual Studio 2008 files...
echo .
pushd ..
cmake -Wno-dev -G "Visual Studio 9 2008" .
popd

View File

@ -49,7 +49,14 @@
#define __attribute__(x) #define __attribute__(x)
#define PACK_START __pragma( pack(push, 1) ) #define PACK_START __pragma( pack(push, 1) )
#define PACK_END __pragma( pack(pop) ) #define PACK_END __pragma( pack(pop) )
typedef unsigned int uint32_t; typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define snprintf sprintf_s #define snprintf sprintf_s
#define _USE_MATH_DEFINES //M_PI and whatnot from math.h #define _USE_MATH_DEFINES //M_PI and whatnot from math.h
#pragma warning( disable: 4200 4244 4996) #pragma warning( disable: 4200 4244 4996)

View File

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iceball", "iceball.vcproj", "{CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}.Debug|Win32.ActiveCfg = Debug|Win32
{CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}.Debug|Win32.Build.0 = Debug|Win32
{CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}.Release|Win32.ActiveCfg = Release|Win32
{CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,305 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="iceball"
ProjectGUID="{CD5FA57E-F7A1-4CC0-B8B0-043E78858D90}"
RootNamespace="iceball"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;../winlibs/lua;../winlibs/SDL;../winlibs/zlib;../winlibs/glew"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;USE_OPENGL"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib SDLmain.lib lua5.1.lib ws2_32.lib zdll.lib glew32.lib opengl32.lib"
OutputFile="$(SolutionDir)\..\build\msvc\$(ProjectName).exe"
LinkIncremental="2"
AdditionalLibraryDirectories="../winlibs"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copying dependency dll&apos;s"
CommandLine="copy $(SolutionDir)\..\winlibs\*.dll $(TargetDir)"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../include;../winlibs/lua;../winlibs/SDL;../winlibs/zlib;../winlibs/glew"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;USE_OPENGL"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="SDL.lib SDLmain.lib lua5.1.lib ws2_32.lib zdll.lib glew32.lib opengl32.lib"
OutputFile="$(SolutionDir)\..\build\msvc\$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../winlibs"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
Description="Copying dependency dll&apos;s"
CommandLine="copy $(SolutionDir)\..\winlibs\*.dll $(TargetDir)"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\src\dsp.c"
>
</File>
<File
RelativePath="..\src\img.c"
>
</File>
<File
RelativePath="..\src\json.c"
>
</File>
<File
RelativePath="..\src\logtxt.c"
>
</File>
<File
RelativePath="..\src\lua.c"
>
</File>
<File
RelativePath="..\src\main.c"
>
</File>
<File
RelativePath="..\src\map.c"
>
</File>
<File
RelativePath="..\src\model.c"
>
</File>
<File
RelativePath="..\src\network.c"
>
</File>
<File
RelativePath="..\src\path.c"
>
</File>
<File
RelativePath="..\src\vecmath.c"
>
</File>
<File
RelativePath="..\src\wav.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\include\common.h"
>
</File>
<File
RelativePath="..\src\lua_base.h"
>
</File>
<File
RelativePath="..\src\lua_camera.h"
>
</File>
<File
RelativePath="..\src\lua_fetch.h"
>
</File>
<File
RelativePath="..\src\lua_image.h"
>
</File>
<File
RelativePath="..\src\lua_input.h"
>
</File>
<File
RelativePath="..\src\lua_json.h"
>
</File>
<File
RelativePath="..\src\lua_map.h"
>
</File>
<File
RelativePath="..\src\lua_model.h"
>
</File>
<File
RelativePath="..\src\lua_net.h"
>
</File>
<File
RelativePath="..\src\lua_util.h"
>
</File>
<File
RelativePath="..\src\lua_wav.h"
>
</File>
</Filter>
<Filter
Name="gl"
>
<File
RelativePath="..\src\gl\render.c"
>
</File>
<File
RelativePath="..\src\gl\render_img.c"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

43
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,43 @@
#/src/CMakeLists.txt
file(GLOB LUA_FILES lua*)
set(MAIN_FILES dsp.c img.c json.c logtxt.c main.c map.c model.c network.c path.c vecmath.c wav.c)
set(GL_FILES gl/render.c gl/render_img.c)
source_group(gl FILES ${GL_FILES})
set(SOFT_FILES softgm/render.c softgm/render_img.c)
source_group(softgm FILES ${SOFT_FILES})
source_group(lua FILES ${LUA_FILES})
add_executable(iceball ${MAIN_FILES} ${LUA_FILES} ${GL_FILES})
target_link_libraries(iceball lua5.1 SDL SDLmain opengl32 glew32)
set_target_properties(iceball PROPERTIES COMPILE_DEFINITIONS "USE_OPENGL")
add_executable(iceball-soft ${MAIN_FILES} ${LUA_FILES} ${SOFT_FILES})
target_link_libraries(iceball-soft lua5.1 SDL SDLmain)
add_executable(iceded ${MAIN_FILES} ${LUA_FILES})
target_link_libraries(iceded lua5.1 SDL SDLmain)
set_target_properties(iceded PROPERTIES COMPILE_DEFINITIONS "DEDI")
macro(add_dll DLLNAME)
add_custom_command(TARGET iceball POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ../winlibs/${DLLNAME} $<TARGET_FILE_DIR:iceball>)
add_custom_command(TARGET iceball-soft POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ../winlibs/${DLLNAME} $<TARGET_FILE_DIR:iceball-soft>)
add_custom_command(TARGET iceded POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ../winlibs/${DLLNAME} $<TARGET_FILE_DIR:iceball-soft>)
endmacro(add_dll)
if (WIN32)
target_link_libraries(iceball ws2_32 zdll)
target_link_libraries(iceball-soft ws2_32 zdll)
target_link_libraries(iceded ws2_32 zdll)
add_dll("lua5.1.dll")
add_dll("SDL.dll")
add_dll("glew32.dll")
add_dll("zlib1.dll")
else()
#target_link_libraries(iceball zlib)
#target_link_libraries(iceball-soft zlib)
endif (WIN32)

View File

@ -146,7 +146,10 @@ int icelua_fn_client_camera_shading_set(lua_State *L)
{ {
/* sides are: east, bottom, south, west, top, north */ /* sides are: east, bottom, south, west, top, north */
int top = icelua_assert_stack(L, 6, 6); int top = icelua_assert_stack(L, 6, 6);
#ifdef DEDI
return luaL_error(L, "lm: why the hell is this being called in the dedi version?");
#else
int i; int i;
for(i = 0; i < 6; i++) for(i = 0; i < 6; i++)
{ {
@ -157,7 +160,8 @@ int icelua_fn_client_camera_shading_set(lua_State *L)
if(s >= 128) s++; if(s >= 128) s++;
cam_shading[i] = s; cam_shading[i] = s;
} }
#endif
return 0; return 0;
} }

View File

@ -65,10 +65,14 @@ int icelua_fn_client_img_blit_to(lua_State *L)
sy = (top < 8 ? 0 : lua_tointeger(L, 8)); sy = (top < 8 ? 0 : lua_tointeger(L, 8));
color = (top < 9 ? 0xFFFFFFFF : (uint32_t)lua_tointeger(L, 9)); color = (top < 9 ? 0xFFFFFFFF : (uint32_t)lua_tointeger(L, 9));
#ifdef DEDI
return luaL_error(L, "lm: why the hell is this being called in the dedi version?");
#else
render_blit_img(dest->pixels, dest->head.width, dest->head.height, render_blit_img(dest->pixels, dest->head.width, dest->head.height,
dest->head.width, dest->head.width,
source, dx, dy, bw, bh, sx, sy, color); source, dx, dy, bw, bh, sx, sy, color);
#endif
#ifdef USE_OPENGL #ifdef USE_OPENGL
dest->tex_dirty = 1; dest->tex_dirty = 1;
#endif #endif

View File

@ -340,10 +340,14 @@ int icelua_fn_client_map_fog_get(lua_State *L)
{ {
int top = icelua_assert_stack(L, 0, 0); int top = icelua_assert_stack(L, 0, 0);
#ifdef DEDI
return luaL_error(L, "lm: why the hell is this being called in the dedi version?");
#else
lua_pushinteger(L, (fog_color>>16)&255); lua_pushinteger(L, (fog_color>>16)&255);
lua_pushinteger(L, (fog_color>>8)&255); lua_pushinteger(L, (fog_color>>8)&255);
lua_pushinteger(L, (fog_color)&255); lua_pushinteger(L, (fog_color)&255);
lua_pushnumber(L, fog_distance); lua_pushnumber(L, fog_distance);
#endif
return 4; return 4;
} }
@ -352,6 +356,9 @@ int icelua_fn_client_map_fog_set(lua_State *L)
{ {
int top = icelua_assert_stack(L, 4, 4); int top = icelua_assert_stack(L, 4, 4);
#ifdef DEDI
return luaL_error(L, "lm: why the hell is this being called in the dedi version?");
#else
int r = lua_tointeger(L, 1)&255; int r = lua_tointeger(L, 1)&255;
int g = lua_tointeger(L, 2)&255; int g = lua_tointeger(L, 2)&255;
int b = lua_tointeger(L, 3)&255; int b = lua_tointeger(L, 3)&255;
@ -363,6 +370,7 @@ int icelua_fn_client_map_fog_set(lua_State *L)
fog_color = (r<<16)|(g<<8)|b; fog_color = (r<<16)|(g<<8)|b;
force_redraw = 1; force_redraw = 1;
#endif
return 4; return 4;
} }