CMake Lists
CMake Lists
13 FATAL_ERROR)
project(wipeout-rewrite)
include(GNUInstallDirs)
include(CMakeDependentOption)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(OpenGL)
find_package(GLEW)
find_package(SDL2)
set(common_src
src/wipeout/camera.c
src/wipeout/camera.h
src/wipeout/droid.c
src/wipeout/droid.h
src/wipeout/game.c
src/wipeout/game.h
src/wipeout/hud.c
src/wipeout/hud.h
src/wipeout/image.c
src/wipeout/image.h
src/wipeout/ingame_menus.c
src/wipeout/ingame_menus.h
src/wipeout/intro.c
src/wipeout/intro.h
src/wipeout/main_menu.c
src/wipeout/main_menu.h
src/wipeout/menu.c
src/wipeout/menu.h
src/wipeout/object.c
src/wipeout/object.h
src/wipeout/particle.c
src/wipeout/particle.h
src/wipeout/race.c
src/wipeout/race.h
src/wipeout/scene.c
src/wipeout/scene.h
src/wipeout/sfx.c
src/wipeout/sfx.h
src/wipeout/ship.c
src/wipeout/ship.h
src/wipeout/ship_ai.c
src/wipeout/ship_ai.h
src/wipeout/ship_player.c
src/wipeout/ship_player.h
src/wipeout/title.c
src/wipeout/title.h
src/wipeout/track.c
src/wipeout/track.h
src/wipeout/ui.c
src/wipeout/ui.h
src/wipeout/weapon.c
src/wipeout/weapon.h
src/input.c
src/input.h
src/mem.c
src/mem.h
src/platform.h
src/render.h
src/system.c
src/system.h
src/types.c
src/types.h
src/utils.c
src/utils.h
packaging/windows/wipeout.exe.manifest
packaging/windows/wipeout.rc
)
if(WIN32)
target_compile_definitions(wipeout PRIVATE
"NOMINMAX"
"_USE_MATH_DEFINES"
"_CRT_SECURE_NO_WARNINGS"
)
elseif(APPLE)
target_compile_definitions(wipeout PRIVATE
"_THREAD_SAFE"
"GL_SILENCE_DEPRECATION"
)
target_link_libraries(wipeout PUBLIC "-framework Foundation")
set_source_files_properties(src/platform_sokol.c PROPERTIES COMPILE_FLAGS "-x
objective-c")
if("${PLATFORM}" STREQUAL SOKOL)
target_link_libraries(wipeout PUBLIC
"-framework Cocoa"
"-framework QuartzCore"
"-framework AudioToolbox"
)
endif()
elseif(EMSCRIPTEN)
# Emscripten's CMake modules don't define targets like the standard
# ones do, so we define them ourselves here.
add_library(GLEW::GLEW INTERFACE IMPORTED)
add_library(OpenGL::GL INTERFACE IMPORTED)
if (NOT TARGET SDL2::Main)
add_library(SDL2::Main INTERFACE IMPORTED)
endif()
set_target_properties(OpenGL::GL PROPERTIES
IMPORTED_LIBNAME "GL"
)
set_target_properties(GLEW::GLEW PROPERTIES
IMPORTED_LIBNAME "GLEW"
)
set_target_properties(SDL2::Main PROPERTIES
IMPORTED_LIBNAME "SDL2"
INTERFACE_COMPILE_OPTIONS "SHELL:-s USE_SDL=2"
INTERFACE_LINK_LIBRARIES "SHELL:-s USE_SDL=2"
)
target_link_options(wipeout PRIVATE
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
"SHELL:-s ENVIRONMENT=web"
"SHELL:-s FORCE_FILESYSTEM"
"SHELL:--preload-file ${CMAKE_SOURCE_DIR}/wipeout/@/wipeout"
)
if(MINIMAL_BUNDLE)
target_link_options(wipeout PRIVATE
"SHELL:--exclude-file ${CMAKE_SOURCE_DIR}/wipeout/music"
"SHELL:--exclude-file ${CMAKE_SOURCE_DIR}/intro.mpeg"
)
endif()
configure_file("${CMAKE_SOURCE_DIR}/src/wasm-index.html" "game.html"
COPYONLY)
elseif(UNIX)
target_link_libraries(wipeout PUBLIC m)
if ("${PLATFORM}" STREQUAL "SOKOL" AND "${CMAKE_SYSTEM_NAME}" STREQUAL
"Linux")
find_package(Threads REQUIRED)
find_package(X11 REQUIRED)
find_package(ALSA REQUIRED)
target_link_libraries(wipeout PUBLIC
X11::X11
X11::Xcursor
Threads::Threads
X11::Xi
dl
ALSA::ALSA
)
endif()
endif()
if(using_gl)
target_compile_definitions(wipeout PRIVATE "RENDERER_GL")
target_sources(wipeout PRIVATE src/render_gl.c)
if(NOT APPLE)
target_include_directories(wipeout PRIVATE ${GLEW_INCLUDE_DIRS})
target_link_libraries(wipeout PRIVATE GLEW::GLEW)
endif()
elseif("${RENDERER}" STREQUAL "SOFTWARE")
target_compile_definitions(wipeout PRIVATE "RENDERER_SOFTWARE")
target_sources(wipeout PRIVATE src/render_software.c)
endif()
install(TARGETS wipeout)