$NetBSD$ 1) Use the system ogg/vorbis libraries. 2) Also support NetBSD and OpenBSD. 3) Name the executables according to "the first encounter" or "the second encounter" 4) Install the files in more reasonable places. --- CMakeLists.txt.orig 2022-07-28 19:12:44.000000000 +0000 +++ CMakeLists.txt @@ -61,6 +61,31 @@ if(USE_SYSTEM_ZLIB) endif() endif() +find_package(PkgConfig REQUIRED) + +if(PKG_CONFIG_FOUND) + pkg_check_modules(OGG REQUIRED ogg) + if(OGG_FOUND) + include_directories(${OGG_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "Error! libogg not found") + endif() + pkg_check_modules(VORBIS REQUIRED vorbis) + if(VORBIS_FOUND) + include_directories(${VORBIS_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "Error! libvorbis not found") + endif() + pkg_check_modules(VORBISFILE REQUIRED vorbisfile) + if(VORBISFILE_FOUND) + include_directories(${VORBISFILE_INCLUDE_DIRS}) + else() + message(FATAL_ERROR "Error! libvorbisfile not found") + endif() +else() + message(FATAL_ERROR "Error! pkg-config not found") +endif() + # RAKE! Where to install the binaries. if(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local" OR CMAKE_INSTALL_PREFIX STREQUAL "") # Only works for linux since I don't # know what default is for windows/macos/freebsd. @@ -76,6 +101,12 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") SET(FREEBSD TRUE) endif() +if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") + SET(NETBSD TRUE) +endif() +if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + SET(OPENBSD TRUE) +endif() if(APPLE) SET(MACOSX TRUE) endif() @@ -195,7 +226,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_CO add_definitions(-D_FILE_OFFSET_BITS=64) add_definitions(-D_LARGEFILE_SOURCE=1) add_definitions(-DPRAGMA_ONCE=1) - elseif(FREEBSD) + elseif(FREEBSD OR NETBSD OR OPENBSD) set(CMAKE_SKIP_RPATH ON CACHE BOOL "Skip RPATH" FORCE) add_definitions(-DPLATFORM_UNIX=1) add_definitions(-DPLATFORM_FREEBSD=1) @@ -205,7 +236,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_CO include_directories("/usr/local/include") endif() - if(MACOSX OR LINUX OR FREEBSD) + if(MACOSX OR LINUX OR FREEBSD OR NETBSD OR OPENBSD) add_compile_options(-pthread) add_compile_options(-fsigned-char) endif() @@ -287,8 +318,10 @@ option(TFE "Compile a The First Encounte if (TFE) add_definitions(-DFIRST_ENCOUNTER=1) set(MP "") + set(ENCOUNTER "tfe") else() set(MP "MP") + set(ENCOUNTER "tse") endif() @@ -301,7 +334,7 @@ endif() include_directories( . - ${CMAKE_SOURCE_DIR}/External/libogg/include +# ${CMAKE_SOURCE_DIR}/External/libogg/include ) if(USE_TREMOR) if(PANDORA) @@ -992,6 +1025,9 @@ if(LINUX) target_link_libraries(ssam "m") target_link_libraries(ssam "dl") target_link_libraries(ssam "pthread") + target_link_libraries(ssam ${OGG_LIBRARIES}) + target_link_libraries(ssam ${VORBIS_LIBRARIES}) + target_link_libraries(ssam ${VORBISFILE_LIBRARIES}) target_link_libraries(ssam ${SDL2_LIBRARY}) target_link_libraries(ssam ${ZLIB_LIBRARIES}) if(PANDORA) @@ -1007,10 +1043,13 @@ if(LINUX) endif() endif() -if(FREEBSD) +if(FREEBSD OR NETBSD OR OPENBSD) set_target_properties(ssam PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN") target_link_libraries(ssam "m") target_link_libraries(ssam "pthread") + target_link_libraries(ssam ${OGG_LIBRARIES}) + target_link_libraries(ssam ${VORBIS_LIBRARIES}) + target_link_libraries(ssam ${VORBISFILE_LIBRARIES}) target_link_libraries(ssam ${SDL2_LIBRARY}) target_link_libraries(ssam ${ZLIB_LIBRARIES}) if(BUILD_DEDICATED_SERVER) @@ -1022,9 +1061,7 @@ if(FREEBSD) endif() endif() -if(TFE) - set_target_properties(ssam PROPERTIES OUTPUT_NAME "ssam-tfe") -endif() +set_target_properties(ssam PROPERTIES OUTPUT_NAME "ssam-${ENCOUNTER}") # RAKE! Install Section. if(DEBUG) # RAKE! Will this work with TFE? @@ -1039,8 +1076,8 @@ if(DEBUG) # RAKE! Will this work with TF endif() else() install(TARGETS ssam ${SHADERSLIB} ${GAMEMPLIB} ${ENTITIESMPLIB} - RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/Bin" - LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/Bin" + RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" + LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/ssam-${ENCOUNTER}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) if(BUILD_DEDICATED_SERVER) install(TARGETS SeriousSamDedicated @@ -1053,7 +1090,7 @@ endif() # and SE1_10.gro needs to be installed to Games root dir. if(NOT LOCAL_INSTALL) install(FILES ${CMAKE_SOURCE_DIR}/../SE1_10.gro - DESTINATION ${CMAKE_INSTALL_PREFIX} + DESTINATION "${CMAKE_INSTALL_PREFIX}/share/ssam-${ENCOUNTER}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) endif()