aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-07-23 04:18:22 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-07-23 04:23:05 +0200
commite8dd951c6c2bc3f3496eec26192b9b81c062ca1a (patch)
treec209fdc85fb39499cd58925aace8e179b8998213 /cmake
parent94d98176ea79edc87f11456bbb295e82381fc947 (diff)
downloadjancity-e8dd951c6c2bc3f3496eec26192b9b81c062ca1a.tar.gz
Use find_package for SDL libraries
CMake already distributes FindSDL*.cmake files for SDL and SDL_mixer, which support custom prefixes via environment variables, removing the need for ad-hoc logic in Win9x builds. Also, according to FindSDL.cmake, #include <SDL.h> is the preferred way for portability reasons, instead of #include <SDL/SDL.h>, which is the option that has been used so far.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/host.cmake5
-rw-r--r--cmake/win9x.cmake27
2 files changed, 1 insertions, 31 deletions
diff --git a/cmake/host.cmake b/cmake/host.cmake
index bb0827d..6fa47b9 100644
--- a/cmake/host.cmake
+++ b/cmake/host.cmake
@@ -1,8 +1,3 @@
-find_package(SDL 1.2 REQUIRED)
-find_package(SDL_mixer 1.2 REQUIRED)
-find_package(SDL_gfx 2.0 REQUIRED)
-set(SDL1_2_BUILD 1)
-
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(cflags ${cflags} -Og)
else()
diff --git a/cmake/win9x.cmake b/cmake/win9x.cmake
index 46bb725..a4d8f79 100644
--- a/cmake/win9x.cmake
+++ b/cmake/win9x.cmake
@@ -1,11 +1,3 @@
-if("$ENV{SDL_PATH}" STREQUAL "")
- message(FATAL_ERROR "please define env variable SDL_PATH")
-elseif("$ENV{SDL_MIXER_PATH}" STREQUAL "")
- message(FATAL_ERROR "please define env variable SDL_MIXER_PATH")
-elseif("$ENV{SDL_GFX_PATH}" STREQUAL "")
- message(FATAL_ERROR "please define env variable SDL_GFX_PATH")
-endif()
-
add_custom_command(OUTPUT ${cdroot}/${PROJECT_NAME}
COMMAND i386-mingw32-strip ${PROJECT_NAME} -o ${cdroot}/${PROJECT_NAME}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
@@ -13,26 +5,9 @@ add_custom_command(OUTPUT ${cdroot}/${PROJECT_NAME}
VERBATIM)
add_custom_target(stripped-exe ALL DEPENDS ${cdroot}/${PROJECT_NAME})
-add_library(SDL STATIC IMPORTED)
-set_property(TARGET SDL PROPERTY IMPORTED_LOCATION $ENV{SDL_PATH}/lib/libSDL.a)
-target_include_directories(SDL INTERFACE
- $ENV{SDL_PATH}/include $ENV{SDL_PATH}/include/SDL)
-target_link_libraries(SDL INTERFACE gdi32 user32 winmm dxguid)
-
-add_library(SDL_mixer STATIC IMPORTED)
-set_property(TARGET SDL_mixer PROPERTY IMPORTED_LOCATION
- $ENV{SDL_MIXER_PATH}/lib/libSDL_mixer.a)
-target_include_directories(SDL_mixer INTERFACE $ENV{SDL_MIXER_PATH}/include)
-target_link_libraries(SDL_mixer INTERFACE SDL)
-
-add_library(SDL_gfx STATIC IMPORTED)
-set_property(TARGET SDL_gfx PROPERTY IMPORTED_LOCATION
- $ENV{SDL_GFX_PATH}/lib/libSDL_gfx.a)
-target_include_directories(SDL_gfx INTERFACE $ENV{SDL_GFX_PATH}/include)
-target_link_libraries(SDL_gfx INTERFACE SDL)
+target_link_libraries(SDL::SDL INTERFACE gdi32 user32 winmm dxguid)
add_compile_options(-march=i386)
-set(SDL1_2_BUILD 1)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# i386-mingw32-gcc 3.4.5 does not support -Og.