upper case library name

main
cosmonaut 2022-04-12 14:28:52 -07:00
parent 6cbf8d1f8a
commit 4a2e66e4d2
3 changed files with 15 additions and 16 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 2.8.12)
project(wellspring C) project(Wellspring C)
option(BUILD_SHARED_LIBS "Build shared library" ON) option(BUILD_SHARED_LIBS "Build shared library" ON)
option(USE_SDL2 "Use SDL2" ON) option(USE_SDL2 "Use SDL2" ON)
@ -28,11 +28,10 @@ if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9) set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
set(LOBJC "objc") set(LOBJC "objc")
elseif(WIN32) elseif(WIN32)
# "wellspring.dll", not "libwellspring.dll" # "Wellspring.dll", not "libWellspring.dll"
set(CMAKE_SHARED_LIBRARY_PREFIX "") set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif() endif()
if(UNIX) if(UNIX)
SET(BIN_RPATH "\$ORIGIN;\$ORIGIN/assets") #thanks yoyo games
set(CMAKE_SKIP_BUILD_RPATH TRUE) set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH ${BIN_RPATH}) set(CMAKE_INSTALL_RPATH ${BIN_RPATH})
@ -43,29 +42,29 @@ if(USE_SDL2)
add_definitions(-DUSE_SDL2) add_definitions(-DUSE_SDL2)
endif() endif()
add_library(wellspring add_library(Wellspring
#Public header #Public header
include/wellspring.h include/Wellspring.h
#Source #Source
lib/stb_rect_pack.h lib/stb_rect_pack.h
lib/stb_truetype.h lib/stb_truetype.h
src/wellspring.c src/Wellspring.c
) )
# Build flags # Build flags
if(NOT MSVC) if(NOT MSVC)
set_property(TARGET wellspring PROPERTY COMPILE_FLAGS "-std=gnu99 -Wall -Wno-strict-aliasing -pedantic") set_property(TARGET Wellspring PROPERTY COMPILE_FLAGS "-std=gnu99 -Wall -Wno-strict-aliasing -pedantic")
endif() endif()
# includes # includes
target_include_directories(wellspring PUBLIC target_include_directories(Wellspring PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
) )
# Soname # Soname
set_target_properties(wellspring PROPERTIES OUTPUT_NAME "wellspring" set_target_properties(Wellspring PROPERTIES OUTPUT_NAME "Wellspring"
VERSION ${LIB_VERSION} VERSION ${LIB_VERSION}
SOVERSION ${LIB_MAJOR_VERSION} SOVERSION ${LIB_MAJOR_VERSION}
) )
@ -74,21 +73,21 @@ set_target_properties(wellspring PROPERTIES OUTPUT_NAME "wellspring"
if(USE_SDL2) if(USE_SDL2)
if (DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES) if (DEFINED SDL2_INCLUDE_DIRS AND DEFINED SDL2_LIBRARIES)
message(STATUS "using pre-defined SDL2 variables SDL2_INCLUDE_DIRS and SDL2_LIBRARIES") message(STATUS "using pre-defined SDL2 variables SDL2_INCLUDE_DIRS and SDL2_LIBRARIES")
target_include_directories(wellspring PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") target_include_directories(Wellspring PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>")
target_link_libraries(wellspring PUBLIC ${SDL2_LIBRARIES}) target_link_libraries(Wellspring PUBLIC ${SDL2_LIBRARIES})
else() else()
# Only try to autodetect if both SDL2 variables aren't explicitly set # Only try to autodetect if both SDL2 variables aren't explicitly set
find_package(SDL2 CONFIG) find_package(SDL2 CONFIG)
if (TARGET SDL2::SDL2) if (TARGET SDL2::SDL2)
message(STATUS "using TARGET SDL2::SDL2") message(STATUS "using TARGET SDL2::SDL2")
target_link_libraries(wellspring PUBLIC SDL2::SDL2) target_link_libraries(Wellspring PUBLIC SDL2::SDL2)
elseif (TARGET SDL2) elseif (TARGET SDL2)
message(STATUS "using TARGET SDL2") message(STATUS "using TARGET SDL2")
target_link_libraries(wellspring PUBLIC SDL2) target_link_libraries(Wellspring PUBLIC SDL2)
else() else()
message(STATUS "no TARGET SDL2::SDL2, or SDL2, using variables") message(STATUS "no TARGET SDL2::SDL2, or SDL2, using variables")
target_include_directories(wellspring PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>") target_include_directories(Wellspring PUBLIC "$<BUILD_INTERFACE:${SDL2_INCLUDE_DIRS}>")
target_link_libraries(wellspring PUBLIC ${SDL2_LIBRARIES}) target_link_libraries(Wellspring PUBLIC ${SDL2_LIBRARIES})
endif() endif()
endif() endif()
endif() endif()

View File

@ -24,7 +24,7 @@
* *
*/ */
#include "wellspring.h" #include "Wellspring.h"
#include "stb_rect_pack.h" #include "stb_rect_pack.h"
#define STBTT_malloc(x,u) ((void)(u),Wellspring_malloc(x)) #define STBTT_malloc(x,u) ((void)(u),Wellspring_malloc(x))