From d3acd7fa1309b73959a34290cc27c8c91c8180d7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 18 Nov 2016 23:43:34 +0100 Subject: [PATCH] Win32: Allow linking against system OpenGL (mingw) Also "fix" detection of system OpenAL on Windows. --- .gitlab-ci.yml | 4 ++-- CMakeLists.txt | 21 ++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b4f9c00..b6e0c4f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,7 +45,7 @@ build_mingw32: - export PKG_CONFIG_LIBDIR="/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig" - export PATH=/usr/i686-w64-mingw32/bin:$PATH - mkdir -p i686-w64-mingw32 mingw32-build; cd i686-w64-mingw32 - - cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw32.cmake -DLUGARU_INSTALL_PREFIX=/builds/osslugaru/lugaru/mingw32-build -DLUGARU_FORCE_INTERNAL_GLU=True -DLUGARU_FORCE_INTERNAL_OPENAL=True -DLUGARU_FORCE_INTERNAL_OPENGL=True + - cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw32.cmake -DLUGARU_INSTALL_PREFIX=/builds/osslugaru/lugaru/mingw32-build - make -j4; make install artifacts: expire_in: 7d @@ -61,7 +61,7 @@ build_mingw64: - export PKG_CONFIG_LIBDIR="/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig" - export PATH=/usr/x86_64-w64-mingw32/bin:$PATH - mkdir -p x86_64-w64-mingw32 mingw64-build; cd x86_64-w64-mingw32 - - cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw64.cmake -DLUGARU_INSTALL_PREFIX=/builds/osslugaru/lugaru/mingw64-build -DLUGARU_FORCE_INTERNAL_GLU=True- -DLUGARU_FORCE_INTERNAL_OPENAL=True -DLUGARU_FORCE_INTERNAL_OPENGL=True + - cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw64.cmake -DLUGARU_INSTALL_PREFIX=/builds/osslugaru/lugaru/mingw64-build - make -j4; make install artifacts: expire_in: 7d diff --git a/CMakeLists.txt b/CMakeLists.txt index e715fff..44ea757 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,16 +186,10 @@ endif (APPLE) # Deal with dependencies... find_package(OpenGL REQUIRED) # force this include dir no matter what on Windows, so we get sane headers. -if(NOT WIN32) - option (LUGARU_FORCE_INTERNAL_OPENGL "Force internal OpenGL headers, even if there's a system version" True) - if (LUGARU_FORCE_INTERNAL_OPENGL) - include_directories("${DEPDIR}/OpenGL") - endif (LUGARU_FORCE_INTERNAL_OPENGL) -endif(NOT WIN32) - -if(WIN32) +option (LUGARU_FORCE_INTERNAL_OPENGL "Force internal OpenGL headers, even if there's a system version" True) +if (LUGARU_FORCE_INTERNAL_OPENGL) include_directories("${DEPDIR}/OpenGL") -endif(WIN32) +endif (LUGARU_FORCE_INTERNAL_OPENGL) if(MSVC) # More Visual Studio annoyances include_directories("${DEPDIR}/msinttypes") @@ -203,7 +197,12 @@ endif(MSVC) option (LUGARU_FORCE_INTERNAL_OPENAL "Force internal libOpenAL, even if there's a system version" False) if (NOT LUGARU_FORCE_INTERNAL_OPENAL) - find_package(OpenAL REQUIRED) + # FIXME: We should remove bundled libs and allow building OpenAL from source, for all platforms + if (WIN32) + find_package(OpenAL) + else (WIN32) + find_package(OpenAL REQUIRED) + endif() else(NOT LUGARU_FORCE_INTERNAL_OPENAL) set(OPENAL_FOUND False) endif (NOT LUGARU_FORCE_INTERNAL_OPENAL) @@ -445,7 +444,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/Source ) -set(LUGARU_LIBS ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${ZLIB_LIBRARIES} ${SDL2_LIBRARIES} ${OPENGL_glu_LIBRARY} ${VORBISFILE_LIBRARY} ${OGG_LIBRARY} ${PLATFORM_LIBS}) +set(LUGARU_LIBS ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${ZLIB_LIBRARIES} ${SDL2_LIBRARIES} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${VORBISFILE_LIBRARY} ${OGG_LIBRARY} ${PLATFORM_LIBS}) if(WIN32) -- 2.39.5