Skip to content

Instantly share code, notes, and snippets.

@firefly2442
Created February 16, 2013 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save firefly2442/4967738 to your computer and use it in GitHub Desktop.
Save firefly2442/4967738 to your computer and use it in GitHub Desktop.
Started updating cmake build system for OpenHexagon, not complete
From 3688455524184c3b22e7ed95135da0a09fab9e1e Mon Sep 17 00:00:00 2001
From: firefly2442 <firefly2442@gmail.com>
Date: Sat, 16 Feb 2013 11:03:37 -0600
Subject: [PATCH 1/3] use latest FindSFML.cmake file from upstream
---
cmake/FindSFML.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmake/FindSFML.cmake b/cmake/FindSFML.cmake
index 2d6fbb3..3c57641 100644
--- a/cmake/FindSFML.cmake
+++ b/cmake/FindSFML.cmake
@@ -88,8 +88,8 @@ if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
endif()
FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*" SFML_CONFIG_HPP_CONTENTS "${SFML_CONFIG_HPP_CONTENTS}")
- STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
- STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
+ STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
+ STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10 + ${SFML_FIND_VERSION_MINOR}")
# if we could extract them, compare with the requested version number
@@ -205,5 +205,5 @@ endif()
# handle success
if(SFML_FOUND)
- message("Found SFML: ${SFML_INCLUDE_DIR}")
+ message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR} in ${SFML_INCLUDE_DIR}")
endif()
--
1.7.10.4
From f742fdbd51fead5522f7cd680ae3685051179698 Mon Sep 17 00:00:00 2001
From: firefly2442 <firefly2442@gmail.com>
Date: Sat, 16 Feb 2013 11:04:52 -0600
Subject: [PATCH 2/3] FindJsonCpp.cmake had to be updated slightly to build on
Linux (Ubuntu)
This should be checked by adding additional include directories if they exist
---
cmake/FindJsonCpp.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmake/FindJsonCpp.cmake b/cmake/FindJsonCpp.cmake
index 9d16f2a..905199c 100644
--- a/cmake/FindJsonCpp.cmake
+++ b/cmake/FindJsonCpp.cmake
@@ -9,9 +9,9 @@
# also defined, but not for general use are
# JSONCPP_LIBRARY, where to find the jsoncpp library.
-FIND_PATH(JSONCPP_INCLUDE_DIR jsoncpp/json.h
-/usr/local/include
-/usr/include
+FIND_PATH(JSONCPP_INCLUDE_DIR json/json.h
+/usr/local/include/jsoncpp/
+/usr/include/jsoncpp/
)
# Get the GCC compiler version
--
1.7.10.4
From 8fd648cb5b6cd736e1a9c3907a7139fdc8b43cc6 Mon Sep 17 00:00:00 2001
From: firefly2442 <firefly2442@gmail.com>
Date: Sat, 16 Feb 2013 11:06:21 -0600
Subject: [PATCH 3/3] this CMake file was originally in Jookia's repo but I
updated it because it was out of date, this still needs
tweaking because many of the file locations have
changed
---
CMakeLists.txt | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 104 insertions(+)
create mode 100644 CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..1e3d061
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,104 @@
+# ---------- CMAKE
+
+cmake_minimum_required(VERSION 2.8)
+set(APP_TARGET "OpenHexagon")
+project(${APP_TARGET})
+
+if(NOT CMAKE_BUILD_TYPE) # By default the build type should be Debug.
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
+ "The type of build. Options: None Debug Release RelWithDebInfo MinSizeRel."
+ FORCE)
+endif()
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
+
+# ---------- COMPILER
+
+if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ set(CMAKE_CXX_FLAGS
+ "${CMAKE_CXX_FLAGS} -Wall -pedantic -std=gnu++11")
+ # -Wall: Enable all warnings.
+ # -pedantic: Warn on non-standard ISO C++ code.
+ # -std=gnu++11: Compile C++11 code with some things to make GCC work.
+endif()
+
+# ---------- SOURCE FILES
+
+set(source
+ Components/CPlayer.cpp
+ Components/CPlayer.h
+ Components/CWall.cpp
+ Components/CWall.h
+ Data/EventData.cpp
+ Data/EventData.h
+ Data/LevelData.cpp
+ Data/LevelData.h
+ Data/MusicData.cpp
+ Data/MusicData.h
+ Data/PatternData.h
+ Data/ProfileData.cpp
+ Data/ProfileData.h
+ Data/StyleData.cpp
+ Data/StyleData.h
+ Global/Assets.cpp
+ Global/Assets.h
+ Global/Config.cpp
+ Global/Config.h
+ Global/Factory.cpp
+ Global/Factory.h
+ HexagonGame.cpp
+ HexagonGame.h
+ Main.cpp
+ MenuGame.cpp
+ MenuGame.h
+ SSVLuaWrapper/SSVLuaWrapper.h
+ SSVLuaWrapper/LuaContext.cpp
+ SSVLuaWrapper/LuaContext.h
+ SSVEntitySystem/EntitySystem/Component.cpp
+ SSVEntitySystem/EntitySystem/Component.h
+ SSVEntitySystem/EntitySystem/Entity.cpp
+ SSVEntitySystem/EntitySystem/Entity.h
+ SSVEntitySystem/EntitySystem/Manager.cpp
+ SSVEntitySystem/EntitySystem/Manager.h
+ SSVEntitySystem/SSVEntitySystem.h
+ SSVEntitySystem/Utils.h
+ SSVStart/GameSystem/Game.cpp
+ SSVStart/GameSystem/GameWindow.cpp
+ SSVStart/GameSystem/GameWindow.h
+ SSVStart/SSVStart.h
+ SSVStart/Timeline/Command.cpp
+ SSVStart/Timeline/Command.h
+ SSVStart/Timeline/Do.cpp
+ SSVStart/Timeline/Do.h
+ SSVStart/Timeline/Timeline.cpp
+ SSVStart/Timeline/Timeline.h
+ SSVStart/Timeline/Wait.cpp
+ SSVStart/Timeline/Wait.h
+ Utils/Utils.cpp
+ Utils/Utils.h)
+
+# ---------- APPLICATION
+
+find_package(SFML 2 REQUIRED COMPONENTS audio system graphics window)
+find_package(JsonCpp REQUIRED)
+find_package(Lua51 REQUIRED)
+
+include_directories(
+.
+SSVEntitySystem
+SSVStart
+# Tell the compiler that the include dirs are part of the system, that way the
+# warnings from them will be ignored and they won't break the build due to the
+# enourmous amount of warning and error options the compilers have on.
+SYSTEM
+${SFML_INCLUDE_DIR}
+${LUA_INCLUDE_DIR}
+${JSONCPP_INCLUDE_DIR})
+
+# The WIN32 flag simply removes the command prompt from Windows applications.
+# It's ignored on non-Windows systems.
+add_executable(${APP_TARGET} WIN32 ${source})
+target_link_libraries(${APP_TARGET}
+${SFML_LIBRARIES}
+${LUA_LIBRARIES}
+${JSONCPP_LIBRARIES})
--
1.7.10.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment