make pkg-config optional, use native CMake SDL2
bovenliggende
3fd11cc5c4
commit
c2b92c8214
|
@ -7,19 +7,21 @@ project(agw-quake C)
|
|||
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(SDL2 REQUIRED)
|
||||
|
||||
pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2>=2.0.0)
|
||||
find_package(PkgConfig)
|
||||
|
||||
pkg_check_modules(FLAC IMPORTED_TARGET flac>=1.3.3)
|
||||
pkg_check_modules(Vorbis IMPORTED_TARGET vorbis>=1.3.6
|
||||
vorbisfile>=1.3.6
|
||||
ogg>=1.3.4)
|
||||
pkg_check_modules(Opus IMPORTED_TARGET opus>=1.3.1
|
||||
opusfile>=0.11
|
||||
ogg>=1.3.4)
|
||||
pkg_check_modules(MikMod IMPORTED_TARGET libmikmod>=3.3.11)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(FLAC IMPORTED_TARGET flac>=1.3.3)
|
||||
pkg_check_modules(Vorbis IMPORTED_TARGET vorbis>=1.3.6
|
||||
vorbisfile>=1.3.6
|
||||
ogg>=1.3.4)
|
||||
pkg_check_modules(Opus IMPORTED_TARGET opus>=1.3.1
|
||||
opusfile>=0.11
|
||||
ogg>=1.3.4)
|
||||
pkg_check_modules(MikMod IMPORTED_TARGET libmikmod>=3.3.11)
|
||||
endif()
|
||||
|
||||
check_c_source_compiles(
|
||||
"int main(int argc, char *argv[]) {
|
||||
|
@ -202,7 +204,7 @@ endif()
|
|||
add_executable(quake WIN32 ${srcs})
|
||||
|
||||
function(agw_checked_library define library)
|
||||
if(${library}_FOUND)
|
||||
if(PkgConfig_FOUND AND ${library}_FOUND)
|
||||
target_compile_definitions(quake PUBLIC -D${define}=1)
|
||||
target_link_libraries(quake PkgConfig::${library})
|
||||
endif()
|
||||
|
@ -221,5 +223,6 @@ target_compile_options(quake PUBLIC
|
|||
$<$<C_COMPILER_ID:AppleClang,Clang,GNU>:
|
||||
-Wall -Wextra -Werror -Wno-missing-field-initializers>
|
||||
$<$<C_COMPILER_ID:MSVC>: /W4>)
|
||||
target_include_directories(quake SYSTEM PUBLIC ${SDL2_INCLUDE_DIRS})
|
||||
target_include_directories(quake PUBLIC source)
|
||||
target_link_libraries(quake m OpenGL::GL PkgConfig::SDL2)
|
||||
target_link_libraries(quake m OpenGL::GL ${SDL2_LIBRARIES})
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
To compile Spingle, you will need:
|
||||
|
||||
- Any reasonably new C compiler
|
||||
- pkg-config (any version)
|
||||
- CMake (>=3.14)
|
||||
- SDL2 (>=2.0.0)
|
||||
- OpenGL (1.0 or newer, 1.3 for shaders)
|
||||
|
||||
For any optional libraries:
|
||||
|
||||
- pkg-config (any version)
|
||||
|
||||
For FLAC support:
|
||||
|
||||
- libFLAC (>=1.3.3)
|
||||
|
|
Laden…
Verwijs in nieuw issue