-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbc1b88
commit 61fb9bc
Showing
7 changed files
with
230 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Build with cmake | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths: | ||
- cmake/** | ||
- src/** | ||
- third_party/** | ||
- CMakeLists.txt | ||
|
||
pull_request: | ||
paths: | ||
- cmake/** | ||
- src/** | ||
- third_party/** | ||
- CMakeLists.txt | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build-with-cmake: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Update apt | ||
run: sudo apt update | ||
|
||
- name: Install dependencies | ||
run: sudo apt install --yes clang cmake libglew-dev libglfw3-dev libglm-dev libopenal-dev xorg-dev | ||
|
||
- name: cmake | ||
uses: ashutoshvarma/action-cmake-build@master | ||
with: | ||
build-dir: ${{ github.workspace }}/build | ||
cc: clang | ||
cxx: clang++ | ||
build-type: Release | ||
configure-options: -DWITH_BOX2D=Yes | ||
parallel: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ Release/ | |
.vs/ | ||
.idea/ | ||
.build/ | ||
build/ | ||
third_party/ | ||
gamedata/config/*.json | ||
gamedata/demoversions/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
option(WITH_BOX2D "Build with bundled Box 2D" ON) | ||
|
||
project(carnage3d) | ||
include(Carnage3D) | ||
|
||
set(CMAKE_DISABLE_SOURCE_CHANGES ON) | ||
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) | ||
|
||
add_compile_options(-Wall -Werror -Wimplicit-fallthrough=0 -pipe -fvisibility=hidden) | ||
|
||
set(CMAKE_CXX_FLAGS_PERFORMANCE "${CMAKE_CXX_FLAGS_RELEASE} -march=native") | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX) | ||
add_compile_options(-fno-strict-aliasing) | ||
endif() | ||
|
||
if(WITH_BOX2D) | ||
message(STATUS "With bundled Box 2D: YES") | ||
else() | ||
message(STATUS "With bundled Box 2D: NO") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
add_subdirectory(src) | ||
add_executable(carnage3d ${CARNAGE3D_SRC}) | ||
|
||
set_target_properties(carnage3d PROPERTIES CXX_STANDARD 17) | ||
set_target_properties(carnage3d PROPERTIES CXX_STANDARD_REQUIRED ON) | ||
|
||
target_precompile_headers(carnage3d PUBLIC src/stdafx.h) | ||
|
||
if(APPLE) | ||
add_definitions(-D"GL_SILENCE_DEPRECATION") | ||
endif() | ||
find_package(OpenAL REQUIRED) | ||
|
||
if(WITH_BOX2D) | ||
set(BOX2D_BUILD_UNIT_TESTS OFF CACHE BOOL "Skip tests") | ||
set(BOX2D_BUILD_TESTBED OFF CACHE BOOL "Skip testbed") | ||
|
||
add_subdirectory(third_party/Box2D) | ||
|
||
target_include_directories(carnage3d PUBLIC "third_party/Box2D/include/") | ||
target_link_libraries(carnage3d "${CMAKE_BINARY_DIR}/third_party/Box2D/bin/libbox2d.a") | ||
|
||
add_dependencies(carnage3d box2d) | ||
else() | ||
find_package(Box2D 2.4.0 REQUIRED) | ||
target_include_directories(carnage3d PUBLIC ${BOX2D_INCLUDE_DIR}) | ||
target_link_libraries(carnage3d ${BOX2D_LIBRARY}) | ||
endif() | ||
|
||
find_package(OpenGL REQUIRED) | ||
find_package(GLEW REQUIRED) | ||
find_package(glfw3 REQUIRED) | ||
|
||
if(NOT(APPLE)) | ||
target_link_libraries(carnage3d stdc++fs) | ||
endif() | ||
|
||
target_include_directories(carnage3d PUBLIC ${OPENAL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIR}) | ||
target_link_libraries(carnage3d glfw ${GLEW_LIBRARY} ${OPENAL_LIBRARY} ${OPENGL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Try to find the Box2D library | ||
# BOX2D_FOUND - system has BOX2D | ||
# BOX2D_INCLUDE_DIR - the BOX2D include directory | ||
# BOX2D_LIBRARY - the BOX2D library | ||
|
||
FIND_PATH(BOX2D_INCLUDE_DIR NAMES box2d/box2d.h) | ||
SET(_BOX2D_LIBS libbox2d.a) | ||
FIND_LIBRARY(BOX2D_LIBRARY NAMES ${_BOX2D_LIBS}) | ||
INCLUDE(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Box2D DEFAULT_MSG BOX2D_LIBRARY BOX2D_INCLUDE_DIR) | ||
MARK_AS_ADVANCED(BOX2D_LIBRARY BOX2D_INCLUDE_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Try to find the GLEW library | ||
# GLEW_FOUND - system has GLEW | ||
# GLEW_INCLUDE_DIR - the GLEW include directory | ||
# GLEW_LIBRARY - the GLEW library | ||
|
||
FIND_PATH(GLEW_INCLUDE_DIR NAMES GL/glew.h) | ||
SET(_GLEW_STATIC_LIBS libGLEW.a libglew32.a) | ||
SET(_GLEW_SHARED_LIBS libGLEW.dll.a libglew32.dll.a GLEW glew32) | ||
IF(USE_STATIC_LIBS) | ||
FIND_LIBRARY(GLEW_LIBRARY NAMES ${_GLEW_STATIC_LIBS} ${_GLEW_SHARED_LIBS}) | ||
ELSE() | ||
FIND_LIBRARY(GLEW_LIBRARY NAMES ${_GLEW_SHARED_LIBS} ${_GLEW_STATIC_LIBS}) | ||
ENDIF() | ||
INCLUDE(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLEW DEFAULT_MSG GLEW_LIBRARY GLEW_INCLUDE_DIR) | ||
MARK_AS_ADVANCED(GLEW_LIBRARY GLEW_INCLUDE_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
set(CARNAGE3D_SRC | ||
${CMAKE_CURRENT_LIST_DIR}/AiCharacterController.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/AiManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/AiPedestrianBehavior.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/AudioDataStream.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/AudioDevice.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/AudioManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/AudioSampleArchive.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/AudioSource.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/BroadcastEventsManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/CarnageGame.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/CharacterController.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Collider.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Collision.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/CommonTypes.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Console.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/ConsoleVar.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/ConsoleWindow.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/DamageInfo.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/DebugRenderer.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/DebugWindow.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Decoration.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Explosion.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/FileSystem.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/FollowCameraController.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Font.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/FontManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/FreeLookCameraController.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GameCamera.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GameCheatsWindow.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GameMapHelpers.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GameMapManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GameObject.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GameObjectsManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GameParams.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GameTextsManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GameplayGamestate.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GenericGamestate.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GpuBuffer.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GpuProgram.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GpuTexture2D.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GpuTextureArray2D.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GraphicsDevice.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GuiContext.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/GuiManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/HUD.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/HumanPlayer.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/ImGuiManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/InputActionsMapping.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/InputsManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Main.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/MainMenuGamestate.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/MapRenderer.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/MemoryManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Obstacle.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/ParticleEffect.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/ParticleEffectsManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/ParticleRenderdata.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Pedestrian.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/PedestrianInfo.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/PedestrianStates.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/PhysicsBody.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/PhysicsManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/PixelsArray.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Projectile.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/RenderProgram.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/RenderingManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/SfxEmitter.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Sprite2D.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/SpriteAnimation.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/SpriteBatch.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/SpriteManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/StyleData.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/System.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/TimeManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/TrafficManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/TrimeshBuffer.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Vehicle.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/Weapon.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/WeaponInfo.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/WeatherManager.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/cJSON.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/enums_impl.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/imgui.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/imgui_demo.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/imgui_draw.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/imgui_widgets.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/json_document.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/mem_allocators.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/path_utils.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/stb_rect_pack.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/stdafx.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/strings.cpp | ||
${CMAKE_CURRENT_LIST_DIR}/wave_utils.cpp | ||
PARENT_SCOPE) |