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

Upgraded build system to run cmake and build on modern windows. #8

Merged
merged 26 commits into from
Oct 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3b63a01
Upgraded build system to run cmake. BulletML is now part of the main …
vblanco20-1 Feb 20, 2021
9d14134
Create cmake.yml
vblanco20-1 Feb 20, 2021
324e321
Merge branch 'cmake_pr'
vblanco20-1 Feb 20, 2021
daf6001
action tweak.
vblanco20-1 Feb 20, 2021
3a99d16
Compile fix for ubuntu
vblanco20-1 Feb 20, 2021
c3e106e
Added string.h for bulletml compile
vblanco20-1 Feb 20, 2021
d627f7a
added string.h to tinyxml to solve linux compile
vblanco20-1 Feb 20, 2021
2d20364
Fixed namespace errors in ygg, added cpp flags to gcc/clang to not co…
vblanco20-1 Feb 20, 2021
930051a
Trying to add sdl install to Actions
vblanco20-1 Feb 20, 2021
fe9a6a2
removed mixer dbg from actions
vblanco20-1 Feb 20, 2021
14e77a6
Adding logic to cmakelists to try to find SDL
vblanco20-1 Feb 20, 2021
07943a2
Linux compile fixes
vblanco20-1 Feb 20, 2021
1cd5181
Added gl libs to actions
vblanco20-1 Feb 20, 2021
c379f5c
case sensitivity
vblanco20-1 Feb 20, 2021
ec05c2f
declspec issue fix
vblanco20-1 Feb 20, 2021
377dfd5
more declspec fixes
vblanco20-1 Feb 20, 2021
20660ac
ifdef error fx
vblanco20-1 Feb 20, 2021
609b4c9
opengl linux libs
vblanco20-1 Feb 20, 2021
492bc15
case sensitive lib fix
vblanco20-1 Feb 20, 2021
30ccb47
Squashed commit: Made game build on linux automatically through githu…
vblanco20-1 Feb 20, 2021
3dae2a7
Automatic SDL download through fetchcontent
vblanco20-1 Feb 20, 2021
0268473
Automatic SDL download for windows
vblanco20-1 Feb 20, 2021
b476179
Github actions for windows
vblanco20-1 Feb 20, 2021
d47c0ef
Cmake tweaks. Changed build output folder for the .exe, and allow x32…
vblanco20-1 Feb 21, 2021
4d7106b
Upgraded cmake script so that it copies rr.exe and the dlls to the ro…
vblanco20-1 Feb 28, 2021
320e63d
Only copy the dlls on windows
vblanco20-1 Feb 28, 2021
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
74 changes: 74 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CMake

on: [push]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
linuxbuild:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build


- name: Dependencies
run: sudo apt-get install libsdl1.2debian libsdl-gfx1.2-5 libsdl-gfx1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dev mesa-common-dev freeglut3-dev

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE

windowsbuild:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{github.workspace}}/build

- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE

- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE
86 changes: 86 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# CMakeList.txt : CMake project for vulkan_guide, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

project ("rRootage")

set (CMAKE_CXX_STANDARD 14)


include(FetchContent)

set (CMAKE_CXX_STANDARD 14)

# setup SDL library
set(SDL_PATH "K:/Programming/SDL-1.2.15" CACHE PATH "path to SDL installation")
set(SDLMIXER_PATH "K:/Programming/SDL_mixer-1.2.12" CACHE PATH "path to SDL Mixer installation")
set(DOWNLOAD_DEPS true CACHE BOOL "Automatic download SDL")


add_library(SDLlibs INTERFACE)

set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")

if(NOT MSVC)
find_path(SDL_PATH SDL.h
HINTS
ENV SDLDIR
PATH_SUFFIXES SDL SDL12 SDL11
# path suffixes to search inside ENV{SDLDIR}
include/SDL include/SDL12 include/SDL11 include
)
find_path(SDLMIXER_INCLUDE SDL_mixer.h
HINTS
ENV SDLDIR
PATH_SUFFIXES SDL SDL12 SDL11
# path suffixes to search inside ENV{SDLDIR}
include/SDL_mixer include/SDL12 include/SDL11 include
)

message(STATUS "Found SDL At ${SDL_PATH}" )
message(STATUS "Found SDLMixer At ${SDLMIXER_INCLUDE}" )
target_include_directories(SDLlibs INTERFACE "${SDLMIXER_INCLUDE}")
else()

if(${DOWNLOAD_DEPS})
FetchContent_Declare(
ext_sdllib
URL https://www.libsdl.org/release/SDL-devel-1.2.15-VC.zip
SOURCE_DIR "libs/SDL"
)

FetchContent_MakeAvailable(ext_sdllib)

FetchContent_Declare(
ext_sdlmixer
URL https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-devel-1.2.12-VC.zip
SOURCE_DIR "libs/SDL_Mixer"
)

FetchContent_MakeAvailable(ext_sdlmixer)

message(STATUS "Downloaded SDL libraries" )

set(SDL_PATH "${CMAKE_BINARY_DIR}/libs/SDL/")
set(SDLMIXER_PATH "${CMAKE_BINARY_DIR}/libs/SDL_Mixer/")
endif()
endif()


# 32 bit check
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SDLMAIN_DLL_PATH "${SDL_PATH}/lib/x64")
set(SDLMIXER_DLL_PATH "${SDLMIXER_PATH}/lib/x64")
else()
set(SDLMAIN_DLL_PATH "${SDL_PATH}/lib/x86")
set(SDLMIXER_DLL_PATH "${SDLMIXER_PATH}/lib/x86")
endif()

