Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed the build script as that you no longer have to link the source …

…code files

in both the unit test and the subdirectory in which they originally reside.
  • Loading branch information...
commit 1171450d4a9a388fedab1258f6be88d9379eef5e 1 parent b561a35
@andrewfenn authored
View
19 CMakeLists.txt
@@ -3,14 +3,17 @@ project(HARDWAR)
cmake_policy(SET CMP0003 NEW)
# project version
-SET( HARDWAR_MAJOR_VERSION 0 )
-SET( HARDWAR_MINOR_VERSION 1 )
-SET( HARDWAR_PATCH_LEVEL 0 )
-
-SET( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}"
- "${HARDWAR_SOURCE_DIR}/cmake/modules"
- "${HARDWAR_SOURCE_DIR}/cmake/scripts"
- )
+set( HARDWAR_MAJOR_VERSION 0 )
+set( HARDWAR_MINOR_VERSION 1 )
+set( HARDWAR_PATCH_LEVEL 0 )
+
+set( CMAKE_MODULE_PATH
+ "${CMAKE_MODULE_PATH}"
+ "${HARDWAR_SOURCE_DIR}/cmake/modules"
+ "${HARDWAR_SOURCE_DIR}/cmake/scripts"
+)
+
+include(SourceFiles)
message(STATUS "Building Hardwar version ${HARDWAR_VERSION_STRING}")
set(abi_version ${HARDWAR_VERSION_STRING})
View
10 cmake/scripts/SourceFiles.cmake
@@ -0,0 +1,10 @@
+
+macro(source_files name)
+ set(_temp_source_files "")
+ foreach(src_file ${${name}})
+ string(STRIP ${src_file} src_file)
+ set("_temp_source_files" "${_temp_source_files}${CMAKE_CURRENT_SOURCE_DIR}/${src_file};")
+ endforeach()
+ set(${name} ${_temp_source_files})
+endmacro(source_files)
+
View
21 code/client/core/CMakeLists.txt
@@ -1,9 +1,26 @@
+if (UNIX)
+ set(client_source
+ "src/GameRootLinux.cpp"
+ )
+endif()
+
+if (WIN32)
+ set(client_source
+ "src/GameRootWin.cpp"
+ )
+endif()
+
set(client_source
${client_source}
- src/GameRoot.cpp
- src/main.cpp
+ "src/GameRoot.cpp"
+ "src/GameManager.cpp"
+ "src/RootGameState.cpp"
+ "src/GameState.cpp"
)
+source_files("client_source")
+set(client_source ${client_source} PARENT_SCOPE)
+
include_directories("include")
View
30 tests/client/CMakeLists.txt
@@ -1,16 +1,14 @@
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0003 NEW)
-project(ClientTest)
+project(clientTest)
-set(ClientTest_source
- ${CMAKE_SOURCE_DIR}/code/client/core/src/GameRoot.cpp
- ${CMAKE_SOURCE_DIR}/code/client/core/src/GameManager.cpp
- ${CMAKE_SOURCE_DIR}/code/client/core/src/RootGameState.cpp
- ${CMAKE_SOURCE_DIR}/code/client/core/src/GameState.cpp
+add_subdirectory("${CMAKE_SOURCE_DIR}/code/client/core/" "${CMAKE_CURRENT_BINARY_DIR}/client/core/")
- ${CMAKE_SOURCE_DIR}/code/shared/src/Building.cpp
+set(clientTest_source
+ ${client_source}
+ ${CMAKE_SOURCE_DIR}/code/shared/src/Building.cpp
${CMAKE_SOURCE_DIR}/code/client/tasks/src/InputTask.cpp
${CMAKE_SOURCE_DIR}/code/client/tasks/src/NetworkTask.cpp
@@ -19,7 +17,8 @@ set(ClientTest_source
core/TestNetworkTask.cpp
core/main.cpp
)
-source_group("ClientTest" FILES ${ClientTest_source})
+
+source_group("clientTest" FILES ${clientTest_source})
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/dependencies/UnitTest++/src")
include_directories(SYSTEM ${OGRE_INCLUDE_DIRS})
@@ -36,7 +35,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/code/shared/include
)
-
link_libraries(UnitTest Enet)
if (WIN32)
@@ -44,16 +42,16 @@ if (WIN32)
endif ()
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/tests/)
-add_executable(ClientTest ${exe} ${ClientTest_source})
+add_executable(clientTest ${exe} ${clientTest_source})
-add_dependencies(ClientTest UnitTest)
-add_dependencies(ClientTest Enet)
+add_dependencies(clientTest UnitTest)
+add_dependencies(clientTest Enet)
-target_link_libraries(ClientTest
+target_link_libraries(clientTest
${OGRE_LIBRARIES} ${OGRE_Terrain_LIBRARY} ${OGRE_Paging_LIBRARY}
${Boost_LIBRARIES}
${OIS_LIBRARIES}
- )
+)
if(UNIX)
include(GetC11CompilerFlag)
@@ -61,6 +59,6 @@ if(UNIX)
add_definitions(-Wall -pedantic -Wextra -Wwrite-strings ${c11flag})
endif()
-set_target_properties(ClientTest PROPERTIES SOLUTION_FOLDER UnitTests)
+set_target_properties(clientTest PROPERTIES SOLUTION_FOLDER UnitTests)
-add_custom_command(TARGET ClientTest POST_BUILD COMMAND ${CMAKE_BINARY_DIR}/bin/tests/ClientTest)
+add_custom_command(TARGET clientTest POST_BUILD COMMAND ${CMAKE_BINARY_DIR}/bin/tests/clientTest)
Please sign in to comment.
Something went wrong with that request. Please try again.