Skip to content

Commit

Permalink
Merge pull request AppleWin#52 from audetto/cmake
Browse files Browse the repository at this point in the history
Use cmake native find_package for OpenGL.
  • Loading branch information
audetto committed Dec 31, 2021
2 parents d6e9a58 + 9006bcf commit 89d9031
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
15 changes: 7 additions & 8 deletions source/CMakeLists.txt
@@ -1,15 +1,16 @@
include(FindPkgConfig)
include(FindZLIB)

pkg_check_modules(YAML REQUIRED yaml-0.1)
pkg_check_modules(MINIZIP REQUIRED minizip)
pkg_check_modules(ZLIB REQUIRED zlib)
pkg_check_modules(SLIRP slirp)
find_package(ZLIB REQUIRED)
pkg_search_module(YAML REQUIRED yaml-0.1)
pkg_search_module(MINIZIP REQUIRED minizip)
pkg_search_module(SLIRP slirp)

if ("${SLIRP_FOUND}" STREQUAL "")
message(WARNING "'libslirp' not found. Will use 'libpcap' instead")
endif()

pkg_check_modules(PCAP libpcap)
pkg_search_module(PCAP libpcap)
if ("${PCAP_FOUND}" STREQUAL "")
# old versions of pcap do not work with pkg-config
# this is necessary on Rapsberri Pi OS
Expand Down Expand Up @@ -214,7 +215,6 @@ target_include_directories(appleii PRIVATE
${PCAP_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${SLIRP_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
Debugger
)

Expand All @@ -228,7 +228,7 @@ target_link_libraries(appleii PRIVATE
${MINIZIP_LIBRARIES}
${PCAP_LIBRARIES}
${SLIRP_LIBRARIES}
${ZLIB_LIBRARIES}
ZLIB::ZLIB
)

target_link_libraries(appleii PUBLIC
Expand All @@ -240,7 +240,6 @@ target_link_directories(appleii PRIVATE
${MINIZIP_LIBRARY_DIRS}
${PCAP_LIBRARY_DIRS}
${SLIRP_LIBRARY_DIRS}
${ZLIB_LIBRARY_DIRS}
)

target_compile_options(appleii PUBLIC
Expand Down
10 changes: 6 additions & 4 deletions source/frontends/ncurses/CMakeLists.txt
@@ -1,4 +1,5 @@
include(FindPkgConfig)
include(FindCurses)

set(SOURCE_FILES
main.cpp
Expand All @@ -22,22 +23,23 @@ add_executable(applen
${HEADER_FILES}
)

pkg_search_module(NCURSESW REQUIRED ncursesw)
find_package(Curses REQUIRED)
# pkg_search_module(NCURSESW REQUIRED ncursesw)
pkg_search_module(LIBEVDEV REQUIRED libevdev)

target_include_directories(applen PRIVATE
${NCURSESW_INCLUDE_DIRS}
${CURSES_INCLUDE_DIRS}
${LIBEVDEV_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)

target_compile_options(applen PRIVATE
${NCURSESW_CFLAGS_OTHER}
${CURSES_CFLAGS}
${LIBEVDEV_CFLAGS_OTHER}
)

target_link_libraries(applen PRIVATE
${NCURSESW_LIBRARIES}
${CURSES_LIBRARIES}
${LIBEVDEV_LIBRARIES}
appleii
common2
Expand Down
6 changes: 5 additions & 1 deletion source/frontends/sdl/CMakeLists.txt
@@ -1,11 +1,13 @@
include(FindPkgConfig)
include(FindOpenGL)

add_executable(sa2)

set(IMGUI_PATH "imgui/imgui")
set(IMGUI_CLUB_PATH "imgui/imgui_club")

find_package(SDL2 REQUIRED)
# we should use find_package, but Ubuntu does not provide it for SDL2_image
pkg_search_module(SDL2_IMAGE REQUIRED SDL2_image)


Expand All @@ -17,7 +19,7 @@ else()
endif()

if (SA2_OPENGL)
pkg_search_module(GLES2 REQUIRED opengl)
find_package(OpenGL REQUIRED)
else()
pkg_search_module(GLES2 REQUIRED glesv2)
target_compile_definitions(sa2 PRIVATE
Expand Down Expand Up @@ -51,12 +53,14 @@ target_compile_features(sa2 PUBLIC cxx_std_17)
target_include_directories(sa2 PRIVATE
${SDL2_INCLUDE_DIRS}
${SDL2_IMAGE_INCLUDE_DIRS}
${GLES2_INCLUDE_DIRS}
)

target_link_libraries(sa2 PRIVATE
${SDL2_LIBRARIES}
${SDL2_IMAGE_LIBRARIES}
${GLES2_LIBRARIES}
OpenGL::GL
appleii
common2
windows
Expand Down

0 comments on commit 89d9031

Please sign in to comment.