target_link_directories(SDLlibs INTERFACE "${SDLMAIN_DLL_PATH}" "${SDLMIXER_DLL_PATH}")
target_link_libraries(SDLlibs INTERFACE SDL SDLmain SDL_mixer)
target_include_directories(SDLlibs INTERFACE "${SDL_PATH}/include" "${SDLMIXER_PATH}/include")



add_subdirectory(src)
57 changes: 57 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# CMakeList.txt : CMake project for vulkan_guide, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

add_subdirectory(bulletml)


file(GLOB SOURCE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/*.c"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cc"
"${CMAKE_CURRENT_SOURCE_DIR}/*.h" )


add_executable(
rR
${SOURCE_FILES}
)



if(NOT MSVC)
target_link_libraries(rR SDLlibs bulletML GL GLU)
else()
target_link_libraries(rR SDLlibs bulletML opengl32 glu32)
endif()
set_property(TARGET rR PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/..")

# copy exe to the root folder, both windows and linux
add_custom_command(TARGET rR POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:rR> "${CMAKE_CURRENT_SOURCE_DIR}/.."
)

# only copy the DLLs on windows
if( WIN32 )
# copy dlls to the root folder
add_custom_command(TARGET rR POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${SDLMAIN_DLL_PATH}/SDL.dll" "${CMAKE_CURRENT_SOURCE_DIR}/.."
)
add_custom_command(TARGET rR POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${SDLMIXER_DLL_PATH}/SDL_mixer.dll" "${CMAKE_CURRENT_SOURCE_DIR}/.."
)

# copy dlls to the bin folder
add_custom_command(TARGET rR POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${SDLMAIN_DLL_PATH}/SDL.dll" $<TARGET_FILE_DIR:rR>
)
add_custom_command(TARGET rR POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${SDLMIXER_DLL_PATH}/SDL_mixer.dll" $<TARGET_FILE_DIR:rR>
)
endif()


if(NOT MSVC)
set_target_properties(rR PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-deprecated-declarations")
endif()

18 changes: 16 additions & 2 deletions src/barragemanager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,25 @@
extern "C" {
#include "SDL.h"
#include <sys/types.h>
#include <dirent.h>

#include "genmcr.h"
#include "brgmng_mtd.h"
}

#ifdef _WIN32
//this is necessary to get it to build as its missing the definition
FILE _iob[] = { *stdin, *stdout, *stderr };

extern "C" FILE * __cdecl __iob_func(void)
{
return _iob;
}

#include "dirent_windows.h"

#else
#include "dirent.h"
#endif
}
#include "barragemanager.h"

Barrage barragePattern[BARRAGE_TYPE_NUM][BARRAGE_PATTERN_MAX];
Expand Down
22 changes: 22 additions & 0 deletions src/bulletml/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# CMakeList.txt : CMake project for vulkan_guide, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

# Setup BulletML paths


file(GLOB_RECURSE BULLETML_SOURCE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/*.c"
"${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/*.h" )

list(FILTER BULLETML_SOURCE_FILES EXCLUDE REGEX "test")

add_library(bulletML STATIC ${BULLETML_SOURCE_FILES})

target_include_directories(bulletML PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")

if(NOT MSVC)
set_target_properties(bulletML PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-deprecated-declarations")
endif()
30 changes: 30 additions & 0 deletions src/bulletml/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
CC = g++
INCLUDES = -I.
LIBS = tinyxml/tinyxml.o tinyxml/tinyxmlparser.o tinyxml/tinyxmlerror.o
#CXXFLAGS = -g -W -Wall -ansi -pedantic
#CXXFLAGS = -pg -g -W -Wall -ansi -pedantic
CXXFLAGS = -O2 -W -Wall -ansi -pedantic
CFLAGS = -O2
OBJS = bulletmlparser-tinyxml.o bulletmlparser.o bulletmltree.o calc.o formula-variables.o bulletmlrunner.o bulletmlrunnerimpl.o

all: libbulletml.a

libbulletml.a: $(OBJS)
$(MAKE) -C tinyxml
$(AR) -r libbulletml.a *.o tinyxml/tiny*.o

clean:
rm -f *.o *.a
$(MAKE) -C tinyxml clean

calc.cpp: calc.yy
bison -y calc.yy && mv y.tab.c calc.cpp

$(OBJS): %.o: %.cpp
$(CC) -c $(CXXFLAGS) $(INCLUDES) $<

doxy:
doxygen

distdir:

27 changes: 27 additions & 0 deletions src/bulletml/auto_ptr_fix.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
*
*/

#ifndef auto_ptr_fix_h_
#define auto_ptr_fix_h_

#include <memory>

template <class T_>
inline void auto_ptr_copy (std::auto_ptr<T_>& lhs, std::auto_ptr<T_> rhs) {
lhs = rhs;
}
template <class T_>
inline void auto_ptr_copy (std::auto_ptr<T_>& lhs, T_* rhs) {
std::auto_ptr<T_> p(rhs);
lhs = p;
}
template <class T_>
inline T_* auto_ptr_release(std::auto_ptr<T_>& p) {
T_* ret = p.release();
auto_ptr_copy(p, std::auto_ptr<T_>());
return ret;
}

#endif // ! auto_ptr_fix_h_

38 changes: 0 additions & 38 deletions src/bulletml/boost/assert.hpp

This file was deleted.