Skip to content

Commit 485a6fe

Browse files
ASaiVivekkvedala
andauthored
Added a new Tic Tac Toe game made using C (#530)
* Added a new Tic Tac Toe game made using C * Removed .DS_Store from CGames * Delete .DS_Store * Updated Formatting * Deleted the file * Updated Code Formatting * Deleted .DS_Store again * Updated Comments in the Code * Updated code information * Updated Documentation * Updated Information * fix filename * enable cmake for games * add docs and make better global name * fix clang errors * Fixed Segmentation Error * Update games/tic-tac-toe.c Co-authored-by: Krishna Vedala <[email protected]> * Updated Function Description * Update games/tic-tac-toe.c Co-authored-by: Krishna Vedala <[email protected]> Co-authored-by: Krishna Vedala <[email protected]>
1 parent f3bed0e commit 485a6fe

File tree

3 files changed

+463
-0
lines changed

3 files changed

+463
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ endif()
5050
# to configure and compile files in the respective folders
5151
add_subdirectory(hash)
5252
add_subdirectory(misc)
53+
add_subdirectory(games)
5354
add_subdirectory(sorting)
5455
add_subdirectory(graphics)
5556
add_subdirectory(searching)

games/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
2+
# with full pathname. RELATIVE may makes it easier to extract an executable name
3+
# automatically.
4+
file( GLOB APP_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c )
5+
# file( GLOB APP_SOURCES ${CMAKE_SOURCE_DIR}/*.c )
6+
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
7+
8+
foreach( testsourcefile ${APP_SOURCES} )
9+
string( REPLACE ".c" "" testname ${testsourcefile} )
10+
string( REPLACE ".C" "" testname ${testname} )
11+
string( REPLACE " " "_" testname ${testname} )
12+
13+
add_executable( ${testname} ${testsourcefile} )
14+
15+
if(OpenMP_C_FOUND)
16+
target_link_libraries(${testname} OpenMP::OpenMP_C)
17+
endif()
18+
19+
if(MATH_LIBRARY)
20+
target_link_libraries(${testname} ${MATH_LIBRARY})
21+
endif()
22+
install(TARGETS ${testname} DESTINATION "bin/games")
23+
24+
endforeach( testsourcefile ${APP_SOURCES} )

0 commit comments

Comments
 (0)