diff --git a/CMakeLists.txt b/CMakeLists.txt index 6883e1ea..fb56f9bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,12 +77,23 @@ else(GIT) message(STATUS "Cannot determine RGBDS version (Git not installed), falling back") endif(GIT) +find_package(PkgConfig) +if(MSVC OR NOT PKG_CONFIG_FOUND) + # fallback to find_package + find_package(PNG REQUIRED) +else() + pkg_check_modules(LIBPNG REQUIRED libpng) +endif() + include_directories("${PROJECT_SOURCE_DIR}/include") set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED True) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) add_subdirectory(src) +add_subdirectory(test) # By default, build in Release mode; Debug mode must be explicitly requested # (You may want to augment it with the options above) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cf7723f9..131837f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,14 +14,6 @@ set(common_src "_version.c" ) -find_package(PkgConfig) -if(MSVC OR NOT PKG_CONFIG_FOUND) - # fallback to find_package - find_package(PNG REQUIRED) -else() - pkg_check_modules(LIBPNG REQUIRED libpng) -endif() - find_package(BISON REQUIRED) set(BISON_FLAGS "-Wall") # Set sompe optimization flags on versions that support them @@ -104,8 +96,6 @@ foreach(PROG "asm" "fix" "gfx" "link") install(TARGETS rgb${PROG} RUNTIME DESTINATION bin) endforeach() -set_target_properties(rgbgfx PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED True) - if(LIBPNG_FOUND) # pkg-config target_include_directories(rgbgfx PRIVATE ${LIBPNG_INCLUDE_DIRS}) target_link_directories(rgbgfx PRIVATE ${LIBPNG_LIBRARY_DIRS}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..c8baf0d7 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,21 @@ + +add_executable(randtilegen gfx/randtilegen.c) +if(NOT MSVC) + target_compile_options(randtilegen PRIVATE -Wno-vla) +endif() + +add_executable(rgbgfx_test gfx/rgbgfx_test.cpp) + +install(TARGETS randtilegen rgbgfx_test DESTINATION ${rgbds_SOURCE_DIR}/test/gfx) + +foreach(TARGET randtilegen rgbgfx_test) + if(LIBPNG_FOUND) # pkg-config + target_include_directories(${TARGET} PRIVATE ${LIBPNG_INCLUDE_DIRS}) + target_link_directories(${TARGET} PRIVATE ${LIBPNG_LIBRARY_DIRS}) + target_link_libraries(${TARGET} PRIVATE ${LIBPNG_LIBRARIES}) + else() + target_compile_definitions(${TARGET} PRIVATE ${PNG_DEFINITIONS}) + target_include_directories(${TARGET} PRIVATE ${PNG_INCLUDE_DIRS}) + target_link_libraries(${TARGET} PRIVATE ${PNG_LIBRARIES}) + endif() +endforeach() diff --git a/test/gfx/seed0.bin b/test/gfx/seed0.bin new file mode 100644 index 00000000..e6153d5f Binary files /dev/null and b/test/gfx/seed0.bin differ diff --git a/test/gfx/seed1.bin b/test/gfx/seed1.bin new file mode 100644 index 00000000..33aa7cb4 Binary files /dev/null and b/test/gfx/seed1.bin differ diff --git a/test/gfx/seed10.bin b/test/gfx/seed10.bin new file mode 100644 index 00000000..3c08a78d --- /dev/null +++ b/test/gfx/seed10.bin @@ -0,0 +1,2 @@ +2.CpA22VDu2IEU_/!p!o-/^uNV0gT ?%IA#1|$ttτ$W^ `ďف;WJP!fq.ժ#]iD.mv<\5cJWN=nqgY9Aaa8?~uc[ +([qB>QMz _.pryw~s;Mߏ]/hX+6fq0GoBERDbAm5İgl:H \ No newline at end of file diff --git a/test/gfx/seed11.bin b/test/gfx/seed11.bin new file mode 100644 index 00000000..5e70a832 Binary files /dev/null and b/test/gfx/seed11.bin differ diff --git a/test/gfx/seed12.bin b/test/gfx/seed12.bin new file mode 100644 index 00000000..d7a7f061 Binary files /dev/null and b/test/gfx/seed12.bin differ diff --git a/test/gfx/seed13.bin b/test/gfx/seed13.bin new file mode 100644 index 00000000..9b245a58 --- /dev/null +++ b/test/gfx/seed13.bin @@ -0,0 +1 @@ +?x)&І[g$CaI޿ÃsI5;D2jD[ S+c8[j?DD,rIٽN ;jzA#a\vDp="(XfE~($(K;ScA܍^[$6^u \ No newline at end of file diff --git a/test/gfx/seed14.bin b/test/gfx/seed14.bin new file mode 100644 index 00000000..ade720e8 Binary files /dev/null and b/test/gfx/seed14.bin differ diff --git a/test/gfx/seed15.bin b/test/gfx/seed15.bin new file mode 100644 index 00000000..ff4a5c23 Binary files /dev/null and b/test/gfx/seed15.bin differ diff --git a/test/gfx/seed16.bin b/test/gfx/seed16.bin new file mode 100644 index 00000000..b2a1dfbc Binary files /dev/null and b/test/gfx/seed16.bin differ diff --git a/test/gfx/seed17.bin b/test/gfx/seed17.bin new file mode 100644 index 00000000..e6d5c54f Binary files /dev/null and b/test/gfx/seed17.bin differ diff --git a/test/gfx/seed18.bin b/test/gfx/seed18.bin new file mode 100644 index 00000000..4bc34e48 Binary files /dev/null and b/test/gfx/seed18.bin differ diff --git a/test/gfx/seed19.bin b/test/gfx/seed19.bin new file mode 100644 index 00000000..a957bb8f Binary files /dev/null and b/test/gfx/seed19.bin differ diff --git a/test/gfx/seed2.bin b/test/gfx/seed2.bin new file mode 100644 index 00000000..b53c3245 Binary files /dev/null and b/test/gfx/seed2.bin differ diff --git a/test/gfx/seed20.bin b/test/gfx/seed20.bin new file mode 100644 index 00000000..794022a7 Binary files /dev/null and b/test/gfx/seed20.bin differ diff --git a/test/gfx/seed21.bin b/test/gfx/seed21.bin new file mode 100644 index 00000000..52fd3cda Binary files /dev/null and b/test/gfx/seed21.bin differ diff --git a/test/gfx/seed22.bin b/test/gfx/seed22.bin new file mode 100644 index 00000000..0a80ce52 Binary files /dev/null and b/test/gfx/seed22.bin differ diff --git a/test/gfx/seed23.bin b/test/gfx/seed23.bin new file mode 100644 index 00000000..3f08b03e Binary files /dev/null and b/test/gfx/seed23.bin differ diff --git a/test/gfx/seed24.bin b/test/gfx/seed24.bin new file mode 100644 index 00000000..2c92983b Binary files /dev/null and b/test/gfx/seed24.bin differ diff --git a/test/gfx/seed25.bin b/test/gfx/seed25.bin new file mode 100644 index 00000000..6ab6cdea Binary files /dev/null and b/test/gfx/seed25.bin differ diff --git a/test/gfx/seed26.bin b/test/gfx/seed26.bin new file mode 100644 index 00000000..5a3e13b9 Binary files /dev/null and b/test/gfx/seed26.bin differ diff --git a/test/gfx/seed27.bin b/test/gfx/seed27.bin new file mode 100644 index 00000000..dacef8b0 --- /dev/null +++ b/test/gfx/seed27.bin @@ -0,0 +1,3 @@ + +.[)(l%! \ǶW|'R2x8 tUfZ ]~ŮoZ.vXc,nόPl8#Z<~?y%S*,@e&Xcɟ'$zOgnü7MbYyq #cSDb#/JnOKAƁ0b/)WmR&AwW%- > = 0aBy1?] vb ?A#f dihf&[ \ϫ+