Skip to content

Commit ce0c8ac

Browse files
committed
Add experimental conan support
Try to use conan package manager to handle build dependencies.
1 parent 38ede87 commit ce0c8ac

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
@@ -9,6 +9,9 @@ include(FeatureSummary)
99
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS OFF)
1010
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
1111

12+
# Added for conan generator
13+
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_MODULE_PATH})
14+
1215
# Required for stdbool.h
1316
set(CMAKE_C_STANDARD 99)
1417
# For nullptr in C++
@@ -51,8 +54,9 @@ if(ENABLE_OPENGL)
5154
find_package(OpenGL REQUIRED)
5255
add_definitions(-DUSE_OPENGL)
5356
if(WIN32)
54-
list(APPEND OPENGL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/built_glew/include)
55-
list(APPEND OPENGL_LIBRARIES ${CMAKE_SOURCE_DIR}/build_ext/built_glew/lib/libglew32.dll.a winmm)
57+
find_package(glew REQUIRED)
58+
list(APPEND OPENGL_INCLUDE_DIRS ${glew_INCLUDE_DIRS})
59+
list(APPEND OPENGL_LIBRARIES glew:glew winmm)
5660
endif(WIN32)
5761
endif(ENABLE_OPENGL)
5862

@@ -63,11 +67,9 @@ if(ENABLE_SDL2 MATCHES "ON")
6367
endif(SDL2_FOUND)
6468
endif(ENABLE_SDL2 MATCHES "ON")
6569
if(ENABLE_SDL2 MATCHES "BUNDLED")
66-
set(SDL2_DIR ${CMAKE_SOURCE_DIR}/build_ext/built_sdl)
67-
find_library(SDL2_LIBRARY SDL2 PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH)
68-
find_library(SDL2MAIN_LIBRARY SDL2main PATHS ${SDL2_DIR}/lib NO_DEFAULT_PATH)
69-
set(SDL2_INCLUDE_DIRS ${SDL2_DIR}/include/SDL2)
70-
set(SDL2_LIBRARIES "${SDL2MAIN_LIBRARY};${SDL2_LIBRARY}")
70+
find_package(sdl2 REQUIRED)
71+
set(SDL2_INCLUDE_DIRS ${sdl2_INCLUDE_DIRS})
72+
set(SDL2_LIBRARIES sdl2::sdl2)
7173
endif(ENABLE_SDL2 MATCHES "BUNDLED")
7274

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

@@ -90,9 +92,9 @@ if(ENABLE_FLUIDSYNTH MATCHES "ON")
9092
add_definitions("-DUSE_FLUIDSYNTH=1")
9193
endif(ENABLE_FLUIDSYNTH MATCHES "ON")
9294
if(ENABLE_FLUIDSYNTH MATCHES "BUNDLED")
93-
find_library(FLUIDSYNTH_LIBRARY fluidsynth PATHS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/src)
94-
set(FLUIDSYNTH_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/fluidsynth-lite/include)
95-
set(FLUIDSYNTH_LIBRARIES ${FLUIDSYNTH_LIBRARY})
95+
find_package(fluidsynth REQUIRED)
96+
set(FLUIDSYNTH_INCLUDE_DIRS ${fluidsynth_INCLUDE_DIRS})
97+
set(FLUIDSYNTH_LIBRARIES fluidsynth::fluidsynth)
9698
add_definitions("-DUSE_FLUIDSYNTH=1")
9799
endif(ENABLE_FLUIDSYNTH MATCHES "BUNDLED")
98100

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)