CMakeLists
CMakeLists
8)
project(SDLPoP)
# have CMake output binaries to the directory that contains the source files
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${SDLPoP_SOURCE_DIR}/..")
#set(SDL2 "C:/work/libraries/SDL2-2.0.8")
# On macOS, if you used Homebrew to install SDL2, the location may be something
like this:
#set(SDL2 "/usr/local/Cellar/sdl2/2.0.5")
if (WIN32)
if (MSVC)
# Don't let Visual Studio run CMake
message(SEND_ERROR "To build using MSVC on Windows, you can use NMake or
run build.bat.")
return()
endif()
# Use the -mwindows compiler flag when compiling with MinGW to hide the console
window
# Only do this when not in debug mode
if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mwindows")
endif (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug"))
# Automatically detect whether we need the x86 or x64 version of the SDL2
library.
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SDL2_ARCH "x86_64-w64-mingw32")
else()
set(SDL2_ARCH "i686-w64-mingw32")
endif()
include_directories(${SDL2}/${SDL2_ARCH}/include)
link_directories(${SDL2}/${SDL2_ARCH}/lib)
endif()
set(SOURCE_FILES
main.c
common.h
config.h
data.c
data.h
proto.h
types.h
seg000.c
seg001.c
seg002.c
seg003.c
seg004.c
seg005.c
seg006.c
seg007.c
seg008.c
seg009.c
seqtbl.c
options.c
midi.c opl3.c opl3.h
replay.c
lighting.c
screenshot.c
menu.c
stb_vorbis.c
icon.rc
)
# macOS-specific:
# By default, a normal binary executable will be created.
# If you want an Application Bundle instead, pass CREATE_BUNDLE to CMake like
so: -DCREATE_BUNDLE=1
# NOTE: Currently, the SDL2 and SDL2_image frameworks are not being correctly
included/linked in the bundle!
# As long as this isn't fixed, these bundles will only work if SDL2 and
SDL2_image are installed.
if(WIN32)
target_link_libraries(prince mingw32 SDL2main SDL2 SDL2_image)
elseif(APPLE)
target_link_libraries(prince SDL2main SDL2 SDL2_image m)
else() # Linux, *BSD, etc.
target_link_libraries(prince SDL2 SDL2_image m)
endif()