From 34279cfacfe7eec6a421e0e59e06ebf2b7d15c1a Mon Sep 17 00:00:00 2001 From: xawotihs Date: Sun, 27 Sep 2015 23:23:31 +0200 Subject: [PATCH] Additional work with cmake on Windows, still does not work --- CMakeLists.txt | 3 ++- CMakeModules/FindOrBuild.cmake | 32 +++++++++++++++++--------------- JGE/CMakeLists.txt | 2 +- platforms/win/configure.cmake | 2 ++ platforms/win32/configure.cmake | 2 -- projects/mtg/CMakeLists.txt | 2 +- thirdparty/libpng/CMakeLists.txt | 1 + thirdparty/unzip/CMakeLists.txt | 2 +- thirdparty/zipFS/CMakeLists.txt | 4 ++-- 9 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 platforms/win/configure.cmake delete mode 100644 platforms/win32/configure.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e8c79b772..21e65af37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,7 @@ if(UNIX AND NOT ANDROID) endif() #third party build options -WAGIC_OPTION(BUILD_ZLIB "build zlib from source" OFF) +WAGIC_OPTION(BUILD_ZLIB "build zlib from source" ON) WAGIC_OPTION(BUILD_JPEG "build jpeg from source" (WIN32 OR APPLE OR PSP OR ANDROID)) WAGIC_OPTION(BUILD_PNG "build png from source" (WIN32 OR APPLE OR PSP OR ANDROID)) WAGIC_OPTION(BUILD_UNZIP "build unzip from source" ON) @@ -155,6 +155,7 @@ endif() # find or build 3rd party libraries +FindOrBuildZLIB() FindOrBuildOpenGL() FindOrBuildTinyXML() FindOrBuildZipFS() diff --git a/CMakeModules/FindOrBuild.cmake b/CMakeModules/FindOrBuild.cmake index 9f1d0bc33..4849e7acf 100644 --- a/CMakeModules/FindOrBuild.cmake +++ b/CMakeModules/FindOrBuild.cmake @@ -46,25 +46,25 @@ macro(FindOrBuildUNZIP) endmacro() macro(FindOrBuildBoost) - if(PSP OR UNIX) + if(PSP OR UNIX OR WIN32) #the psp build does not need more than a few headers #todo: remove from the repository set(BOOST_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty) - elseif(WIN32) +# elseif(WIN32) #set BOOST_ROOT to the root of boost - set(Boost_USE_STATIC_LIBS ON) - set(Boost_USE_MULTITHREADED ON) - set(BOOST_ROOT $ENV{BOOST_ROOT}) +# set(Boost_USE_STATIC_LIBS ON) +# set(Boost_USE_MULTITHREADED ON) +# set(BOOST_ROOT $ENV{BOOST_ROOT}) - set(BOOST_LIBRARYDIR ${BOOST_ROOT}/libs) - set(BOOST_INCLUDEDIR ${BOOST_ROOT}) +# set(BOOST_LIBRARYDIR ${BOOST_ROOT}/libs) +# set(BOOST_INCLUDEDIR ${BOOST_ROOT}) - find_package(Boost COMPONENTS system thread date_time REQUIRED) - if(NOT Boost_FOUND) - message("Set the BOOST_ROOT environment variable to point to your boost installation.") - message("We need system thread and date_time compiled static libs") - message("These libs are compiler specific.") - endif() +# find_package(Boost COMPONENTS system thread date_time REQUIRED) +# if(NOT Boost_FOUND) +# message("Set the BOOST_ROOT environment variable to point to your boost installation.") +# message("We need system thread and date_time compiled static libs") +# message("These libs are compiler specific.") +# endif() # elseif(UNIX AND NOT ANDROID) # find_package(Boost COMPONENTS system thread date_time REQUIRED) elseif(ANDROID) @@ -86,7 +86,9 @@ endmacro() macro(FindOrBuildZLIB) if(BUILD_ZLIB) - message(WARNING "ZLIB sources are currently not included within the wagic tree") + add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/zlib ${CMAKE_BINARY_DIR}/thirdparty/zlib) + set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/zlib) + set(ZLIB_LIBRARY zlib) else() if(WIN32) set(ZLIB_ROOT ${CMAKE_SOURCE_DIR}/thirdparty/binary/win) @@ -94,7 +96,7 @@ macro(FindOrBuildZLIB) else() find_package(ZLIB) endif() - endif() + endif() endmacro() macro(FindOrBuildGIF) diff --git a/JGE/CMakeLists.txt b/JGE/CMakeLists.txt index aadfef628..aeac3d197 100644 --- a/JGE/CMakeLists.txt +++ b/JGE/CMakeLists.txt @@ -115,7 +115,7 @@ if(backend_sdl) ${OPENSL_LIBRARIES}) elseif(WIN32) set(JGE_INTERNAL_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${SDL2_INCLUDE_DIR} - ${UNZIP_INCLUDE_DIR} ${GIF_INCLUDE_DIR} ${Boost_INCLUDE_DIR}) + ${UNZIP_INCLUDE_DIR} ${GIF_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}) set(JGE_SOURCES ${JGE_generic_src} ${JGE_graphics_src} ${JGE_linux_src} ${JGE_hge_src}) set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${GIF_LIBRARIES} ${JPEG_LIBRARY} ${PNG_LIBRARIES}) diff --git a/platforms/win/configure.cmake b/platforms/win/configure.cmake new file mode 100644 index 000000000..0588f1e53 --- /dev/null +++ b/platforms/win/configure.cmake @@ -0,0 +1,2 @@ +add_definitions(-DWIN32) +add_definitions(-D_DEBUG -D_CRT_SECURE_NO_WARNINGS) diff --git a/platforms/win32/configure.cmake b/platforms/win32/configure.cmake deleted file mode 100644 index 11905f5af..000000000 --- a/platforms/win32/configure.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_definitions(-DWIN32) -add_definitions(COMPILE_DEFINITIONS_DEBUG _CRT_SECURE_NO_WARNINGS) diff --git a/projects/mtg/CMakeLists.txt b/projects/mtg/CMakeLists.txt index 3dafdefce..26451cb24 100644 --- a/projects/mtg/CMakeLists.txt +++ b/projects/mtg/CMakeLists.txt @@ -188,7 +188,7 @@ if(backend_sdl) ${HGE_LIBRARY}) elseif(WIN32) include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} - ${Boost_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} + ${Boost_INCLUDE_DIRS} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR}) add_executable(wagic ${MTG_generic_src} ${MTG_sdl_src} src/TestSuiteAI.cpp src/AIPlayerBakaB.cpp) link_directories(${Boost_LIBRARY_DIR} ${SDL2_LIBRARY_DIR}) diff --git a/thirdparty/libpng/CMakeLists.txt b/thirdparty/libpng/CMakeLists.txt index 62f179ae2..53fc47165 100644 --- a/thirdparty/libpng/CMakeLists.txt +++ b/thirdparty/libpng/CMakeLists.txt @@ -18,6 +18,7 @@ SET(SOURCE pngwutil.c ) add_library(png ${SOURCE}) +include_directories(${ZLIB_INCLUDE_DIR}) if(operating_system_psp) # -DCHROME_PNG_WRITE_SUPPORT \ diff --git a/thirdparty/unzip/CMakeLists.txt b/thirdparty/unzip/CMakeLists.txt index c51622ac8..8e39c84c0 100644 --- a/thirdparty/unzip/CMakeLists.txt +++ b/thirdparty/unzip/CMakeLists.txt @@ -5,7 +5,7 @@ SET(SOURCE miniunz.c unzip.c) -include_directories(${ZLIB_INCLUDE_DIR} ${EXTRA_INCLUDES} ${ZLIB_INCLUDE_DIR}) +include_directories(${ZLIB_INCLUDE_DIR} ${EXTRA_INCLUDES}) add_library(unzip ${SOURCE}) target_link_libraries(unzip ${ZLIB_LIBRARY}) diff --git a/thirdparty/zipFS/CMakeLists.txt b/thirdparty/zipFS/CMakeLists.txt index 9f700e6f1..8255b416a 100644 --- a/thirdparty/zipFS/CMakeLists.txt +++ b/thirdparty/zipFS/CMakeLists.txt @@ -5,8 +5,8 @@ set(SOURCES zstream.cpp ziphdr.cpp) -FindOrBuildZLIB() +#FindOrBuildZLIB() include_directories(${CMAKE_SOURCE_DIR}/JGE/include ${EXTRA_INCLUDES} ${ZLIB_INCLUDE_DIR}) add_library(zipFS ${SOURCES}) -target_link_libraries(zipFS ${ZLIB_LIBRARY}) \ No newline at end of file +#target_link_libraries(zipFS ${ZLIB_LIBRARY}) \ No newline at end of file