Skip to content

Commit e20c022

Browse files
committed
clenaup, remove test game as CTest/libuv didn't always work
1 parent be542c9 commit e20c022

8 files changed

+24
-47
lines changed

CMakeLists.txt

+4-25
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,19 @@ VERSION 1.7.0
77

88
enable_testing()
99

10-
set(CMAKE_CXX_STANDARD 11)
1110
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/include)
1211
include_directories(${CMAKE_Fortran_MODULE_DIRECTORY})
1312

14-
include(options.cmake)
13+
option(${PROJECT_NAME}_BUILD_TESTING "enable testing" ${PROJECT_IS_TOP_LEVEL})
14+
option(find "find Ncurses or if not, build PDcurses" true)
15+
option(CMAKE_TLS_VERIFY "enable TLS verification" true)
16+
1517
include(cmake/compilers.cmake)
1618

1719
include(cmake/curses.cmake)
1820

1921
message(STATUS "${PROJECT_NAME} CMake ${CMAKE_VERSION} install prefix: ${CMAKE_INSTALL_PREFIX}")
2022

21-
if(CMAKE_GENERATOR MATCHES "Ninja")
22-
if(WIN32)
23-
set(_rec "MinGW Makefiles")
24-
else()
25-
set(_rec "Unix Makefiles")
26-
endif()
27-
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.27.0 AND CMAKE_VERSION VERSION_LESS 3.27.8)
28-
message(WARNING "CMake ${CMAKE_VERSION} has a bug that prevents Ninja from working properly. Please use Makefile generator:
29-
cmake -G \"${_rec}\"")
30-
endif()
31-
endif()
32-
3323
add_executable(blocktran app/main.f90 src/game.f90)
3424
target_link_libraries(blocktran PRIVATE AI cinter menu shapes blocks keys errs sleep random)
3525
target_compile_options(blocktran PRIVATE ${compile_opts})
@@ -43,15 +33,4 @@ endif()
4333

4434
install(TARGETS blocktran EXPORT ${PROJECT_NAME}-targets)
4535

46-
if(${PROJECT_NAME}_BUILD_TESTING)
47-
add_test(NAME game COMMAND blocktran -d 100 -s 6 6)
48-
set_tests_properties(game PROPERTIES
49-
LABELS gui
50-
DISABLED $<BOOL:${CI}>
51-
TIMEOUT 30
52-
RESOURCE_LOCK display
53-
DEPENDS "shapes;motion;random"
54-
)
55-
endif()
56-
5736
include(cmake/install.cmake)

cmake/abi_check/abi_check.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
extern int addone(int);
2-
extern int addtwo(int);
1+
int addone(int);
2+
int addtwo(int);

cmake/abi_check/addtwo.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
extern "C" int addtwo(int);
22

3-
int addtwo(int N){
4-
return N + 2;
5-
}
3+
int addtwo(int N){ return N + 2; }

cmake/compilers.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
3535
"$<$<COMPILE_LANGUAGE:Fortran>:-traceback;-warn>"
3636
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fpe0;-debug;-check>"
3737
)
38+
if(NOT WIN32)
39+
list(APPEND compile_opts "$<$<COMPILE_LANGUAGE:Fortran>:-fpscomp;logicals>")
40+
endif()
41+
3842
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
3943
set(compile_opts -Wall -Wextra
4044
"$<$<VERSION_LESS:$<Fortran_COMPILER_VERSION>,12.0>:-Wno-maybe-uninitialized>"
4145
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Release>>:-fno-backtrace>"
4246
"$<$<COMPILE_LANGUAGE:Fortran>:-Werror=array-bounds;-Wconversion;-fimplicit-none>"
4347
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fexceptions;-ffpe-trap=invalid,zero,overflow;-fcheck=all>"
4448
)
49+
elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC")
50+
set(compile_opts "$<$<COMPILE_LANGUAGE:Fortran>:-Munixlogical>")
4551
endif()

options.cmake

-7
This file was deleted.

src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ add_library(shapes OBJECT shapes.f90 fields.f90 rot90.f90)
99
target_link_libraries(shapes PRIVATE random)
1010

1111
add_library(sleep OBJECT sleep.cpp sleep.f90)
12+
target_compile_features(sleep PRIVATE cxx_std_11)
1213

1314
add_library(cinter OBJECT cinter.f90 cinter.c
1415
$<$<NOT:$<BOOL:${HAVE_Fortran_GETCH}>>:getch.c>

src/sleep.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
#include <stdio.h>
22

3-
extern void c_sleep(int*);
4-
53
#ifdef _MSC_VER
6-
74
#define WIN32_LEAN_AND_MEAN
85
#include <windows.h>
6+
#else
7+
#include <stdlib.h>
8+
#include <time.h>
9+
#include <errno.h>
10+
#endif
11+
12+
void c_sleep(int*);
913

14+
15+
#ifdef _MSC_VER
1016
// https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-sleep
1117
void c_sleep(int* milliseconds){
1218
Sleep(*milliseconds);
1319
}
14-
1520
#else
16-
17-
#include <stdlib.h>
18-
#include <time.h>
19-
#include <errno.h>
2021
// https://linux.die.net/man/3/usleep
2122
void c_sleep(int* milliseconds)
2223
{
@@ -55,5 +56,4 @@ void c_sleep(int* milliseconds)
5556
}
5657
}
5758
}
58-
5959
#endif

test/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ set_property(TARGET curses_test menu_test testkeys PROPERTY LINKER_LANGUAGE Fort
3232

3333
set_tests_properties(cursesLib title_screen PROPERTIES
3434
LABELS gui
35-
DISABLED $<BOOL:${CI}>
35+
DISABLED $<BOOL:$ENV{CI}>
3636
RESOURCE_LOCK display
3737
DEPENDS "shapes;motion;random"
3838
)

0 commit comments

Comments
 (0)