Skip to content

Commit

Permalink
Fix Win64 build, vcpkg names
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenoveritas committed Oct 27, 2022
1 parent 0b71476 commit c855a92
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ endif()
if (VCPKG_TARGET_TRIPLET)
# If using vcpkg, don't specify versions, they're in the manifest
find_package(SDL2 CONFIG REQUIRED)
find_package(SDL2-mixer CONFIG REQUIRED)
find_package(SDL2_mixer CONFIG REQUIRED)
else()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(SDL2 2.0.0 REQUIRED)
find_package(SDL2_mixer 2.0.0 REQUIRED)
# For compatibility with vcpkg, configure SDL2_mixer as an imported shared library
add_library(SDL2::SDL2_mixer SHARED IMPORTED)
set_property(TARGET SDL2::SDL2_mixer PROPERTY IMPORTED_LOCATION "${SDL2_MIXER_LIBRARY}")
set_property(TARGET SDL2::SDL2_mixer PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${SDL2_MIXER_INCLUDE_DIRS}")
add_library(SDL2_mixer::SDL2_mixer SHARED IMPORTED)
set_property(TARGET SDL2_mixer::SDL2_mixer PROPERTY IMPORTED_LOCATION "${SDL2_MIXER_LIBRARY}")
set_property(TARGET SDL2_mixer::SDL2_mixer PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${SDL2_MIXER_INCLUDE_DIRS}")
endif()

include(CheckIncludeFiles)
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ target_link_libraries(abuse sdlport)
target_link_libraries(abuse imlib)
target_link_libraries(abuse net)
target_link_libraries(abuse SDL2::SDL2)
target_link_libraries(abuse SDL2::SDL2_mixer)
target_link_libraries(abuse SDL2_mixer::SDL2_mixer)
if(OPENGL_FOUND)
target_link_libraries(abuse ${OPENGL_LIBRARIES})
endif(OPENGL_FOUND)
Expand Down Expand Up @@ -116,7 +116,7 @@ if(WIN32)
RUNTIME DESTINATION "."
LIBRARY DESTINATION ".")
install(FILES $<TARGET_FILE:SDL2::SDL2> DESTINATION ".")
install(FILES $<TARGET_FILE:SDL2::SDL2_mixer> DESTINATION ".")
install(FILES $<TARGET_FILE:SDL2_mixer::SDL2_mixer> DESTINATION ".")
else()
# Under Linux, we want the tools in bin
install(TARGETS abuse abuse-tool RUNTIME DESTINATION bin
Expand Down
7 changes: 7 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ using namespace lol;
//
// Custom utility functions
//
// TODO: Can these be changed to pre-compiler definitions? I'm assuming some compiler didn't optimize
// properly and these are inline functions due to that.
static inline int Min(int a, int b) { return a < b ? a : b; }
static inline int Max(int a, int b) { return a > b ? a : b; }
static inline unsigned int Min(unsigned int a, unsigned int b) { return a < b ? a : b; }
Expand All @@ -48,6 +50,11 @@ static inline long Min(long a, long b) { return a < b ? a : b; }
static inline long Max(long a, long b) { return a > b ? a : b; }
static inline unsigned long Min(unsigned long a, unsigned long b) { return a < b ? a : b; }
static inline unsigned long Max(unsigned long a, unsigned long b) { return a > b ? a : b; }
#if _WIN64
// 64-bit Windows considers size_t to be unsigned long long
static inline unsigned long Min(unsigned long long a, unsigned long long b) { return a < b ? a : b; }
static inline unsigned long Max(unsigned long long a, unsigned long long b) { return a > b ? a : b; }
#endif
static inline float Min(float a, float b) { return a < b ? a : b; }
static inline float Max(float a, float b) { return a > b ? a : b; }

Expand Down
2 changes: 1 addition & 1 deletion src/lisp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include_directories(
${abuse_SOURCE_DIR}/src/imlib
)

target_link_libraries(lisp SDL2::SDL2_mixer)
target_link_libraries(lisp SDL2_mixer::SDL2_mixer)
#INCLUDES = -I$(srcdir) -I$(srcdir)/../ -I$(srcdir)/../imlib $(SDL2_CFLAGS)

#CPPFLAGS = @CPPFLAGS@ -DNO_CHECK
2 changes: 1 addition & 1 deletion src/net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include_directories(
${abuse_SOURCE_DIR}/src/imlib
)

target_link_libraries(net SDL2::SDL2_mixer)
target_link_libraries(net SDL2_mixer::SDL2_mixer)

add_definitions(-DNO_CHECK)

Expand Down
2 changes: 1 addition & 1 deletion src/sdlport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ include_directories(
${abuse_SOURCE_DIR}/src/imlib
)

target_link_libraries(sdlport SDL2::SDL2 SDL2::SDL2_mixer)
target_link_libraries(sdlport SDL2::SDL2 SDL2_mixer::SDL2_mixer)
#
#CPPFLAGS = @CPPFLAGS@ -DNO_CHECK -DASSETDIR=\"$(assetdir)\"

0 comments on commit c855a92

Please sign in to comment.