Skip to content

Commit c08b643

Browse files
committed
Add experimental conan support
Try to use conan package manager to handle build dependencies.
1 parent 75be2ba commit c08b643

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

CMakeLists.txt

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ include(FeatureSummary)
77
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
88
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS ON)
99

10+
# Added for conan generator
11+
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
12+
1013
# Required for stdbool.h
1114
set(CMAKE_C_STANDARD 99)
1215
# For nullptr in C++
@@ -49,8 +52,9 @@ if(ENABLE_OPENGL)
4952
find_package(OpenGL REQUIRED)
5053
add_definitions(-DUSE_OPENGL)
5154
if(WIN32)
52-
list(APPEND OPENGL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/built_glew/include)
53-
list(APPEND OPENGL_LIBRARIES ${CMAKE_SOURCE_DIR}/build_ext/built_glew/lib/libglew32.dll.a winmm)
55+
find_package(glew REQUIRED)
56+
list(APPEND OPENGL_INCLUDE_DIRS ${glew_INCLUDE_DIRS})
57+
list(APPEND OPENGL_LIBRARIES glew:glew winmm)
5458
endif(WIN32)
5559
endif(ENABLE_OPENGL)
5660

@@ -61,11 +65,9 @@ if(ENABLE_SDL2 MATCHES "ON")
6165
endif(SDL2_FOUND)
6266
endif(ENABLE_SDL2 MATCHES "ON")
6367
if(ENABLE_SDL2 MATCHES "BUNDLED")
64-
set(SDL2_DIR ${CMAKE_SOURCE_DIR}/build_ext/built_sdl)
65-
find_library(SDL2_LIBRARY SDL2 PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH)
66-
find_library(SDL2MAIN_LIBRARY SDL2main PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH)
67-
set(SDL2_INCLUDE_DIRS ${SDL2_DIR}/include/SDL2)
68-
set(SDL2_LIBRARIES "${SDL2MAIN_LIBRARY};${SDL2_LIBRARY}")
68+
find_package(sdl2 REQUIRED)
69+
set(SDL2_INCLUDE_DIRS ${sdl2_INCLUDE_DIRS})
70+
set(SDL2_LIBRARIES sdl2::sdl2)
6971
endif(ENABLE_SDL2 MATCHES "BUNDLED")
7072

7173
if(ENABLE_SOUND MATCHES "ON")
@@ -75,10 +77,10 @@ if(ENABLE_SOUND MATCHES "ON")
7577
add_definitions(-DUSE_SDL_MIXER=1)
7678
endif(ENABLE_SOUND MATCHES "ON")
7779
if(ENABLE_SOUND MATCHES "BUNDLED")
78-
set(SDL2_MIXER_DIR ${CMAKE_SOURCE_DIR}/build_ext/built_sdl_mixer)
79-
set(SDL2_MIXER_INCLUDE_DIRS ${SDL2_MIXER_DIR}/include/SDL2)
80-
find_library(SDL2_MIXER_LIBRARY SDL2_mixer PATHS ${SDL2_MIXER_DIR}/lib)
81-
set(SDL2_MIXER_LIBRARIES ${SDL2_MIXER_LIBRARY})
80+
find_package(sdl2_mixer REQUIRED)
81+
set(SDL2_MIXER_INCLUDE_DIRS ${sdl2_mixer_INCLUDE_DIRS})
82+
# FIXME additional dependencies ogg and opus
83+
set(SDL2_MIXER_LIBRARIES sdl2_mixer::sdl2_mixer ogg::ogg opus::opus)
8284
add_definitions(-DUSE_SDL_MIXER=1)
8385
endif(ENABLE_SOUND MATCHES "BUNDLED")
8486

@@ -88,9 +90,9 @@ if(ENABLE_FLUIDSYNTH MATCHES "ON")
8890
add_definitions("-DUSE_FLUIDSYNTH=1")
8991
endif(ENABLE_FLUIDSYNTH MATCHES "ON")
9092
if(ENABLE_FLUIDSYNTH MATCHES "BUNDLED")
91-
find_library(FLUIDSYNTH_LIBRARY fluidsynth PATHS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/src)
92-
set(FLUIDSYNTH_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/include)
93-
set(FLUIDSYNTH_LIBRARIES ${FLUIDSYNTH_LIBRARY})
93+
find_package(fluidsynth REQUIRED)
94+
set(FLUIDSYNTH_INCLUDE_DIRS ${fluidsynth_INCLUDE_DIRS})
95+
set(FLUIDSYNTH_LIBRARIES fluidsynth::fluidsynth)
9496
add_definitions("-DUSE_FLUIDSYNTH=1")
9597
endif(ENABLE_FLUIDSYNTH MATCHES "BUNDLED")
9698

conanfile.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[build_requires]
2+
fluidsynth/2.0.5@bincrafters/stable
3+
glew/2.1.0@bincrafters/stable
4+
sdl2/2.0.9@bincrafters/stable
5+
sdl2_mixer/2.0.4@bincrafters/stable
6+
7+
[generators]
8+
cmake_find_package
9+

0 commit comments

Comments
 (0)