rough, initial cmake build for apr trunk
This is barely enough to run testapr. For now it is intended only for Windows. include/apr.hwc is just apr.hw with variables for APR_HAS_EXPAT|LIBXML2. (And sorry about that mixed LF/CR-LF patch.) I point to the latest Windows binary installs of libxml2 and expat like this: set CMAKE_LIBRARY_PATH=c:\Users\Trawick\libxml2-2.7.8.win32\lib;c:\Users\Trawick\Expat2.1.0\Bin; set CMAKE_INCLUDE_PATH=c:\Users\Trawick\libxml2-2.7.8.win32\include;c:\Users\Trawick\Expat2.1.0\Source\lib and I've only used the nmake backend (from a VS 2010 prompt). I haven't actually tried very hard to use libxml2; the build I have seems to want a GNU iconv?? More work would be required to use that. -- Born in Roswell... married an alien... http://emptyhammock.com/ Index: CMakeLists.txt === --- CMakeLists.txt (revision 0) +++ CMakeLists.txt (working copy) @@ -0,0 +1,342 @@ +PROJECT(APR C) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6) + +INCLUDE(GenerateExportHeader) + +# Either Expat or LibXml2 is required +FIND_PACKAGE(Expat) +FIND_PACKAGE(LibXml2) + +IF(NOT EXPAT_FOUND AND NOT LIBXML2_FOUND) + MESSAGE(FATAL_ERROR "Either Expat or LibXml2 is required, but neither was found") +ENDIF() + +IF(EXPAT_FOUND) + OPTION(APR_USE_EXPAT "Use Expat"ON) + IF(LIBXML2_FOUND) +OPTION(APR_USE_LIBXML2 "Use LibXml2" OFF) + ENDIF() +ELSE() + OPTION(APR_USE_LIBXML2"Use LibXml2" ON) +ENDIF() + +OPTION(APR_SHOW_SETTINGS"Show the build configuration" ON) +OPTION(APR_BUILD_TESTAPR"Build the test suite" OFF) + +IF(NOT APR_USE_EXPAT AND NOT APR_USE_LIBXML2) + MESSAGE(FATAL_ERROR "Either Expat or LibXml2 must be selected") +ENDIF() +IF(APR_USE_EXPAT AND APR_USE_LIBXML2) + MESSAGE(FATAL_ERROR "Only one of Expat and LibXml2 can be selected") +ENDIF() +IF(APR_USE_EXPAT) + SET(apr_use_expat_10 1) + SET(apr_use_libxml2_10 0) +ELSE() + SET(apr_use_expat_10 0) + SET(apr_use_libxml2_10 1) +ENDIF() + +CONFIGURE_FILE(include/apr.hwc + ${PROJECT_BINARY_DIR}/apr.h) + +IF(APR_USE_EXPAT) + SET(XMLLIB_INCLUDE_DIR ${EXPAT_INCLUDE_DIRS}) + SET(XMLLIB_LIBRARIES ${EXPAT_LIBRARIES}) +ELSE() + SET(XMLLIB_INCLUDE_DIR ${LIBXML2_INCLUDE_DIR}) + SET(XMLLIB_LIBRARIES ${LIBXML2_LIBRARIES}) +ENDIF() + +# BROKEN: not searching PROJECT_BINARY_DIR first, so I have to +# manually delete apr.h in PROJECT_SOURCE_DIR/include if +# I've generated apr.h before using a Unix-style build +INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include/private ${PROJECT_SOURCE_DIR}/include/arch/win32 ${PROJECT_SOURCE_DIR}/include/private ${PROJECT_SOURCE_DIR}/include/arch/unix ${XMLLIB_INCLUDE_DIR}) + +ADD_DEFINITIONS(-DAPR_DECLARE_EXPORT) + +SET(APR_HEADERS ${PROJECT_BINARY_DIR}/apr.h) + +SET(APR_SOURCES + exports.c + export_vars.c + atomic/win32/apr_atomic.c + buckets/apr_brigade.c + buckets/apr_buckets.c + buckets/apr_buckets_alloc.c + buckets/apr_buckets_eos.c + buckets/apr_buckets_file.c + buckets/apr_buckets_flush.c + buckets/apr_buckets_heap.c + buckets/apr_buckets_mmap.c + buckets/apr_buckets_pipe.c + buckets/apr_buckets_pool.c + buckets/apr_buckets_refcount.c + buckets/apr_buckets_simple.c + buckets/apr_buckets_socket.c + crypto/apr_crypto.c + crypto/apr_crypto_commoncrypto.c + crypto/apr_crypto_nss.c + crypto/apr_crypto_openssl.c + crypto/apr_md4.c + crypto/apr_md5.c + crypto/apr_passwd.c + crypto/apr_sha1.c + crypto/crypt_blowfish.c + crypto/getuuid.c + crypto/uuid.c + dbd/apr_dbd.c + dbd/apr_dbd_mysql.c + dbd/apr_dbd_odbc.c + dbd/apr_dbd_oracle.c + dbd/apr_dbd_pgsql.c + dbd/apr_dbd_sqlite2.c + dbd/apr_dbd_sqlite3.c + dbd/unsupported/apr_dbd_freetds.c + dbm/apr_dbm.c + dbm/apr_dbm_berkeleydb.c + dbm/apr_dbm_gdbm.c + dbm/apr_dbm_ndbm.c + dbm/apr_dbm_sdbm.c + dbm/sdbm/sdbm.c + dbm/sdbm/sdbm_hash.c + dbm/sdbm/sdbm_lock.c + dbm/sdbm/sdbm_pair.c + dso/win32/dso.c + encoding/apr_base64.c + encoding/apr_escape.c + file_io/unix/copy.c + file_io/unix/fileacc.c + file_io/unix/filepath_util.c + file_io/unix/fullrw.c + file_io/unix/mktemp.c + file_io/unix/tempdir.c + file_io/win32/buffer.c + file_io/win32/dir.c + file_io/win32/filedup.c + file_io/win32/filepath.c + file_io/win32/filestat.c + file_io/win32/filesys.c + file_io/win32/flock.c + file_io/win32/open.c + file_io/win32/pipe.c + file_io/win32/readwrite.c + file_io/win32/seek.c + hooks/apr_hooks.c + locks/win32/proc_mutex.c + locks/win32/thread_cond.c + locks/win32/thread_mutex.c + locks/win32/thread_rwlock.c + memcache/apr_memcache.c + memory/unix/apr_pools.c + misc/unix/errorcodes.c + misc/unix/getopt.c + misc/unix/otherchild.c + misc/unix/version.c + misc/win32/apr_app.c + misc/win32/charset.c + misc/win32/env.c + misc/win32/internal.c + misc/win32/misc.c + misc/win32/rand.c + misc/win32/start.c + misc/win32/utf8.c
Re: Did anybody ever play with cmake+apr and/or have any advice applicable to cmake+apr?
On Tue, 20 Aug 2013 15:47:46 -0400 Jeff Trawick wrote: > I plan to spend some time tilting at that windmill starting later this > week, for the purposes of getting a flexible build on Windows. > Enough time to get something working? Dunno :( Just FYI, RELWITHDEBINFO was a broken model, but that's the model we have always aimed for with separate .pdb symbol files for win builds. We want several things that the attached patch to cmake 2.8.7 addresses (it isn't the most elegant, but it works); * disable stack corruption^Woptimization so that user crash dumps with no debug info are still nominally decipherable * a release build is *never* incremental (duh) * /opt:ref to toss useless/unreferenced debug leftovers for release * there was a stupid bug where shared lib link flags in RELWITHDEBINFO inherited DEBUG model, not RELWITHDEBINFO model from exe link flags. I've never worked out how to propagate the actual .pdb file into the install lib/ or bin/ dir when performing the .exe / .dll install step. Hints on improving the patch would be great. --- cmake-2.8/Modules/Platform/Windows-cl.cmake.bak Fri Dec 30 11:45:41 2011 +++ cmake-2.8/Modules/Platform/Windows-cl.cmake Mon Apr 16 14:35:15 2012 @@ -155,14 +155,14 @@ SET(CMAKE_BUILD_TYPE_INIT Debug) SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") - SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /Oy- /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /Oy- /D NDEBUG") + SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /Oy- /D NDEBUG") SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") - SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /Oy- /D NDEBUG") + SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /Oy- /D NDEBUG") + SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /Oy- /D NDEBUG") SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") SET (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}") ELSE(MSVC_VERSION GREATER 1310) @@ -173,7 +173,7 @@ SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") -SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /Oy- /D NDEBUG") SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") @@ -183,14 +183,14 @@ SET(CMAKE_BUILD_TYPE_INIT Debug) SET (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") -SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") -SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") -SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") +SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /Oy- /D NDEBUG") +SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /Oy- /D NDEBUG") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /Oy- /D NDEBUG") SET (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") SET (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") -SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") -SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") +SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /Oy- /D NDEBUG") +SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /Oy- /D NDEBUG") +SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /Oy- /D NDEBUG") ENDIF(CMAKE_USING_VC_FREE_TOOLS) SET (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") ENDIF(MSVC_VERSION GREATER 1310) @@ -218,10 +218,10 @@ IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept ${MSVC_INCREMENTAL_YES_FLAG}") + SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbt
Re: Did anybody ever play with cmake+apr and/or have any advice applicable to cmake+apr?
If you need someone testing the CMake stuff, feel free to ping me. While I don't have much time, I have experience with CMake in the Celix project. 2013/8/21 Jeff Trawick > On Tue, Aug 20, 2013 at 10:12 PM, William A. Rowe Jr. > wrote: > >> On Tue, 20 Aug 2013 15:47:46 -0400 >> Jeff Trawick wrote: >> >> > I plan to spend some time tilting at that windmill starting later this >> > week, for the purposes of getting a flexible build on Windows. >> > Enough time to get something working? Dunno :( >> >> Feel free to attack it from either angle, once we have a unix or >> a windows starting point, the rest is straightforward. >> >> I've looked some at what it will take. Was going to use what the >> pcre project has done as a starting point. >> > > Yeah. I had looked at that very briefly before, but after staring at that > some more today and spending a couple of hours starting a spec for APR > trunk, I'm very happy with my progress. I hope to have the core library > and test suite building today. > > > -- > Born in Roswell... married an alien... > http://emptyhammock.com/ > -- Met vriendelijke groet, Alexander Broekhuis
Re: Did anybody ever play with cmake+apr and/or have any advice applicable to cmake+apr?
On Tue, Aug 20, 2013 at 10:12 PM, William A. Rowe Jr. wrote: > On Tue, 20 Aug 2013 15:47:46 -0400 > Jeff Trawick wrote: > > > I plan to spend some time tilting at that windmill starting later this > > week, for the purposes of getting a flexible build on Windows. > > Enough time to get something working? Dunno :( > > Feel free to attack it from either angle, once we have a unix or > a windows starting point, the rest is straightforward. > > I've looked some at what it will take. Was going to use what the > pcre project has done as a starting point. > Yeah. I had looked at that very briefly before, but after staring at that some more today and spending a couple of hours starting a spec for APR trunk, I'm very happy with my progress. I hope to have the core library and test suite building today. -- Born in Roswell... married an alien... http://emptyhammock.com/